Math Functions

math.fma()

Compute a product plus an addend with one final floating-point rounding instead of rounding the product first. Added in 3.13.

Formal Syntax & Structure

python syntaxpython
math.fma(x, y, z, /)

Parameters & Attributes

NameTypeDescription
xreal numberInput real value.
yreal numberSecond real value.
zreal numberAddend in the fused operation.

Return Value

float

Floating-point result; finite precision and domain restrictions apply.

Working Example

Example Snippetpython
import mathprint(math.fma(2.5, 4, -3))
Python Reference