Tecnology_Wizz [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=72584 Bug with Adding decimals <p>So I'm trying to make a idle game and im using a timer that resets to 0 every 30 cycles to make a 1 second timer, my goal is to make the total number increase by 0.2 every second but after a wile it increases by 0.1999 instead and I have no idea why</p> <p>heres my code:<br /> function _init()<br /> timer=0<br /> counter=0<br /> end</p> <p>function _update()<br /> if timer==30 then timer=0 end<br /> if timer==0 then counter+=0.2 end</p> <pre><code>timer+=1</code></pre> <p>end</p> <p>function _draw()<br /> cls()<br /> print(&quot;timer:&quot;,0,0)<br /> print(timer,24,0)<br /> print(&quot;counter:&quot;,0,7)<br /> print(counter,32,7)<br /> end</p> https://www.lexaloffle.com/bbs/?tid=51568 https://www.lexaloffle.com/bbs/?tid=51568 Thu, 09 Feb 2023 19:42:12 UTC