Computes a multiplication and addition.
#include <math.h> double fma(double x, double y, double z); float fmaf(float x, float y, float z); long double fmal(long double x, long double y, long double z);
x
The first multiplication value.
y
The second multiplication value.
z
The addition value.
These functions compute and return (x * y) + z. These functions may be more accurate than using the compiler's regular multiplication (*) and addition (+) operators.
The functions compute this value to virtually infinite precision and apply rounding once to the result type according to the rounding mode specified by the FLT_ROUNDS.
If the result cannot be properly expressed in the result type, the functions set errno to EDOM and fpclassify(fdim(x, x)) does not return FP_NORMAL.
This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.
#include <math.h> #include <stdio.h> int main(void) { double k = 12; double l = 4; printf("|(%f - %f)| = %f\n", k, l, fma(k,l)); return 0; } Output: | ( 12.000000 - 4.0000000 ) | = 8.0000000