When calculating the growth rate, you can use round to extract the two digits after the decimal point, but when you go to the database to view the data, most of the data is acceptable, however, after debugging some errors, I found that the bug-8.04554644255644round becomes-8.04000000000001, which is quite likely to appear in another bug... when calculating the growth rate, use round to extract the last two digits of the decimal point.
However, when I went to the database to view the data, most of the data was acceptable, but some of them encountered errors.
Found after debugging
-8.04554643785644
After round becomes
-8.04000000000001
This bug is highly likely to occur.
Test in another script, and the same data is intercepted normally.
Reply content:
When calculating the growth rate, use round to extract the last two digits of the decimal point.
However, when I went to the database to view the data, most of the data was acceptable, but some of them encountered errors.
Found after debugging
-8.04554643785644
After round becomes
-8.04000000000001
This bug is highly likely to occur.
Test in another script, and the same data is intercepted normally.
It's not a bug. There must be a precision error when it comes to floating point numbers. Just pay attention to it.