Re: Rounding real numbers
Re: Rounding real numbers
- Subject: Re: Rounding real numbers
- From: "Arthur J Knapp" <email@hidden>
- Date: Tue, 30 Jan 2001 12:19:25 -0500
>
Subject: Re: Rounding real numbers
>
Date: Mon, 29 Jan 2001 02:00:34 +0000
>
From: Nigel Garvey <email@hidden>
>
on trnc of n at d given rounding:rounding
>
tell 10 ^ d
>
tell n * it -- ie. n * (10 ^ d)
>
if rounding then
>
it div 0.5 - it div 1 -- round to nearest
>
else
>
it div 1 -- or truncate
>
end if
>
end tell
>
result / it -- return the result divided by (10 ^ d)
>
end tell
>
end trnc
>
>
trnc of 6.022548445 at 2 with rounding
>
--> 6.02
Using an osax-defined parameter keyword as a vanilla
handler parameter is pretty darn naughty... ;-)
what did he just say???
--
{
Arthur J Knapp, of STELLARViSIONs ;
http://www.STELLARViSIONs.com ;
mailto:email@hidden ;
how many?
zero.
are you sure?
i counted twice.
}