std::log

来自cppreference.com
 
 
Numerics的图书馆
常见的数学函数
浮点环境
复数
数字阵列
伪随机数生成
编译时合理的算法 (C++11)
通用的数值运算
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iota(C++11)
accumulate
inner_product
adjacent_difference
partial_sum
 
常见的数学函数
功能
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
基本操作
Original:
Basic operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
remainder(C++11)
remquo(C++11)
fma(C++11)
fmax(C++11)
fmin(C++11)
fdim(C++11)
nan
nanf
nanl
(C++11)
(C++11)
(C++11)
指数函数
Original:
Exponential functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
exp
exp2(C++11)
expm1(C++11)
log
log10
log1p(C++11)
log2(C++11)
电源的功能
Original:
Power functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sqrt
cbrt(C++11)
hypot(C++11)
pow
三角函数和双曲功能
Original:
Trigonometric and hyperbolic functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sinh
cosh
tanh
asinh(C++11)
acosh(C++11)
atanh(C++11)
错误和伽玛功能
Original:
Error and gamma functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
erf(C++11)
erfc(C++11)
lgamma(C++11)
tgamma(C++11)
最接近的整数,浮点运算
Original:
Nearest integer floating point operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ceil
floor
round
lround
llround
(C++11)
(C++11)
(C++11)
trunc(C++11)
nearbyint(C++11)
rint
lrint
llrint
(C++11)
(C++11)
(C++11)
浮点操作功能
Original:
Floating point manipulation functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ldexp
scalbn
scalbln
(C++11)
(C++11)
ilogb(C++11)
logb(C++11)
frexp
modf
nextafter
nexttoward
(C++11)
(C++11)
copysign(C++11)
分类/比较
Original:
Classification/Comparison
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
fpclassify(C++11)
isfinite(C++11)
isinf(C++11)
isnan(C++11)
isnormal(C++11)
signbit(C++11)
isgreater(C++11)
isgreaterequal(C++11)
isless(C++11)
islessequal(C++11)
islessgreater(C++11)
isunordered(C++11)
宏常量
Original:
Macro constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
HUGE_VALF
HUGE_VAL
HUGE_VALL
(C++11)

(C++11)
INFINITY(C++11)
NAN(C++11)
math_errhandling
MATH_ERRNO
MATH_ERREXCEPT
(C++11)
FP_NORMAL
FP_SUBNORMAL
FP_ZERO
FP_INFINITE
FP_NAN
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
 
Defined in header <cmath>
float       log( float arg );
double      log( double arg );
long double log( long double arg );
double      log( Integral arg );
(因为C + +11)

Computes the natural (base e) logarithm of arg.

目录

[编辑] 参数

arg -
浮点值
Original:
floating point value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 返回值

natural logarithm of arg.

域时会出现错误arg为负。 NAN是在这种情况下,返回.
Original:
Domain error occurs if arg is negative. NAN is returned in that case.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
如果arg0范围发生错误。 -HUGE_VAL是在这种情况下,返回.
Original:
Range error occurs if arg is 0. -HUGE_VAL is returned in that case.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 为例

The following code computes the binary (base 2) logarithm with help of natural logarithm.

#include <cmath>
#include <iostream>
 
int main()
{
    double base = 2.0;
    double arg  = 256.0;
    double result = std::log(arg) / std::log(base);
 
    std::cout << result << '\n';
}

Output:

8

[编辑] 另请参阅

返回“E”提出的功率(ex
Original:
returns e raised to the given power (ex)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(功能) [edit]
常见的计算(基地“10”)对数(log10(x)
Original:
computes common (base 10) logarithm (log10(x))
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(功能) [edit]
引起了一些给定的功率(xy
Original:
raises a number to the given power (xy)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(功能) [edit]
沿负实轴的割线复杂的自然对数
Original:
complex natural logarithm with the branch cuts along the negative real axis
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数模板) [edit]
std::logvalarray的每个元素的功能
Original:
applies the function std::log to each element of valarray
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(函数模板) [edit]