. , 0,9 0,9, 0,9, , . , , - , . , 0.3 * 3 == 0.9 false. , - , - . ., , Haskell.
, , . , :
def float_equal(a, b)
if a + 0.00001 > b and a - 0.00001 < b
true
else
false
end
end
BigDecimal Ruby .
, assert_in_delta:
def test_some_object_total_is_calculated_correctly
assert_in_delta 22.23, some_object.total, 0.01
end