Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-132908: Add math.isnormal/issubnormal() functions#132935
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
9d145057350b254eb366937b3345e318087a8431f7dc88e9e0503090066e88408f81f5File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add :func:`math.isnormal` and :func:`math.issubnormal` functions. Patch by | ||
| Sergey B Kirpichev. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3118,6 +3118,44 @@ math_isfinite_impl(PyObject *module, double x) | ||
| } | ||
| /*[clinic input] | ||
skirpichev marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| math.isnormal | ||
| x: double | ||
| / | ||
| Return True if x is normal, and False otherwise. | ||
| [clinic start generated code]*/ | ||
| static PyObject * | ||
| math_isnormal_impl(PyObject *module, double x) | ||
| /*[clinic end generated code: output=c7b302b5b89c3541 input=fdaa00c58aa7bc17]*/ | ||
| { | ||
| return PyBool_FromLong(isnormal(x)); | ||
| } | ||
| /*[clinic input] | ||
| math.issubnormal | ||
| x: double | ||
| / | ||
| Return True if x is subnormal, and False otherwise. | ||
| [clinic start generated code]*/ | ||
| static PyObject * | ||
| math_issubnormal_impl(PyObject *module, double x) | ||
| /*[clinic end generated code: output=4e76ac98ddcae761 input=9a20aba7107d0d95]*/ | ||
| { | ||
| #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L | ||
| return PyBool_FromLong(issubnormal(x)); | ||
| #else | ||
| return PyBool_FromLong(isfinite(x) && x && !isnormal(x)); | ||
| #endif | ||
| } | ||
| /*[clinic input] | ||
| math.isnan | ||
| @@ -4145,6 +4183,8 @@ static PyMethodDef math_methods[] ={ | ||
| MATH_HYPOT_METHODDEF | ||
| MATH_ISCLOSE_METHODDEF | ||
| MATH_ISFINITE_METHODDEF | ||
| MATH_ISNORMAL_METHODDEF | ||
| MATH_ISSUBNORMAL_METHODDEF | ||
| MATH_ISINF_METHODDEF | ||
| MATH_ISNAN_METHODDEF | ||
| MATH_ISQRT_METHODDEF | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.