NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
floating point numbers are only equal by luck (Score:2, Interesting)
Instead of comparing for exact equality, check that they are relatively close. I.e. instead of:
if ( $x == 0.329 ) ...
use:
if( abs($x-0.329) 1e-7 ) ...
Re:floating point numbers are only equal by luck (Score:1)
Re:floating point numbers are only equal by luck (Score:1)
It's not just perl... (Score:3, Informative)
Reply to This
Re:It's not just perl... (Score:1)
printf "%.40f", $fto see what is going on...There's no such thing as 0.1! (Score:2)