C99 | double fmax (double x , double y);
float fmaxf (float x , float y); long double fmaxl (long double x, long double y); |
C++11 | double fmax (double x , double y);
float fmax (float x , float y); long double fmax (long double x, long double y); double fmax (Type1 x , Type2 y); // additional overloads |
C99 | 头文件<tgmath.h> 提供了该函数的类型泛型宏版本。 |
C++11 | 这个头文件(<cmath>) 为其他算术类型组合(Type1和Type2)提供了额外的重载:
这些重载在计算前有效地将其实参转换为double,
除非至少有一个实参是long double类型(在这种情况下,
两个实参都被转换为long double类型)。
|
/* fmax example */ #include <stdio.h> /* printf */ #include <math.h> /* fmax */ int main () { printf ("fmax (100.0, 1.0) = %f\n", fmax(100.0,1.0)); printf ("fmax (-100.0, 1.0) = %f\n", fmax(-100.0,1.0)); printf ("fmax (-100.0, -1.0) = %f\n", fmax(-100.0,-1.0)); return 0; } |
fdim | 正差(function ) |
fmin | 最小值(function ) |