Re: How to coerce a real to an integer in X?
Re: How to coerce a real to an integer in X?
- Subject: Re: How to coerce a real to an integer in X?
- From: Arthur J Knapp <email@hidden>
- Date: Fri, 01 Feb 2002 14:44:44 -0500
>
Date: Fri, 01 Feb 2002 14:28:58 +1100
>
Subject: Re: How to coerce a real to an integer in X?
>
From: Shane Stanley <email@hidden>
>
On 1/2/02 2:18 PM +1000, Bob.Kalbaugh, email@hidden, wrote:
>
>
> FWIW - OMM - 9.0/1.4:
>
>
>
> integer (3.5)
>
> --> 4
>
I still suspect a third-party do-dad. From ASLG (the old print one):
>
>
"AppleScript supports coercion of a Real value to an Integer value only if
>
the Real value has no fractional part."
And therefore, the behavior of coercing a real-with-fractional-part
to an integer should be considered "undefined".
Except when it works in your favor:
on RoundNumber(x)
return {x} as integer
end RoundNumber
RoundNumber(3.5) --> 4
;-)
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.goodbuddy.net/budco/sware/imscripts.htm>
on error number -128
end try
}