• 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: simple number question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple number question


  • Subject: Re: simple number question
  • From: Michelle Steiner <email@hidden>
  • Date: Mon, 23 Dec 2002 22:33:17 -0700

On Monday, December 23, 2002, at 07:20 PM, Peter Kincaid wrote:

how do I get a equation to return a number rounded to the nearest tenth
rather than a whole slew of numbers

ex 10 / 3 = 3.33 instead of

10 / 3 = 3.33333333333

Here is a generalized solution:

set x to round_a_number(10, 3, 2)

to round_a_number(numerator, denominator, decimal_places)
set places to 10 ^ decimal_places
set x to (round (numerator / denominator) * places) / places as real
end round_a_number

--Michelle

Never play strip Tarot.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: simple number question
  • Next by Date: Re: APPLE PREVIEWS NEW APPLESCRIPT TECHNOLOGY
  • Previous by thread: Re: simple number question
  • Next by thread: Re: simple number question
  • Index(es):
    • Date
    • Thread