No such thing as a small change | |
PerlMonks |
Re: what did I just see..?by haj (Vicar) |
on Mar 21, 2021 at 17:16 UTC ( [id://11130041]=note: print w/replies, xml ) | Need Help?? |
Welcome to the world of floating point arithmetic! Short version: 0.01 can not be represented exactly as a floating point number, there's a tiny error here. Since you always subtract the same number, this error accumulates to the point where the difference shows up. Long version: What Every Programmer Should Know About Floating-Point Arithmetic.
In Section
Seekers of Perl Wisdom
|
|