Rounding issues

I was just making my 5 Modding tree game ideas, and then I found something weird, it was telling me to buy the buyable for X.0000000… or X.999999999 pieces instead of rounding it to X:

idek

I know it’s a month after but I’m pretty sure that’s a floating point precision error effectively unfixable all you can do is make it a little bit better and push it a little bit farther into your game until you get to e_

Or make it even worse until it goes really out of whack

I finally found out I needed to use round() to make it work like intended

        cost(x) { return new Decimal(16).pow(x).round() },
1 Like