# 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"
except OverflowError:
result = 'OverflowError'
+ # 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. Lets correct zero sign of er to follow
+ # first convention.
+ if id in ['sqrt0002', 'sqrt0003', 'sqrt1001', 'sqrt1023']:
+ er = math.copysign(er, ar)
+
# Default tolerances
ulp_tol, abs_tol = 5, 0.0