diff options
| author | Mark Dickinson <dickinsm@gmail.com> | 2017-01-21 12:35:30 +0000 |
|---|---|---|
| committer | Mark Dickinson <dickinsm@gmail.com> | 2017-01-21 12:35:30 +0000 |
| commit | d1b230e48b81eb90d10f0ceb4e34c547800bd3a8 (patch) | |
| tree | bb7cfe1f084957c978a105111f7345dddecd695d /Doc/library | |
| parent | 502efda10c6ec54ba9f0d490264b785971b2b6cc (diff) | |
| download | cpython-git-d1b230e48b81eb90d10f0ceb4e34c547800bd3a8.tar.gz | |
Issue #29282: add fused multiply-add function, math.fma.
Diffstat (limited to 'Doc/library')
| -rw-r--r-- | Doc/library/math.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst index da2b8cc586..42bbb02d92 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -57,6 +57,21 @@ Number-theoretic and representation functions If *x* is not a float, delegates to ``x.__floor__()``, which should return an :class:`~numbers.Integral` value. +.. function:: fma(x, y, z) + + Fused multiply-add operation. Return ``(x * y) + z``, computed as though with + infinite precision and range followed by a single round to the ``float`` + format. This operation often provides better accuracy than the direct + expression ``(x * y) + z``. + + This function follows the specification of the fusedMultiplyAdd operation + described in the IEEE 754-2008 standard. The standard leaves one case + implementation-defined, namely the result of ``fma(0, inf, nan)`` + and ``fma(inf, 0, nan)``. In these cases, ``math.fma`` returns a NaN, + and does not raise any exception. + + .. versionadded:: 3.7 + .. function:: fmod(x, y) |
