• 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: Limiting Decimal Places in a Floating Variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limiting Decimal Places in a Floating Variable?


  • Subject: Re: Limiting Decimal Places in a Floating Variable?
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 22 Nov 2000 09:19:24 -0800

On 11/22/00 5:24 AM, Jonathan Simms <email@hidden> wrote

>I'm trying to come up with a running balance for a list of numbers (like a
>check book).
>The list of numbers are all to 2 decimal places. What's bizarre is that
>applescript does fine (adds to the correct number of places) and then
>returns values like -2134.2399999 for no apparent reason
>
>The nines don't really bother me, as all of the numbers to the left of the
>nines are correct, I just want to know how to limit the number to 2 decimal
>places.

set x to -2134.2399999
set x to (round (x * 100) rounding toward zero) / 100

-- Michelle

----------------------------------------------------------------------
| Michelle Steiner | Hard as it may be to believe, my |
| email@hidden | life has been based on a true story. |
----------------------------------------------------------------------


  • Prev by Date: Splash screen
  • Next by Date: Re: Most Scriptable Apps (was: Re: Can a script receive AppleEvents?)
  • Previous by thread: Re: Limiting Decimal Places in a Floating Variable?
  • Next by thread: Re: Limiting Decimal Places in a Floating Variable?
  • Index(es):
    • Date
    • Thread