Copyright (C) 2000-2012 |
GNU Info (libc.info)Misc FP ArithmeticMiscellaneous FP arithmetic functions ------------------------------------- The functions in this section perform miscellaneous but common operations that are awkward to express with C operators. On some processors these functions can use special machine instructions to perform these operations faster than the equivalent C code. - Function: double fmin (double X, double Y) - Function: float fminf (float X, float Y) - Function: long double fminl (long double X, long double Y) The `fmin' function returns the lesser of the two values X and Y. It is similar to the expression ((x) < (y) ? (x) : (y)) except that X and Y are only evaluated once. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned. - Function: double fmax (double X, double Y) - Function: float fmaxf (float X, float Y) - Function: long double fmaxl (long double X, long double Y) The `fmax' function returns the greater of the two values X and Y. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned. - Function: double fdim (double X, double Y) - Function: float fdimf (float X, float Y) - Function: long double fdiml (long double X, long double Y) The `fdim' function returns the positive difference between X and Y. The positive difference is X - Y if X is greater than Y, and 0 otherwise. If X, Y, or both are NaN, NaN is returned. - Function: double fma (double X, double Y, double Z) - Function: float fmaf (float X, float Y, float Z) - Function: long double fmal (long double X, long double Y, long double Z) The `fma' function performs floating-point multiply-add. This is the operation (X * Y) + Z, but the intermediate result is not rounded to the destination type. This can sometimes improve the precision of a calculation. This function was introduced because some processors have a special instruction to perform multiply-add. The C compiler cannot use it directly, because the expression `x*y + z' is defined to round the intermediate result. `fma' lets you choose when you want to round only once. On processors which do not implement multiply-add in hardware, `fma' can be very slow since it must avoid intermediate rounding. `math.h' defines the symbols `FP_FAST_FMA', `FP_FAST_FMAF', and `FP_FAST_FMAL' when the corresponding version of `fma' is no slower than the expression `x*y + z'. In the GNU C library, this always means the operation is implemented in hardware. automatically generated by info2www version 1.2.2.9 |