Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Decimal numbers calculations done inconsistently: Odd behavior!by atcroft (Abbot) |
on Mar 19, 2015 at 15:40 UTC ( [id://1120602]=note: print w/replies, xml ) | Need Help?? |
Your basic problem is that computers use representations of powers of 2 (even for fractional values), but not every fractional number can be represented accurately as such. For more information, a resource such as What Every Computer Scientist Should Know About Floating-Point Arithmetic or the link to which LanX response referred would be a good start. As to a solution/fix, toolic's referred would be good starting places to look. Hope that helps.
In Section
Seekers of Perl Wisdom
|
|