aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Doc/library/math.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/math.rst')
-rw-r--r--Doc/library/math.rst39
1 files changed, 34 insertions, 5 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 0749367045d..bf7a00549fc 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -10,8 +10,8 @@
--------------
-This module provides access to the mathematical functions defined by the C
-standard.
+This module provides access to common mathematical functions and constants,
+including those defined by the C standard.
These functions cannot be used with complex numbers; use the functions of the
same name from the :mod:`cmath` module if you require support for complex
@@ -53,10 +53,13 @@ noted otherwise, all return values are floats.
:func:`frexp(x) <frexp>` Mantissa and exponent of *x*
:func:`isclose(a, b, rel_tol, abs_tol) <isclose>` Check if the values *a* and *b* are close to each other
:func:`isfinite(x) <isfinite>` Check if *x* is neither an infinity nor a NaN
+:func:`isnormal(x) <isnormal>` Check if *x* is a normal number
+:func:`issubnormal(x) <issubnormal>` Check if *x* is a subnormal number
:func:`isinf(x) <isinf>` Check if *x* is a positive or negative infinity
:func:`isnan(x) <isnan>` Check if *x* is a NaN (not a number)
:func:`ldexp(x, i) <ldexp>` ``x * (2**i)``, inverse of function :func:`frexp`
:func:`nextafter(x, y, steps) <nextafter>` Floating-point value *steps* steps after *x* towards *y*
+:func:`signbit(x) <signbit>` Check if *x* is a negative number
:func:`ulp(x) <ulp>` Value of the least significant bit of *x*
**Power, exponential and logarithmic functions**
@@ -144,8 +147,7 @@ Number-theoretic functions
.. function:: factorial(n)
- Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not integral or
- is negative.
+ Return factorial of the nonnegative integer *n*.
.. versionchanged:: 3.10
Floats with integral values (like ``5.0``) are no longer accepted.
@@ -374,6 +376,24 @@ Floating point manipulation functions
.. versionadded:: 3.2
+.. function:: isnormal(x)
+
+ Return ``True`` if *x* is a normal number, that is a finite
+ nonzero number that is not a subnormal (see :func:`issubnormal`).
+ Return ``False`` otherwise.
+
+ .. versionadded:: next
+
+
+.. function:: issubnormal(x)
+
+ Return ``True`` if *x* is a subnormal number, that is a finite
+ nonzero number with a magnitude smaller than :data:`sys.float_info.min`.
+ Return ``False`` otherwise.
+
+ .. versionadded:: next
+
+
.. function:: isinf(x)
Return ``True`` if *x* is a positive or negative infinity, and
@@ -412,6 +432,15 @@ Floating point manipulation functions
Added the *steps* argument.
+.. function:: signbit(x)
+
+ Return ``True`` if the sign of *x* is negative and ``False`` otherwise.
+
+ This is useful to detect the sign bit of zeroes, infinities and NaNs.
+
+ .. versionadded:: next
+
+
.. function:: ulp(x)
Return the value of the least significant bit of the float *x*:
@@ -775,7 +804,7 @@ Constants
The mathematical constant *τ* = 6.283185..., to available precision.
Tau is a circle constant equal to 2\ *π*, the ratio of a circle's circumference to
its radius. To learn more about Tau, check out Vi Hart's video `Pi is (still)
- Wrong <https://www.youtube.com/watch?v=jG7vhMMXagQ>`_, and start celebrating
+ Wrong <https://vimeo.com/147792667>`_, and start celebrating
`Tau day <https://tauday.com/>`_ by eating twice as much pie!
.. versionadded:: 3.6