История изменений
Исправление beastie, (текущая версия) :
sub TOLERANCE () { 1e-13 }
sub are_equal {
my ($a, $b) = @_;
return (abs($a-$b) < TOLERANCE);
}
print('==: ', (36.8 == 36.6+0.2) ?'equal':'unequal', "\n");
print('are_equal: ', are_equal(36.8, 36.6+0.2) ?'equal':'unequal', "\n");
Исходная версия beastie, :
sub TOLERANCE () { 1e-13 }
sub are_equal {
my ($a, $b) = @_;
return (abs($a-$b) < TOLERANCE);
}
print('==: ', (36.8 == 36.6+0.2) ?'equal':'unequal', "\n+");
print('are_equal: ', are_equal(36.8, 36.6+0.2) ?'equal':'unequal', "\n+");