PHP 常用的 BC 高精度函数

php BC高精确度函数库

功能:相加,相减,比较,相除,求余,相乘,n次方,求平方
1、相加
	bcadd(string $left_operand , string $right_operand [, int $scale ])
	$scale 返回的小数点个数
2、相减
	bcsub ( string $left_operand , string $right_operand [, int $scale ] )
3、比较
	bccomp ( string $left_operand , string $right_operand [, int $scale ] )

	 $left=$right 返回 0

	 $left<$right 返回 -1

	 $left>$right 返回 1

4、相除
	bcdiv ( string $left_operand , string $right_operand [, int $scale ] )
5、求余
	bcmod ( string $left_operand , string $modulus )
6、相乘
	bcmul ( string $left_operand , string $right_operand [, int $scale ] )
7、n次方
	bcpow ( string $left_operand , string $right_operand [, int $scale ] )
8、求平方
	bcsqrt ( string $operand [, int $scale ] )

你可能感兴趣的:(php,php,函数)