fma Function

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

Include

<math.h>

Prototype

double fma(double x, double y, double z);

Arguments

x
any double precision floating-point number
y
any double precision floating-point number
z
any double 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)
{
  double 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