(PHP 4, PHP 5, PHP 7, PHP 8)
bcsqrt — 任意精度数字的二次方根
$num, ?int $scale = null): string
返回 num 的二次方根。
以 string 类型返回二次方根的结果,如果 num 是负数则返回 null。
| 版本 | 说明 |
|---|---|
| 8.0.0 |
现在 scale 可以为 null。
|
示例 #1 bcsqrt() 示例
<?php
echo bcsqrt('2', 3); // 1.414
?>