Some methods of handling floating-point numbers in PHP are recorded
Do not use the equal sign, greater than, plus, minus, multiply, divide, etc in the program to operate floating-point numbers, and if you need to do this, use the following BC series functions. To ensure accuracy and accuracy.
Two high-precision number comparison sizes
$left_operand$right_operand$scale ] )
- l e f t = Right returns 0
- l e f t < Right Returns-1
- l e f t > Right returns 1
- $scale the precision to compare, that is, how many digits after the decimal point
Two high-precision numbers added
$left_operand$right_operand$scale ] )
- Returns several decimals after the $scale is added
Subtract two high-precision numbers
$left_operand$right_operand$scale ] )
- Returns a few decimals after $scale subtraction
Two high-precision numbers for redundancy/modulus
$left_operand$modulus )
Divide two high-precision numbers
$left_operand$right_operand$scale ] )
- After dividing $scale, return several decimals
Multiply two high-precision numbers
$left_operand$right_operand$scale ] )
- Returns several decimals after the $scale is multiplied
The quadratic value of two high-precision numbers
$left_operand$right_operand$scale ] )
- $scale time, return several decimals
The square root of high precision number
$operand$scale ] )
- $scale return several decimals
Set the number of decimal places for the BC function
$scale )
Some methods of handling floating-point numbers in PHP are recorded