Re: Round a number towards zero!
Re: Round a number towards zero!
- Subject: Re: Round a number towards zero!
- From: Nigel Garvey <email@hidden>
- Date: Sat, 19 Mar 2005 00:44:28 +0000
deivy petrescu wrote on Fri, 18 Mar 2005 14:49:31 -0500:
>Here:
>
>set myNumber to 83.65
>
>set myNumber rounded to round myNumber
>if myNumberrounded > myNumber then
>set mycorrection to 1
>else if myNumberrounded = myNumber then
>set mycorrection to 0
>else
>set mycorrection to 0
>end if
>set myNumberrounded to myNumberrounded - mycorrection
>
>
>Don't listen to Nigel, he makes things look too simple!
>
>:)
;-)
Well, if you want to be really daft:
set myNumber to 86.5
repeat until myNumber mod 1 is 0
set myNumber to myNumber - 1.0E-12
end repeat
Only three lines! ;-)
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden