请不要在程序中直接使用等号、大于、加、减、乘、除等操作浮点数,如果需要对浮点数进行以上操作,请使用下面的BC系列函数。以确保准确性及精度。
两个高精度数比较大小
int bccomp ( string $left_operand , string $right_operand [, int $scale ] )
left=right 返回 0
left left>right 返回 1 $scale 需要比较的精度,即小数点后多少位 两个高精度数相加 string bcadd ( string $left_operand , string $right_operand [, int $scale ] ) $scale 相加后,返回几位小数 两个高精度数相减 string bcsub ( string $left_operand , string $right_operand [, int $scale ] ) $scale 相减后,返回几位小数 两个高精度数求余/取模 string bcmod ( string $left_operand , string $modulus ) 两个高精度数相除 string bcdiv ( string $left_operand , string $right_operand [, int $scale ] ) $scale 相除后,返回几位小数 两个高精度数相乘 string bcmul ( string $left_operand , string $right_operand [, int $scale ] ) $scale 相乘后,返回几位小数 两个高精度数的次方值 string bcpow ( string $left_operand , string $right_operand [, int $scale ] ) $scale 次方,返回几位小数 高精度数的平方根 string bcsqrt ( string $operand [, int $scale ] ) $scale 返回几位小数 设置bc函数的小数点位数 bool bcscale ( int $scale ) $scale 几位小数