Re: Same code gives different answers in 2 different scripts
Re: Same code gives different answers in 2 different scripts
- Subject: Re: Same code gives different answers in 2 different scripts
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 4 Jun 2009 20:22:27 -0400
On Thu, Jun 4, 2009 at 7:31 PM, Doug McNutt <email@hidden> wrote:
> If INT(1.5001) comes out as 2 in AppleScript I would be very surprised - and disappointed. That's simply not what INT( ) does in other languages. It means "integer part of".
Well, first of all, it's not INT(). It's "as integer". It's a
coercion, not a function, and the rules of such coercion are
essentially arbitrary.
Besides, even INT() is ambiguous. Should INT(-1.5) return -1 or -2?
If you want the greatest integer smaller than the number, you can ask
for it explicitly:
floor 1.5001 ==> 1.0
or
(floor 1.5001) as integer ==> 1
But this I don't get:
floor(1.5001) as integer ==> 2.0
I don't know how that can parse as "floor(1.5001 as integer)" with the
parens where they are.
?!?
--
Mark J. Reed <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