Re: a numeric bug.
Re: a numeric bug.
- Subject: Re: a numeric bug.
- From: Matt Neuburg <email@hidden>
- Date: Fri, 16 Sep 2005 08:31:58 -0700
On Wed, 14 Sep 2005 21:44:35 -0400, deivy petrescu <email@hidden>
said:
>There is a problem with AS it is not system wide, but it also happens
>with Smile.
>
>Check this script
>
><script>
>set lista to {}
>repeat with j from 0 to 23
> set end of lista to 10 ^ j mod 7
>end repeat
>lista
>
>-- {1.0, 3.0, 2.0, 6.0, 4.0, 5.0, 1.0, 3.0, 2.0, 6.0, 4.0, 5.0, 1.0,
>3.0, 2.0, 6.0, 4.0, 5.0, 1.0, 3.0, 2.0, 6.0, 4.0, 1.0}
>
>Well, it looks like the last "1.0" should be a "5.0" (count by 6).
>And it should!
>bc gets it right. So it is not a problem with the system.
>From my book (p. 274): "Do not blame on AppleScript for the phenomena
inherent in doing floating-point arithmetic in any language on any
computer...
2.32 * 100.0 div 1 -- 231"
A computer science 101 course will explain the basic facts about numerics
here. And not a pretty sight. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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