Função PHP hipot()
❮ Referência matemática do PHP
Exemplo
Calcule a hipotenusa de diferentes triângulos retângulos:
<?php
echo hypot(3,4) . "<br>";
echo hypot(4,6) . "<br>";
echo hypot(1,3) . "<br>";
echo sqrt(3*3+4*4);
?>
Definição e uso
A função hypot() calcula a hipotenusa de um triângulo retângulo.
Dica: Esta função é equivalente a sqrt(x*x + y*y).
Sintaxe
hypot(x,y);
Valores de parâmetro
Parameter | Description |
---|---|
x | Required. Specifies the length of first side |
y | Required. Specifies the length of second side |
Detalhes técnicos
Valor de retorno: | O comprimento da hipotenusa |
---|---|
Tipo de retorno: | Flutuador |
Versão do PHP: | 4.1+ |
❮ Referência matemática do PHP