No one seems to have actually told you how to fix this. Basically if you are subtracting two floating point numbers (which you are) and then rounding (which is what print does - downward) then the upper bound of the error in the result will be twice the machines epsilon. So to fix this your code need to be this:
use Machine::Epsilon; for (my $x=0.8; $x > 0.1; $x -= 0.01) { print "".($x+(2*machine_epsilon()))."\n"; }
In reply to Re: what did I just see..?
by sectokia
in thread what did I just see..?
by ishaybas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |