6.11.66 fmaf Function

Returns the value of x * y + z for single-precision floating-point values.

Include

<math.h>

Prototype

float fmaf(float x, float y, float z);

Arguments

x
any single precision floating-point number
y
any single precision floating-point number
z
any single precision floating-point number

Return Value

Returns the value of x * y + z, computed as if in one operation with infinite precision and rounded to the rounding mode indicated by FLT_ROUNDS.

Example

#include <math.h>
#include <stdio.h>

int main(void)
{
  float x, y, z, m;

  x = -5.7;
  y = 2.0;
  z = 1.0;
  m = fma(x, y, z);
  printf("The multiplication of %f and %f summed with %f is %f\n\n", x, y, z, m);
}

Example Output

The multiplication of -5.700000 and 2.000000 summed with 1.000000 is -10.400000