MACSCRPT Archives

May 2003

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Nigel Garvey <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Sat, 17 May 2003 15:20:54 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (54 lines)
Walter Ian Kaye wrote on Fri, 16 May 2003 14:12:27 -0700:

>At 07:15p +0200 05/16/2003, Emmanuel didst inscribe upon an electronic
>papyr=
>us:
>
>>At 10:22 AM -0400 16/05/03, Ethan Rips wrote:
>>=20 >On 5/15/03 10:39 PM, Nigel Garvey <[log in to unmask]>
>>=20 >wrote:
>>=20 >
>>=20 > > 1.5 as double integer
>>=20 > > --> 2.0
>>=20 >
>>=20 >OMM (running 10.1.5) the result is 1.0. Does this behavior change
>depe=
>nding
>>=20 >on one's version of Applescript?
>>
>>LOL!
>>
>>I confirm, here 10.1.6 yields 2.0.
>>
>>10.1.5 has definitely been a strange thing.
>>
>>Emmanuel
>
>Is unexpected behavior of an unsupported coercion considered a bug?
>I guess nobody's tried '1.5 as integer' lately.

It's the double integer itself that's not supported in AppleScript,
otherwise a coercion to it would have to be supported to make it usable.
The only number types mentioned in ASLG are integer and real. Anything
else is for the language's internal use or for future expansion, not
something that scripters are supposed to see or use. The fact that
coercing fractional numbers to double integer rounds them off in the IEEE
style is obviously something that shouldn't happen in a scripting
situation and I apologize if my suggestion that it could be used for this
appeared to be serious.

>The double integer is not a real, it is a double integer. Remember=20
>that AppleScript often rounds terms off (e.g., text -> string), so=20
>just because it tells you that a double integer is a real does not=20
>make it so.

Sorry. I don't understand this.

>Moral: round any decimal numbers yourself before coercing to double.

Two morals, I think:
  1) Don't coerce to double.
  2) Do download aRounderRound from Script Builders. ;-)

NG

ATOM RSS1 RSS2