# Rounding issues

**URL:** <https://forums.moddingtree.com/t/rounding-issues/1475>\
**Category:** Modding Developers\
**Created:** [June 22, 2024, 10:00pm UTC](https://forums.moddingtree.com/t/rounding-issues/1475 "2024-06-22T22:00:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![accmadeforquestions](https://forums.moddingtree.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@accmadeforquestions](https://forums.moddingtree.com/u/accmadeforquestions)\
**Post date:** [June 22, 2024, 10:00pm UTC](https://forums.moddingtree.com/t/rounding-issues/1475/1 "2024-06-22T22:00:03Z")

</div>

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](https://tmt-forums-uploads.s3.us-east-005.backblazeb2.com/original/1X/948cd739fe11d3cd3026aad0ff8a632f6ce0b4c1.png)

---

<div class="post-metadata">

**Author:** ![Raylan\_Helton](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/raylan_helton/32/745_2.png) [@Raylan\_Helton](https://forums.moddingtree.com/u/Raylan_Helton)\
**Post date:** [August 7, 2024, 5:30pm UTC](https://forums.moddingtree.com/t/rounding-issues/1475/2 "2024-08-07T17:30:15Z")

</div>

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\_

---

<div class="post-metadata">

**Author:** ![Raylan\_Helton](https://forums.moddingtree.com/user_avatar/forums.moddingtree.com/raylan_helton/32/745_2.png) [@Raylan\_Helton](https://forums.moddingtree.com/u/Raylan_Helton)\
**Post date:** [August 7, 2024, 5:31pm UTC](https://forums.moddingtree.com/t/rounding-issues/1475/3 "2024-08-07T17:31:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![accmadeforquestions](https://forums.moddingtree.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@accmadeforquestions](https://forums.moddingtree.com/u/accmadeforquestions)\
**Post date:** [September 7, 2024, 4:19pm UTC](https://forums.moddingtree.com/t/rounding-issues/1475/4 "2024-09-07T16:19:00Z")

</div>

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

```auto
        cost(x) { return new Decimal(16).pow(x).round() },

```
