C90 | double ldexp (double x, int exp); |
C99 | double ldexp (double x , int exp);
float ldexpf (float x , int exp); long double ldexpl (long double x, int exp); |
C++98 | double ldexp (double x, int exp);
float ldexp (float x , int exp); long double ldexp (long double x, int exp); |
C++11 | double ldexp (double x, int exp);
float ldexp (float x, int exp); long double ldexp (long double x, int exp); double ldexp (T x, int exp); // additional overloads for integral types |
C99 | 头文件<tgmath.h> 提供了该函数的泛型类型宏版本。 |
C++11 | 这个头文件(<cmath>) 为整型提供了额外的重载:这些重载在计算之前将x转换为double. (在T是任何整型时定义)。 |
C90(C++98) | 如果发生范围溢出错误,全局变量errno将被设置为ERANGE。 |
C99(C++11) | 如果出现范围溢出错误:
-并且math_errhandling设置了MATH_ERRNO: 全局变量errno设置为ERANGE. -并且math_errhandling设置了MATH_ERREXCEPT: 触发FE_OVERFLOW. |
/* ldexp example */ #include <stdio.h> /* printf */ #include <math.h> /* ldexp */ int main () { double param, result; int n; param = 0.95; n = 4; result = ldexp (param , n); printf ("%f * 2^%d = %f\n", param, n, result); return 0; } |
frexp | 获取有效位数和指数(function ) |
log | 计算自然对数(function ) |
pow | 次幂(function ) |