Skip to content

Correct frexp() docs for zero and non-finite numbers#149753

Merged
serhiy-storchaka merged 5 commits into
python:mainfrom
skirpichev:fix-frexp-docs
May 31, 2026
Merged

Correct frexp() docs for zero and non-finite numbers#149753
serhiy-storchaka merged 5 commits into
python:mainfrom
skirpichev:fix-frexp-docs

Conversation

@skirpichev
Copy link
Copy Markdown
Member

The current version claims, that mantissa in such cases satisfies 0.5 <= abs(m) < 1. That's wrong:

>>> from math import frexp, inf, nan
>>> frexp(inf)
(inf, 0)
>>> frexp(-inf)
(-inf, 0)
>>> frexp(nan)
(nan, 0)

The current version claims, that mantissa in such
cases satisfies 0.5 <= abs(m) < 1.  That's wrong:

```pycon
>>> from math import frexp, inf, nan
>>> frexp(inf)
(inf, 0)
>>> frexp(-inf)
(-inf, 0)
>>> frexp(nan)
(nan, 0)
```
@skirpichev skirpichev added skip issue skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels May 13, 2026
@skirpichev
Copy link
Copy Markdown
Member Author

CC @StanFromIreland per experts index.

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 13, 2026

@StanFromIreland
Copy link
Copy Markdown
Member

CC @StanFromIreland per experts index.

Hi Sergey, sorry but I'm not a math expert :-( The "documentation" is generally referring to it the infra.

Comment thread Doc/library/math.rst Outdated
@skirpichev
Copy link
Copy Markdown
Member Author

CC @serhiy-storchaka

Comment thread Doc/library/math.rst Outdated
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) May 31, 2026 07:08
@serhiy-storchaka serhiy-storchaka changed the title Correct frexp() docs for non-finite numbers Correct frexp() docs for zero and non-finite numbers May 31, 2026
@serhiy-storchaka serhiy-storchaka merged commit 5b5ffce into python:main May 31, 2026
59 checks passed
@miss-islington-app
Copy link
Copy Markdown

Thanks @skirpichev for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app
Copy link
Copy Markdown

Sorry, @skirpichev and @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 5b5ffce05c211a5b0b74cd95eeb4c463614ee136 3.14

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 31, 2026

GH-150652 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 31, 2026
@miss-islington-app
Copy link
Copy Markdown

Sorry, @skirpichev and @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 5b5ffce05c211a5b0b74cd95eeb4c463614ee136 3.13

@skirpichev skirpichev self-assigned this May 31, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 31, 2026

GH-150653 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 31, 2026
@skirpichev skirpichev deleted the fix-frexp-docs branch May 31, 2026 07:37
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 31, 2026

GH-150654 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label May 31, 2026
@skirpichev skirpichev removed their assignment May 31, 2026
serhiy-storchaka pushed a commit that referenced this pull request May 31, 2026
… (GH-150654)

0.5 <= abs(m) < 1 is only true for finite nonzero numbers
(cherry picked from commit 5b5ffce)
serhiy-storchaka pushed a commit that referenced this pull request May 31, 2026
… (GH-150653)

0.5 <= abs(m) < 1 is only true for finite nonzero numbers
(cherry picked from commit 5b5ffce)
serhiy-storchaka pushed a commit that referenced this pull request May 31, 2026
… (GH-150652)

0.5 <= abs(m) < 1 is only true for finite nonzero numbers
(cherry picked from commit 5b5ffce)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants