Espaços nominais
Variantes
Acções

std::hypot

Da cppreference.com
< cpp‎ | numeric‎ | math

 
 
Biblioteca numéricos
Funções matemáticas comuns
De ponto flutuante ambiente
Números complexos
Matrizes numéricas
Pseudo-aleatório de geração de números
Tempo de compilação aritmética racional (C++11)
Genéricos operações numéricas
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.
(C++11)
 
Funções matemáticas comuns
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Operações básicas
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.
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Funções exponenciais
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.
(C++11)
(C++11)
(C++11)
(C++11)
Funções de poder
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.
(C++11)
hypot
(C++11)
Funções trigonométricas e hiperbólicas
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.
(C++11)
(C++11)
(C++11)
Erro e funções gamma
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.
(C++11)
(C++11)
(C++11)
(C++11)
Número inteiro mais próximo de operações de ponto flutuante
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.
(C++11)(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Flutuando funções de manipulação de pontos
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.
(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)
(C++11)
Classificação / Comparação
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.
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Constantes de macros
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.
(C++11)(C++11)(C++11)(C++11)(C++11)
 
Definido no cabeçalho <cmath>
float       hypot( float x, float y );
(1) (desde C++11)
double      hypot( double x, double y );
(2) (desde C++11)
long double hypot( long double x, long double y );
(3) (desde C++11)
Promoted    hypot( Arithmetic x, Arithmetic y );
(4) (desde C++11)
Calcula a raiz quadrada da soma dos quadrados dos x e y, sem excesso indevido ou underflow nas fases intermédias do cálculo. Este é o comprimento da hipotenusa de um triângulo rectângulo com lados de comprimento e x y, ou a distância entre o ponto a partir do (x,y) (0,0) origem, ou a magnitude de um número complexo x+iy
Original:
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation. This is the length of the hypotenuse of a right-angled triangle with sides of length x and y, or the distance of the point (x,y) from the origin (0,0), or the magnitude of a complex number x+iy
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Se algum argumento tem tipo integral, ele é convertido para double. Se qualquer outro argumento é long double, em seguida, o tipo de retorno é long double, caso contrário é double.
Original:
If any argument has integral type, it is cast to double. If any other argument is long double, then the return type is long double, otherwise it is double.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

x -
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.
y -
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

A hipotenusa de um triângulo retângulo, x2
+y2
.
Original:
The hypotenuse of a right-angled triangle, x2
+y2
.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exceções

Se o resultado transborda, um erro pode ocorrer gama e pode ser levantada FE_OVERFLOW.
Original:
If the result overflows, a range error may occur and FE_OVERFLOW may be raised.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se o resultado for subnormal, um erro pode ocorrer underflow e FE_UNDERFLOW pode ser levantada.
Original:
If the result is subnormal, an underflow error may occur and FE_UNDERFLOW may be raised.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Notas

Estratégia de implementação típica é calcular um equivalente de u1+(
v
u
)2
onde u é std::max(x,y) e v é std::min(x,y).
Original:
Typical implementation strategy is to calculate an equivalent of u1+(
v
u
)2
where u is std::max(x,y) and v is std::min(x,y).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

#include <cmath>
#include <utility>
#include <iostream>
 
std::pair<double, double> cartesian_to_polar(double x, double y)
{
    return {std::hypot(x, y), std::atan2(y,x)};
}
 
int main()
{
    std::pair<double, double> polar = cartesian_to_polar(1, 1);
    std::cout << "(1,1) cartesian is (" << polar.first
               << "," << polar.second<< ") polar\n";
}

Saída:

(1,1) cartesian is (1.41421,0.785398) polar

[editar] Veja também

Calcula a raiz quadrada (x)
Original:
computes square root (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) [edit]
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) [edit]
retorna a magnitude de um número complexo
Original:
returns the magnitude of a complex number
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) [edit]