Mail Archives: djgpp/1998/06/17/10:00:50
Roberto Sassi (sassi AT biomed DOT polimi DOT it) wrote:
> OKAY
> 0.10000000000000000555111512312578270212
> ERROR
> OKAY
> 0.25000000000000000000000000000000000000
>
> As you can see, with the number 0.25, there is no problem.
> Can You help me in understandig such a behaviour?
Floating point numbers (float/double) have (of course) limited
precision. Some numbers (e.g. 0.25) can be represented exactly in the
used format, some (e.g. 0.1) cannot and must be approximated.
Of course doubles have more precision than floats, but not ad
infinitum.
--
Groeten, Michel. http://www.cs.vu.nl/~mdruiter
____________
\ /====\ / "You know, Beavis, you need things that suck,
\/ \/ to have things that are cool", Butt-Head.
- Raw text -