log
来自cppreference.com
< cpp | numeric/math
语法:
#include <cmath> double log( double num );
函数 log() 返回num的自然对数(e为底)。如果num是负数发生域错误,如果是零发生范围(range)错误。 为了计算x的以任意数b为底的对数,可以使用:
double answer = log(x) / log(b);
C++ 也提供了下面的重载形式:
#include <cmath> float log( float num ); // same as logf() in C99 long double log( long double num ); // same as logl() in C99