I opened a thread over an year ago, about Float numbers.
See:
https://www.b4x.com/android/forum/threads/float-type-is-wrong.42820/
Today I tried a very small project which seemed devoid of logical errors. I am attaching the project.
In summary, at each Tick of a timer, every 50 milliseconds, the value of a ProgressBar is increased by 0.1. Reached the maximum value, ie 1, the timer is disabled.
Sub tmr_Tick
ProgressBar1.Progress = ProgressBar1.Progress + .1
If ProgressBar1.Progress = 1 Then
tmr.Enabled = False
End If
End Sub
This does not happen, because the values are never accurate.
I thought about the fact that maybe the timer is not accurate to the thousandth, so I added a variable Float to take a test, but I get even worse results.
Now I wonder: there is no logic error in the project (this does not happen in other languages/ S.O.).
What to do?!?!
(I know that I could write:
If ProgressBar1.Progress >= 1 Then
of course; this is not the problem)
[P.S. to check the error, it is useful to add a Log after: tmrEnabled = False]