• 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:45:46 -0800

On 11/22/00 8:57 AM, Marc K. Myers <email@hidden> wrote

>The other is to use the "round" function on the result:
>
>set theTotal to (round(theTotal * 100)) / 100
>
>This would change -2134.2399999 to -2134.24, which, you say, is not the
>value you expected.

but

set theTotal to (round(theTotal * 100)) / 100 rounding toward zero

does return the expected value, even for negative numbers.

The options for rounding are up, down, toward zero, and nearest (which is
the default)

--Michelle

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


  • Prev by Date: Re: Scripting screendumps ...
  • Next by Date: Re: Scripting screendumps ...
  • 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