On this page
math.fma
Prev: math.floor | Up: math | Next: math.fmod
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.fma
Tags: #public #python3 #stdlib #math
Import
import math
from math import fma
Signature & Overview
math.fma(x, y, z, /)
Fused multiply-add operation.
Usage
import math
# Single-rounding fused multiply-add: (x * y) + z
assert math.fma(2.0, 3.0, 4.0) == 10.0
Gotchas
- Requires Python 3.13+: Performs
(x * y) + zwith only one final IEEE 754 rounding step, avoiding intermediate overflow or cancellation.
REPL Inspect
from math import fma
help(fma)
Linked from
Related notes
- tuts/python3/stdlib_module/math/floor Linked here; links to this page; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/fmod Linked here; links to this page; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/math/acos Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/acosh Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/asin Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/asinh Linked here; shared tags: #math, #stdlib
- tuts/c/stdlib/math shared tags: #math, #stdlib
- tuts/c/stdlib/math/fabs shared tags: #math, #stdlib
- tuts/c/stdlib/math/floor shared tags: #math, #stdlib