Just like some numbers are periodic in decimal (e.g. 1/3), some numbers are periodic in binary (e.g. 6/10). They cannot be represented exactly using a float since that would require infinite storage.
You shouldn't check if two floats are equal. You should check if two floats are sufficiently identical.
my $calc = (((63 - -90)/.6) * 601) + (360 /.6); ok( abs( $calc - 153855 ) < 0.000000001 ) or diag("Expected 153855. Got $calc");
In reply to Re: test fails on 64bit uselongdouble Perl
by ikegami
in thread test fails on 64bit uselongdouble Perl
by frankcox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |