This article mainly introduces the data in PHP for floating-point type needs to be solved in different ways. Need friends can come to the reference, I hope to help you
Php:bcmath BC is the abbreviation for 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 numbers bcmod-the high precision numeric remainder bcmul-multiplies two high-precision numbers bcpow-the high precision number Word of the bcpowmod-to find High-precision digital exponentiation, number theory is very common bcscale-configure the default decimal places, equivalent to the Linux BC in the "scale=" bcsqrt-to find high-precision digital square root bcsub-subtract two high-precision digits You can refer to the manual to find out the application of these functions. The code is as follows: The/*bcsub function shows that this function subtracts two high-precision digits, passes in two strings, and subtracts the right operand value from the left side. 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; Floor