C99 | double nextafter (double x , double y);
float nextafterf (float x , float y); long double nextafterl (long double x, long double y); |
C++11 | double nextafter (double x , double y);
float nextafter (float x , float y); long double nextafter (long double x, long double y); double nextafter (Type1 x , Type2 y); // additional overloads |
C99 | 头文件<tgmath.h> 提供了该函数的类型泛型宏版本。 |
C++11 | 这个头文件(<cmath>) 为其他算术类型组合(Type1和Type2)提供了额外的重载:
这些重载在计算前将其实参转换为double,除非至少有一个实参是
long double类型(在这种情况下,两个实参都被转换为long double类型)。
|
/* nextafter example */ #include <stdio.h> /* printf */ #include <math.h> /* nextafter */ int main () { printf ("first representable value greater than zero: %e\n", nextafter(0.0,1.0)); printf ("first representable value less than zero: %e\n", nextafter(0.0,-1.0)); return 0; } |
nexttoward | 下一个可表示趋向精确值(function ) |