Re: div bug
Re: div bug
- Subject: Re: div bug
- From: Bert Groeneveld <email@hidden>
- Date: Tue, 4 Aug 2009 09:36:01 +0200
This is normal behaviour. The div operator is used to divide 2
numbers. Applescript converts both numbers to integers (if they're not
already integers), performs the division, and discards any fractional
remainder. The result is always an integer. Use / instead of div.
Bert.
On 4 aug 2009, at 09:12, julifos wrote:
Hi all!
Just as someone found out it was OK mixing soda with chocolate, Mr.
Bansemer
found this funny bug. Please, check it out and report!
set n to 1.015 * 100 --> 101.5
set n to n + 0.5 --> 102.0
n div 1 --> 101 --> (!)
The workaround for the "affected routines" would be coercing n to
"small
real" (if you wish to preserve decimals) before using div.
Cheers...
jj
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >div bug (From: julifos <email@hidden>) |