| C99 | double nexttoward (double x , double y);
float nexttowardf (float x , float y); long double nexttowardl (long double x, long double y); |
| C++11 | double nexttoward (double x , double y);
float nexttoward (float x , float y); long double nexttoward (long double x, long double y); double nexttoward (Type1 x , Type2 y); // additional overloads |
| C99 | 头文件<tgmath.h> 提供了该函数的类型泛型宏版本。 |
| C++11 | 这个头文件(<cmath>) 为整型提供了额外的重载:这些重载有效地在计算之前将x转换为double
(在T是任何整型时定义)
|
/* nexttoward example */
#include <stdio.h> /* printf */
#include <math.h> /* nexttoward */
int main ()
{
printf ("first representable value greater than zero: %e\n", nexttoward(0.0,1.0L));
printf ("first representable value less than zero: %e\n", nexttoward(0.0,-1.0L));
return 0;
}
|
| nextafter | 下一个可表示值(function ) |