C90 | double log (double x); |
C99 | double log (double x);
float logf (float x ); long double logl (long double x); |
C++98 | double log (double x);
float log (float x ); long double log (long double x); |
C++11 | double log (double x);
float log (float x); long double log (long double x); double log (T x); // additional overloads for integral types |
C99 | 头文件<tgmath.h> 提供了该函数的泛型类型宏版本。 |
C++98 | 这个函数在<complex>和<valarray> 中重载(参见complex log和valarray log)。 |
C++11 | 这个头文件(<cmath>) 为整型提供了额外的重载:这些重载在计算之前将x转换为double
(在T是任何整型时定义)。
这个函数在<complex>和<valarray> 中也重载(参见complex log和valarray log)。 |
C90(C++98) | 如果发生域错误,则将全局变量errno设置为EDOM。 如果发生极点错误,全局变量errno设置为ERANGE。 |
C99(C++11) | 如果出现域错误:
-并且math_errhandling设置了MATH_ERRNO: 全局变量errno设置为EDOM. -并且math_errhandling设置了MATH_ERREXCEPT: 触发 FE_INVALID. 如果出现极点错误: -并且math_errhandling设置了MATH_ERRNO: 全局变量errno设置为 ERANGE. -并且math_errhandling设置了MATH_ERREXCEPT: 触发 FE_DIVBYZERO. |
/* log example */ #include <stdio.h> /* printf */ #include <math.h> /* log */ int main () { double param, result; param = 5.5; result = log (param); printf ("log(%f) = %f\n", param, result ); return 0; } |
frexp | 分解成有效位数和指数 (function ) |
log10 | 计算常用对数(function ) |
exp | 计算指数函数(function ) |
pow | 次幂(function ) |