• Lua string.format strange results
    3 replies, posted
Hi, I have a small problem with rounding numbers in lua. Can somebody explain to me this two examples? https://files.facepunch.com/forum/upload/259555/43c1eb59-076f-4656-89f2-4b5617e21740/lua_string.jpg
Because of floating point imprecision I'd imagine, due to how floats are stored in memory. 53.30+0.05=53.349999999999994 even if it may print as 53.35 in the console IEEE 754 Calculator
I see, thanks. I should use probably different function for rounding numbers
There is one that comes with gmod! math.Round
Sorry, you need to Log In to post a reply to this thread.