10000 gh-123836: check zero signs in math_testcases.txt by skirpichev · Pull Request #123854 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-123836: check zero signs in math_testcases.txt #123854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 17, 2024
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
Prev Previous commit
adress review: correct zero sign for sqrt tests to match math.h conve…
…ntion
  • Loading branch information
skirpichev committed Sep 17, 2024
commit 3a96aee0b16a29514da1bf7dd8bc395d34912222
13 changes: 7 additions & 6 deletions Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -2056,12 +2056,6 @@ 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 All @@ -2076,6 +2070,13 @@ def test_testfile(self):
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

Expand Down
Loading
0