Returns the fused multiply add of the three arguments; that is,
returns the exact product of the first two arguments summed
with the third argument and then rounded once to the nearest
double
.
The rounding is done using the round to nearest even.
In contrast, if a * b + c
is evaluated as a regular
floating-point expression, two rounding errors are involved,
the first for the multiply operation, the second for the
addition operation.
Special cases:
Note that fusedMac(a, 1.0, c)
returns the same
result as ( a + c
). However,
fusedMac(a, b, +0.0)
does not always return the
same result as ( a * b
) since
fusedMac(-0.0, +0.0, +0.0)
is +0.0
while
( -0.0 * +0.0
) is -0.0
; fusedMac(a, b, -0.0)
is
equivalent to ( a * b
) however.
a | a value | |
b | a value | |
c | a value |
double
value
@apiNote This method corresponds to the fusedMultiplyAdd
operation defined in IEEE 754-2008.
Diagram: Math