Función PHP hipot()
❮ Referencia matemática de PHP
Ejemplo
Calcula la hipotenusa de diferentes triángulos rectángulos:
<?php
echo hypot(3,4) . "<br>";
echo hypot(4,6) . "<br>";
echo hypot(1,3) . "<br>";
echo sqrt(3*3+4*4);
?>
Definición y uso
La función hypot() calcula la hipotenusa de un triángulo rectángulo.
Consejo: Esta función es equivalente a sqrt(x*x + y*y).
Sintaxis
hypot(x,y);
Valores paramétricos
Parameter | Description |
---|---|
x | Required. Specifies the length of first side |
y | Required. Specifies the length of second side |
Detalles técnicos
Valor devuelto: | La longitud de la hipotenusa |
---|---|
Tipo de devolución: | Flotador |
Versión PHP: | 4.1+ |
❮ Referencia matemática de PHP