in reply to When < isn't less than
you will get this output:my $x = $final_data{$key}; printf "x = %.20f high= %.20f\n", $x, $high;
As you can see, the 0.99 that you get by assigning 0.99 is not the same as the 0.99 you get when you start with 0.90 and add 0.01 nine times. That's the way it is with binary floating point numbers. They're not exactly what you expect. There are several things you could do:x = 0.98999999999999999000 high= 0.99000000000000010000 x = 0.97999999999999998000 high= 0.98000000000000009000 x = 0.96999999999999997000 high= 0.97000000000000008000 x = 0.95999999999999996000 high= 0.96000000000000008000 x = 0.94999999999999996000 high= 0.95000000000000007000 x = 0.93999999999999995000 high= 0.94000000000000006000 x = 0.93000000000000005000 high= 0.94000000000000006000 x = 0.92000000000000004000 high= 0.93000000000000005000 x = 0.91000000000000003000 high= 0.92000000000000004000 x = 0.90000000000000002000 high= 0.91000000000000003000
|
|---|