C99 | double remainder (double numer , double denom);
float remainderf (float numer , float denom); long double remainderl (long double numer, long double denom); |
C++11 | double remainder (double numer , double denom);
float remainder (float numer , float denom); long double remainder (long double numer, long double denom); double remainder (Type1 numer , Type2 denom); // additional overloads |
C99 | 头文件<tgmath.h> 提供了该函数的类型泛型宏版本。 |
C++11 | 这个头文件(<cmath>) 为其他算术类型组合(Type1和Type2)提供了额外的重载:
这些重载在计算前将其实参转换为double,除非至少有一个实参是
long double类型(在这种情况下,两个实参都被转换为long double类型)。
|
C90(C++98) | 如果出现域错误,全局变量errno将被设置为 EDOM. |
C99(C++11) | 如果出现域错误:
-并且math_errhandling设置了MATH_ERRNO: 全局变量errno设置为EDOM. -并且math_errhandling设置了MATH_ERREXCEPT: 触发FE_INVALID. |
/* remainder example */ #include <stdio.h> /* printf */ #include <math.h> /* remainder */ int main () { printf ( "remainder of 5.3 / 2 is %f\n", remainder (5.3,2) ); printf ( "remainder of 18.5 / 4.2 is %f\n", remainder (18.5,4.2) ); return 0; } |
fmod | 计算余数(IEC 60559)function ) |
fabs | 计算绝对值(function ) |
round | 就近舍入(function ) |