correct round of reals?

Peter Schneider-Kamp petersc at stud.ntnu.no
Fri May 12 10:02:33 EDT 2000


Fredrik Lundh wrote:
> 
> def rint(v, m=4503599627370496.0):
>     if abs(v) > m:
>         return v
>     if v > 0:
>         return (v + m) - m
>     else:
>         return (v - m) + m
> 
> (this assumes IEEE doubles)

Thanks. Do you know if e.g. VC++ uses IEEE doubles?

The platforms this code has to run on are those that
do not have an rint(3) function. So a connected
question is if these platforms use IEEE doubles?

bye
Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de




More information about the Python-list mailing list