diff options
Diffstat (limited to 'Doc/library/math.rst')
-rw-r--r-- | Doc/library/math.rst | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 7ea4aac..dc8c74a 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -26,8 +26,17 @@ Number-theoretic and representation functions: .. function:: ceil(x) - Return the ceiling of *x* as a float, the smallest integer value greater than or - equal to *x*. + Return the ceiling of *x* as a float, the smallest integer value greater than + or equal to *x*. If *x* is not a float, delegates to ``x.__ceil__()``, which + should return an :class:`Integral` value. + + +.. function:: copysign(x, y) + + Return *x* with the sign of *y*. ``copysign`` copies the sign bit of an IEEE + 754 float, ``copysign(1, -0.0)`` returns *-1.0*. + + ..versionadded:: 2.6 .. function:: fabs(x) @@ -37,8 +46,9 @@ Number-theoretic and representation functions: .. function:: floor(x) - Return the floor of *x* as a float, the largest integer value less than or equal - to *x*. + Return the floor of *x* as a float, the largest integer value less than or + equal to *x*. If *x* is not a float, delegates to ``x.__floor__()``, which + should return an :class:`Integral` value. .. function:: fmod(x, y) @@ -64,6 +74,23 @@ Number-theoretic and representation functions: apart" the internal representation of a float in a portable way. +.. function:: isinf(x) + + Checks if the float *x* is positive or negative infinite. + + ..versionadded:: 2.6 + + +.. function:: isnan(x) + + Checks if the float *x* is a NaN (not a number). NaNs are part of the + IEEE 754 standards. Operation like but not limited to ``inf * 0``, + ``inf / inf`` or any operation involving a NaN, e.g. ``nan * 1``, return + a NaN. + + ..versionadded:: 2.6 + + .. function:: ldexp(x, i) Return ``x * (2**i)``. This is essentially the inverse of function |