P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Because 0.01 = 1/(2*2*5*5) is a decimal not a binary fraction.
That means it can't be expressed without rounding error as a binary floating point number.(5 and 2 are different primes), pretty much like how you can't express 1/3 as a finite decimal floating point number without. see also Humans have too many fingers and What Every Computer Scientist Should Know About Floating-Point Arithmetic
Cheers Rolf
In reply to Re: While loop with addition goes weird (binary float rounding error)
by LanX
|
|