Skip to content

Commit

Permalink
Fix finfo test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakevdp committed Oct 28, 2024
1 parent 514dd97 commit ea9f88c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ml_dtypes/tests/finfo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ def assert_zero(val):

if dtype not in DTYPES_WITH_NO_INFINITY_AND_NO_NAN:
assert_infinite(np.spacing(info.max))
assert info.max > 0
assert info.max > 0.0

if info.min < 0 and dtype not in DTYPES_WITH_NO_INFINITY_AND_NO_NAN:
if info.min < 0.0 and dtype not in DTYPES_WITH_NO_INFINITY_AND_NO_NAN:
# Only valid for signed floating format.
assert_infinite(-np.spacing(info.min))
elif info.min > 0:
elif info.min > 0.0:
# No zero in floating point format.
assert_infinite(0)
assert_infinite(make_val(-1))
elif info.min == 0:
elif info.min == 0.0:
# Zero supported, but not negative values.
self.assertEqual(make_val(0), 0)
assert_infinite(make_val(-1))
Expand All @@ -129,9 +129,9 @@ def assert_zero(val):
assert_infinite(2.0**info.maxexp)

assert_representable(info.smallest_subnormal)
if info.min < 0:
if info.min < 0.0:
assert_zero(info.smallest_subnormal * 0.5)
self.assertGreater(info.smallest_normal, 0)
self.assertGreater(info.smallest_normal, 0.0)
self.assertEqual(info.tiny, info.smallest_normal)

# Identities according to the documentation:
Expand Down

0 comments on commit ea9f88c

Please sign in to comment.