Scroll to navigation

HYPOT(3) Manual do Programador do Linux HYPOT(3)

NOME

hypot, hypotf, hypotl - função de distância euclidiana

SINOPSE

#include <math.h>
double hypot(double x, double y);
float hypotf(float x, float y);
long double hypotl(long double x, long double y);

Vincule com -lm.

Requisitos de macro de teste de recursos para o glibc (consulte feature_test_macros(7)):

hypot():

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| _XOPEN_SOURCE
|| /* Desde o glibc 2.19: */ _DEFAULT_SOURCE
|| /* Glibc versões <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

hypotf(), hypotl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Desde o glibc 2.19: */ _DEFAULT_SOURCE
|| /* Glibc versões <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

DESCRIÇÃO

These functions return sqrt(x*x+y*y). 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.

The calculation is performed without undue overflow or underflow during the intermediate steps of the calculation.

VALOR DE RETORNO

On success, these functions return the length of the hypotenuse of a right-angled triangle with sides of length x and y.

If x or y is an infinity, positive infinity is returned.

If x or y is a NaN, and the other argument is not an infinity, a NaN is returned.

Se o resultado é excedido, ocorrerá um erro de intervalo e as funções retornam HUGE_VAL, HUGE_VALF ou HUGE_VALL, respectivamente.

If both arguments are subnormal, and the result is subnormal, a range error occurs, and the correct result is returned.

ERROS

Consulte math_error(7) para obter informações sobre como determinar se ocorreu um erro ao chamar essas funções.

Os seguintes erros podem ocorrer:

errno é definido com ERANGE. Uma exceção de ponto flutuante de estouro (FE_OVERFLOW) é levantada.
An underflow floating-point exception (FE_UNDERFLOW) is raised.
These functions do not set errno for this case.

ATRIBUTOS

Para uma explicação dos termos usados nesta seção, consulte attributes(7).

Interface Atributo Valor
hypot(), hypotf(), hypotl() Thread safety MT-Safe

DE ACORDO COM

C99, POSIX.1-2001, POSIX.1-2008.

A variante retornando double também está em conformidade com SVr4, 4.3BSD.

VEJA TAMBÉM

cabs(3), sqrt(3)

COLOFÃO

Esta página faz parte da versão 5.10 do projeto Linux man-pages. Uma descrição do projeto, informações sobre relatórios de bugs e a versão mais recente desta página podem ser encontradas em https://www.kernel.org/doc/man-pages/.

TRADUÇÃO

A tradução para português brasileiro desta página man foi criada por Marcelo M. de Abreu <mmabreu@terra.com.br> e André Luiz Fassone <lonely_wolf@ig.com.br>

Esta tradução é uma documentação livre; leia a Licença Pública Geral GNU Versão 3 ou posterior para as condições de direitos autorais. Nenhuma responsabilidade é aceita.

Se você encontrar algum erro na tradução desta página de manual, envie um e-mail para a lista de discussão de tradutores.

15 setembro 2017