• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: number with one decimal
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: number with one decimal


  • Subject: Re: number with one decimal
  • From: Stan Cleveland <email@hidden>
  • Date: Mon, 18 Jul 2011 12:59:34 -0700

On Jul 18, 2011, at 12:26 PM, Willem wrote:

But, the strange thing is when aantalvragen is 10 and aantalgoed is 8 , then in line 3 resultaat is 82 (thats oke), but in line 4 its 8,19999999999999 (this should be 8,2)

So applescript thinks that 82 / 10 = 8,1999999999

It does not work to round things.

Hi Willem,

Here's a handler for truncating decimal numbers to a certain number of decimal places:

roundTo(3, 1,23456789)
--> 1,235

on roundTo(numberOfPlaces, theNumber)
return (round (theNumber * (10 ^ numberOfPlaces))) / (10 ^ numberOfPlaces)
end roundTo

Stan C.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >number with one decimal (From: Willem <email@hidden>)

  • Prev by Date: Re: number with one decimal
  • Next by Date: Re: number with one decimal
  • Previous by thread: Re: number with one decimal
  • Next by thread: Re: number with one decimal
  • Index(es):
    • Date
    • Thread