Skip to content

gh-135308: clarify math.issubnormal() description #135324

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skirpichev
Copy link
Contributor

@skirpichev skirpichev commented Jun 10, 2025

@skirpichev
Copy link
Contributor Author

Small related problem.

If you follow to sys.float_info.min - you find yourself in the middle of the float_info.min description:
Screenshot from 2025-06-10 06-13-34

@skirpichev
Copy link
Contributor Author

CC @StanFromIreland

@@ -387,8 +387,8 @@ Floating point manipulation functions
.. function:: issubnormal(x)

Return ``True`` if *x* is a subnormal number, that is a finite
nonzero number with a magnitude smaller than the smallest positive normal
number, see :data:`sys.float_info.min`. Return ``False`` otherwise.
nonzero number with a magnitude smaller than :data:`sys.float_info.min`.
Copy link
Member

Choose a reason for hiding this comment

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

The magnitude is an integer, it'll be smaller than sys.float_info.min if x is smaller than 1.

Suggested change
nonzero number with a magnitude smaller than :data:`sys.float_info.min`.
nonzero number smaller than :data:`sys.float_info.min`.

Copy link
Member

Choose a reason for hiding this comment

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

I guess the original meant “smaller than the magnitude of the smallest positive normal number”, but that's just extra words.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be incorrect, as any finite negative floating-point number will satisfy your definition.

The magnitude is an integer

No. It's about absolute value of the float. See e.g. copysign() docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants