php floating point precision arithmetic problem

In direct floating-point arithmetic, there will be a calculation error, which is not a language problem, but a computer problem. So try to avoid floating point operations, and inevitably use mathematical functions. When money is involved, it is best to use BCMath.

Math function address: Math function

BCMath Address: Arbitrary Precision Math

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324811680&siteId=291194637