Home

fmaf

fmaf refers to the single-precision fused multiply-add operation in floating-point arithmetic. It computes the expression (x * y) + z with a single rounding, using one IEEE 754-compliant result rather than performing the multiplication and addition as separate steps that produce two roundings.

In the C standard library, fmaf is defined as a function that takes three float arguments and

The main advantages of fmaf are improved numerical accuracy and potential performance benefits. By performing the

Use of fmaf is common in numerical software that prioritizes precision and performance for single-precision arithmetic.

returns
a
float:
float
fmaf(float
x,
float
y,
float
z).
It
provides
the
fused
multiply-add
operation
at
the
single-precision
level,
complementing
the
double-precision
fma
function
for
double
types
and
the
long
double
variant
fmal.
Many
compilers
expose
fmaf
under
the
math
library
and
also
map
it
to
hardware
FMA
instructions
where
available.
multiplication
and
addition
with
one
rounding,
it
minimizes
rounding
errors
that
arise
from
separate
operations,
making
it
especially
useful
in
polynomial
evaluation,
dot
products,
and
other
numerically
sensitive
computations.
Hardware
that
includes
an
FMA
unit
can
execute
fmaf
efficiently,
often
with
better
throughput
than
separate
multiply-then-add
instructions.
Conversely,
on
platforms
without
native
FMA
support,
an
implementation
may
emulate
fmaf,
which
can
involve
additional
overhead
and
may
not
perfectly
match
the
precision
of
true
fused
hardware.
It
is
part
of
the
broader
family
of
fused
multiply-add
operations,
alongside
the
double-precision
and
extended-precision
variants,
which
share
the
same
mathematical
principle
but
operate
on
different
data
types.