Home > other >  Lua accuracy problem
Lua accuracy problem

Time:09-19

The local test=0.4
While the test & gt; 0 do
Test=test 0.1
If test> 0 and test<0.1 then
The log ("==============shit ".. Test)
End
End

Eventually the log output=============shit=2.7755575615629 e-017

Know is precision error problem, but this is too easy error. Only three or four times during the operation there is error..
We are trying to avoid using decimal calculation before, but the decimal point, if anything, this kind of question you have any solution?

CodePudding user response:

Results can be multiplied by 100 results first, and then divided by one hundred,

CodePudding user response:

Has nothing to do with operations, so at a time
  • Related