# Help! Money calculator

**URL:** https://forum.makecode.com/t/help-money-calculator/30767
**Category:** Help
**Tags:** graphics-and-math
**Created:** [September 22, 2024, 5:13pm UTC](https://forum.makecode.com/t/help-money-calculator/30767 "2024-09-22T17:13:01Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ultimategreg123](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ultimategreg123/32/9940_2.png) [@Ultimategreg123](https://forum.makecode.com/u/Ultimategreg123)
#### Post date: [September 22, 2024, 5:13pm UTC](https://forum.makecode.com/t/help-money-calculator/30767/1 "2024-09-22T17:13:01Z")

</div>

Hi! I’m making a money counter, but there seem to be some weird glitches. Adding 1p is fine until the 6th time where it says £0.060000000 and then is fine again until the 10th time where it says 0.0999999999. Is it something to do with the array?

> **[Money Counting Helper](https://arcade.makecode.com/22216-36701-18972-95487)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Thanks if you can help.

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [September 23, 2024, 1:41am UTC](https://forum.makecode.com/t/help-money-calculator/30767/2 "2024-09-23T01:41:16Z")

</div>

Gotta love floating point imprecision! When computers store decimals, they kinda estimate the decimal instead of storing it normally. You have to prevent them from being stored as decimals. To do this, just multiply every number in the lookup array by 100 and then divide by 100 before showing the result! This will stop your numbers from being stored in decimal form, which should stop the imprecision!

 ![IMG_6338](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/1/b111089be0177410aa9f248b7a963d6d1b4eb871.jpeg)  
 ![IMG_6337](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/6/f/6fa32188ce3c0efc3887bea14533c14bb0509d75.jpeg)

---

<div class="post-metadata">

### Author: ![Ultimategreg123](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ultimategreg123/32/9940_2.png) [@Ultimategreg123](https://forum.makecode.com/u/Ultimategreg123)
#### Post date: [September 24, 2024, 7:02pm UTC](https://forum.makecode.com/t/help-money-calculator/30767/3 "2024-09-24T19:02:18Z")

</div>

Thank you! That was an amazing explanation, very detailed! Ill send the finished project, Thanks again!

---

<div class="post-metadata">

### Author: ![Ultimategreg123](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ultimategreg123/32/9940_2.png) [@Ultimategreg123](https://forum.makecode.com/u/Ultimategreg123)
#### Post date: [October 5, 2024, 6:58pm UTC](https://forum.makecode.com/t/help-money-calculator/30767/4 "2024-10-05T18:58:02Z")

</div>

More help needed as I wanted it to say (eg.) £85.50 (with the zero at the end, not just £85.5) but I can’t think how.

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [March 5, 2025, 10:18pm UTC](https://forum.makecode.com/t/help-money-calculator/30767/5 "2025-03-05T22:18:01Z")

</div>

You could use the “convert (0) to text” block in the Text tab (advanced section)  
Then you could check to make sure that the 3rd to last character in the string is a “.”, and if it isn’t then it means that you need to add an extra “0” to the string before displaying it.
