in reply to False positive on inequality comparison
The flow of the code does seem straight forward enough to suggest that it might by a representation issue. Rather than printing the values, you might consider printing the differences - if they are not literally identical, this should reveal what's getting lost (though I thought there was no truncation in an unformatted print statement). If this does prove to be the issue, you can avoid the false positives by setting a tolerance, e.g.:
my $tolerance = 1.0e-16; # Change this value based on observation if ($tolerance*abs($range_min + $change_min) < abs($range_min - $chang +e_min)) { print "$variable has different minimum value:\n"; print " Change list: $changes{$variable}{min} ($changes{$variable +}{sheet})\n"; print " Range file : $range_file{$variable}{min} ($range_file{$va +riable}{sheet})\n"; my $difference = $range_min - $change_min print " Difference : $difference\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: False positive on inequality comparison
by Nkuvu (Priest) on Apr 03, 2009 at 22:21 UTC | |
by BrowserUk (Patriarch) on Apr 04, 2009 at 02:07 UTC | |
by Nkuvu (Priest) on Apr 06, 2009 at 18:08 UTC | |
by BrowserUk (Patriarch) on Apr 06, 2009 at 19:19 UTC |