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
注意:一般在計算前設置好精度,後面的計算就不需要設置小數位數了;設置之後,再進行設置,無法覆蓋;