Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def result_check(expected, got, ulp_tol=5, abs_tol=0.0):

# Check exactly equal (applies also to strings representing exceptions)
if got == expected:
if not got and not expected:
if math.copysign(1, got) != math.copysign(1, expected):
return f"expected {expected}, got {got} (zero has wrong sign)"
return None

failure = "not equal"
Expand Down Expand Up @@ -2053,6 +2056,12 @@ def test_testfile(self):
if id in SKIP_ON_TIGER:
continue

# Skip some sqrt tests. C99+ says for math.h's sqrt: If the
# argument is +∞ or ±0, it is returned, unmodified. On another
# hand, for csqrt: If z is ±0+0i, the result is +0+0i.
if id in ['sqrt0002', 'sqrt0003', 'sqrt1001', 'sqrt1023']:
continue

func = getattr(math, fn)

if 'invalid' in flags or 'divide-by-zero' in flags:
Expand Down
Loading