Re: Possible bug.
Re: Possible bug.
- Subject: Re: Possible bug.
- From: Axel Luttgens <email@hidden>
- Date: Mon, 03 May 2004 14:55:20 +0200
Doug McNutt wrote:
At 23:43 -0400 5/2/04, deivy petrescu wrote:
You are right. It is a problem with periodic fractions.
With all the complaints I have about AppleScript I just don't understand this thread.
1/9 = 0.11111111111. . .(10)
Just what did you expect for an answer? More 1's? A text string like "1/9"? Maple and Mathematica can do that, but C can't and AppleScript shouldn't be expected to.
Actually there's some luck involved in getting 0.2 for 1/5 when the floating point representation of 2/10 is considered. It's not exact in that intermediate format.
And there is a difference between "periodic decimals" and "continued fractions". I'm fairly sure you mean the former but both 1/9 and 1/5 are periodic in base 2.
set x to ((1 / ( - 2 ^ 2 + 1))) -- for phun
Well, I needed some time to grasp Deivy's message too ;-)
Reduced to its basics, the problem he pointed is following.
This one is OK:
run script (1 / (2 ^ 2 + 1))
--> 0.2
while this one fails:
run script (1 / (2 ^ 3 + 1))
--> Erreur de syntaxe. un object quelconque
(I left the error message in French, so that everyone may enjoy it).
Incidentally, Chris just provided us with the bug causing that behavior.
Axel
_______________________________________________
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.