bcsqrt
(PHP 4, PHP 5, PHP 7, PHP 8)
bcsqrt — 任意精度數字的二次方根
說明
bcsqrt(string
$num
, ?int $scale
= null
): string
返回 num
的二次方根。
返回值
以 string 型別返回二次方根的結果,如果 num
是負數則返回 null
。
更新日誌
版本 | 說明 |
---|---|
8.0.0 |
現在 scale 可以為 null。
|
範例
示例 #1 bcsqrt() 示例
<?php
echo bcsqrt('2', 3); // 1.414
?>