double log ( double num );
/*floating-point-type*/
log ( /*floating-point-type*/ num );
float logf( float num );
(2) (since C++11)long double logl( long double num );
(3) (since C++11)constexpr /*deduced-simd-t*/<V>
template< class Integer >
double log ( Integer num );
Computes the
natural (base-e) logarithmof
num.
The library provides overloads ofstd::log
for all cv-unqualified floating-point types as the type of the parameter.(since C++23)
A) Additional overloads are provided for all integer types, which are treated as double.
(since C++11) [edit] Parameters num - floating-point or integer value [edit] Return valueIf no errors occur, the natural (base-e) logarithm of num (ln(num) or loge(num)) is returned.
If a domain error occurs, an implementation-defined value is returned (NaN where supported).
If a pole error occurs, -HUGE_VAL, -HUGE_VALF
, or -HUGE_VALL
is returned.
Errors are reported as specified in math_errhandling.
Domain error occurs if num is less than zero.
Pole error may occur if num is zero.
If the implementation supports IEEE floating-point arithmetic (IEC 60559),
The additional overloads are not required to be provided exactly as (A). They only need to be sufficient to ensure that for their argument num of integer type, std::log(num) has the same effect as std::log(static_cast<double>(num)).
[edit] ExamplePossible output:
log(1) = 0 base-5 logarithm of 125 = 3 log(1) = 0 log(+Inf) = inf log(0) = -inf errno == ERANGE: Numerical result out of range FE_DIVBYZERO raised[edit] See also computes common (base 10) logarithm (\({\small\log_{10}{x}}\)log10(x))
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4