1、两个高精度数比较
*工作中遇到一种情况,0.00 != 0
*int bccomp ( string $left_operand , string $right_operand [, int $scale ] )
*$left=$right 返回 0
*$left<$right 返回 -1
*$left>$right 返回 1
*$scale 小数点位数
2、两个高精度数相加
*string bcadd ( string $left_operand , string $right_operand [, int $scale ] )
*$scale 返回的小数点个数
3、两个高精度数相减
*sstring bcsub ( string $left_operand , string $right_operand [, int $scale ] )
*$scale 返回的小数点个数
4、两个高精度数求余/取模 (10/3=3余1,这个函数返回1)
*string bcmod ( string $left_operand , string $modulus )
5、两个高精度数相除
*string bcdiv ( string $left_operand , string $right_operand [, int $scale ] )
*$scale小数点位数默认为 0
6、两个高精度数相乘
*string bcmul ( string $left_operand , string $right_operand [, int $scale ] )
*$scale小数点位数默认为 0
7、两个高精度数的次方值( 2³=8=bcpow(2,3) )
*string bcpow ( string $left_operand , string $right_operand [, int $scale ] )
*$scale小数点位数默认为 0
8、求高精度数的平方根( √9=3=bcsqrt(9,2) )
*string bcsqrt ( string $operand [, int $scale ] )
*$scale小数点位数默认为 0
9、设置bc函数的小数点位数
*bool bcscale ( int $scale )
*$scale小数点位数默认为 0
注意:一般在计算前设置好精度,后面的计算就不需要设置小数位数了;设置之后,再进行设置,无法覆盖;