Php:bcmath
BC is the abbreviation of binary calculator. The arguments for the bc* function are the operands plus an optional [int scale], such as String Bcadd (String $left _operand, String $right _operand[, int $scale]), if scale does not provide , the default value of Bcscale is used. The large number is directly represented by a string of 0-9, and the result returns a string.
Bcadd-adds two high precision numbers
bccomp-compares two high-precision digits, returns-1, 0, 1
bcdiv-divides two high-precision digits
bcmod-to find high precision digit remainder
Bcmul-multiplies two high precision numbers
bcpow-to find high precision digital exponentiation
Bcpowmod-to seek high-precision digital exponentiation, the number theory is very common
bcscale-Configure the default decimal point number, which is equivalent to the "scale=" in Linux BC
bcsqrt-High precision Digital square root
bcsub-subtracts two high-precision digits
You can refer to the manual to find out the application of these functions.
PHP code?
/*bcsub function Description
This function subtracts two highly-accurate numbers, passes in two strings, and subtracts the right operand value from the left operand. Scale is an optional option that represents the number of digits required after the decimal point of the returned value. */
The following code I was guaranteed a decimal point digit
$aa =bcsub (134.7,52.5,1);
echo $aa;//exit;
$BB =bcsub ($aa, 82.2, 1);
echo $bb;//exit;
You can try it out.