Re: newbie question: real with fraction to int
Re: newbie question: real with fraction to int
- Subject: Re: newbie question: real with fraction to int
- From: "John W. Baxter" <email@hidden>
- Date: Sat, 25 Oct 2003 14:05:31 -0700
- Envelope-to: email@hidden
On 10/25/2003 9:59, "Nigel Garvey" <email@hidden>
wrote:
>
kai wrote on Fri, 24 Oct 2003 22:49:38 +0100:
>
>
> on Fri, 24 Oct 2003 09:18:32 -0700, Michelle Steiner wrote:
>
>
>> 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...
>
>
And that might be pushed to "nearly 60 times faster" if a coercion's
>
avoided by making the divisor a real as well:
>
>
9.5 div 1.0
and we should compare speed against
9.5 as integer
now that we can.
--John
_______________________________________________
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.