MMBasic V6.03.00 release candidates
Author
Message
JohnS
Guru
Joined: 18/11/2011
Location: United KingdomPosts: 4332
Posted: 08:21pm 05 May 2026
dddns said
If I move up/down all values are correct until 0.2
Going to 0.3 or to -0.3 and back to 0 I get -2.775557562e-17 instead of 0
Option explicit
Dim float a
Do
Select Case Asc(Inkey$)
Case 128
Inc a,0.1
Case 129
Inc a,-0.1
End Select
Print @(100,100)" ";
Print @(100,100)a;
Loop
?a
-2.775557562e-17
PicoMite MMBasic USB RP2350B Edition V6.03.00RC1
That's an inherent feature of floating point.
It's akin to using a calculator, divide 1 by 3, getting 0.33333 etc, multiplying by 3 and you don't get 1.
John
Edited 2026-05-06 06:23 by JohnS