std::log
Da cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Definido no cabeçalho <cmath>
|
||
float log( float arg ); |
||
double log( double arg ); |
||
long double log( long double arg ); |
||
double log( Integral arg ); |
(desde C++11) | |
Computes the natural (base e) logarithm of arg
.
Índice |
[editar] Parâmetros
arg | - | flutuando valor de ponto
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. |
[editar] Valor de retorno
natural logarithm of arg
.
Erro de domínio ocorre se
arg
é negativo. NAN é devolvido em caso.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.
You can help to correct and verify the translation. Click here for instructions.
Faixa de erro ocorre se
arg
é 0. -HUGE_VAL é devolvido em caso. Original:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Exemplo
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'; }
Saída:
8
[editar] Veja também
retorna e elevado à potência dada (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. (função) | |
calcula comum (base 10) logaritmo (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. (função) | |
levanta uma série para o poder dado (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. (função) | |
logaritmo natural complexo com os cortes ao longo do ramo negativo do eixo real 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. (modelo de função) | |
aplica-se a std::log função de cada elemento de valarray 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. (modelo de função) |