PHP hypot()関数
例
さまざまな直角三角形の斜辺を計算します。
<?php
echo hypot(3,4) . "<br>";
echo hypot(4,6) . "<br>";
echo hypot(1,3) . "<br>";
echo sqrt(3*3+4*4);
?>
定義と使用法
hypot()関数は、直角三角形の斜辺を計算します。
ヒント:この関数はsqrt(x * x + y * y)と同等です。
構文
hypot(x,y);
パラメータ値
Parameter | Description |
---|---|
x | Required. Specifies the length of first side |
y | Required. Specifies the length of second side |
技術的な詳細
戻り値: | 斜辺の長さ |
---|---|
返品タイプ: | 浮く |
PHPバージョン: | 4.1+ |
❮PHP数学リファレンス