array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.bcdiv.php', 1 => 'bcdiv', ), 'up' => array ( 0 => 'ref.bc.php', 1 => 'BC 数学 函数', ), 'prev' => array ( 0 => 'function.bccomp.php', 1 => 'bccomp', ), 'next' => array ( 0 => 'function.bcmod.php', 1 => 'bcmod', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/bc/functions/bcdiv.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
bcdiv — 两个任意精度的数字除法计算
num1
被除数,字符串类型。
num2
除数,字符串类型。
scale
此可选参数用于设置结果中小数点后的小数位数。也可通过使用
bcscale() 来设置全局默认的小数位数,用于所有函数。如果未设置,则默认为 0
。
返回字符串类型的结果。如果 num2
是 0
结果为 null
。
版本 | 说明 |
---|---|
8.0.0 |
现在 scale 可以为 null。
|
示例 #1 bcdiv() 示例
<?php
echo bcdiv('105', '6.55957', 3); // 16.007
?>