[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rounding errors
- Subject: Re: rounding errors
- From: Alex Schuster <alex(at)pet.mpin-koeln.mpg.de>
- Date: Fri, 27 Apr 2001 12:52:08 +0200
- Newsgroups: comp.lang.idl-pvwave
- Organization: Max-Planck-Institut fuer neurologische Forschung
- References: <3AE9330C.29D059E9@aerosensing.de>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:24710
"Dominic R. Scales" wrote:
> What gives? Is there any numerical math guy/gal out there
> who can tell me how this happens? It seems to me, that
> the accuracy of the second/third cast ist WAY off.
>
> a=double('2.56989')
> b=double( 2.56989 )
You just have to define the 2.56989 as a double: b = 2.56989d :)
Remember that the floating point value 2.56989 is not the same as the
real number 2.56989000000000000..., but just some value around
2.5698900. Converting it to a double introduces more digits to the
right, but they are pretty random.
Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de