sqrt

(PHP 4, PHP 5, PHP 7, PHP 8)

sqrt平方根

説明

sqrt(float $num): float

num の平方根を返します。

パラメータ

num

処理する引数。

戻り値

num の平方根を返します。 負の数を指定した場合は、特別な値 NAN を返します。

例1 sqrt() の例

<?php
// 小数点以下の精度は、precision ディレクティブの設定に依存します
echo sqrt(9); // 3
echo sqrt(10); // 3.16227766 ...
?>

参考

add a note add a note

User Contributed Notes 1 note

up
-10
jouhni at web dot de
19 years ago
To get any root of a number your can use the pow() function:

pow(8, 1/3)

which gives you the third root of eight.

Jouhni
To Top