• 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: newbie question: real with fraction to int
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie question: real with fraction to int


  • Subject: Re: newbie question: real with fraction to int
  • From: kai <email@hidden>
  • Date: Fri, 24 Oct 2003 22:49:38 +0100

on Fri, 24 Oct 2003 09:18:32 -0700, Michelle Steiner wrote:

> On Friday, October 24, 2003, at 08:39 AM, leo wrote:
>
>
>>> how can i truncate a value to an int regardless of the fraction ? i
>> looked thoroughly in the ASLanguageGuide but couldn't find anything.
>
> Here are some possibilities
>
> set i to 9.5 div 1
> set i to round 9.5 rounding down
> set i to round 9.5 rounding toward zero
>
> The difference between the second and third is how they treat negative
> numbers. The second will round -9.5 to -10, and the third will round
> -9.5 to -9
> I don't see any difference between the first and the third, though.

Me neither, Michelle - in terms of the results. However, in terms of
performance, 'div' is more than 50 times faster here...

---
kai
_______________________________________________
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: Get IP
  • Next by Date: Replace_chars Subroutine just doesn't work for me
  • Previous by thread: Re: newbie question: real with fraction to int
  • Next by thread: Re: newbie question: real with fraction to int
  • Index(es):
    • Date
    • Thread