Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-44339: Fix math.pow corner case to comply with IEEE 754 #26606

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 9 commits into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
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
Next Next commit
Update tests to expected new behaviour
  • Loading branch information
mdickinson committed Jun 8, 2021
commit fd31ffb92108d94f2fde5abbaa88ce766eaf041c
7 changes: 2 additions & 5 deletions 7 Lib/test/ieee754.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,15 @@ infinity and NaN.
1.0

The power of 0 raised to x is defined as 0, if x is positive. Negative
values are a domain error or zero division error and NaN result in a
finite values are a domain error or zero division error and NaN result in a
silent NaN.

>>> pow(0, 0)
1.0
>>> pow(0, INF)
0.0
>>> pow(0, -INF)
Traceback (most recent call last):
...
ValueError: math domain error
inf
>>> 0 ** -1
Traceback (most recent call last):
...
Expand Down Expand Up @@ -182,4 +180,3 @@ ValueError: math domain error

Hyberbolic Functions
====================

mdickinson marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions 4 Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ def testPow(self):
self.assertRaises(ValueError, math.pow, 0., -2.)
self.assertRaises(ValueError, math.pow, 0., -2.3)
self.assertRaises(ValueError, math.pow, 0., -3.)
self.assertRaises(ValueError, math.pow, 0., NINF)
self.assertEqual(math.pow(0., NINF), INF)
corona10 marked this conversation as resolved.
Show resolved Hide resolved
self.assertTrue(math.isnan(math.pow(0., NAN)))

# pow(INF, x)
Expand All @@ -1240,7 +1240,7 @@ def testPow(self):
self.assertRaises(ValueError, math.pow, -0., -2.)
self.assertRaises(ValueError, math.pow, -0., -2.3)
self.assertRaises(ValueError, math.pow, -0., -3.)
self.assertRaises(ValueError, math.pow, -0., NINF)
self.assertEqual(math.pow(-0., NINF), INF)
self.assertTrue(math.isnan(math.pow(-0., NAN)))

# pow(NINF, x)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.