How to add decimals?

Hello, I have a 1,000,000.00 label and I wanted to add 0.01 to stay 1,000,000.01

You should be able to do this with the standard math blocks @Fernando_Matos?

What are you trying right now, and what result is it giving you?

1 Like

Hi there,

If this is about formatting numbers, the tutorial here can let you add numbers after the decimal point and leave the commas in the right place.

If you want to just add 0.01 to a number, that should be possible with regular Math blocks.

1 Like

i have done this. label 6 is " 1,000,000.00 and wen i click button_open the result is "

Hi there,

I think this is because of the fact that your text ‘1,000,000’ has commas in it.

The math block seems to stop reading once it encounters a non-numeric character.

If you check out the number formatting post I linked to you, you’ll see a function called ‘clean up’ which removes all commas from the inputted number. Then once the app returns an answer for whatever sums were done to the inputted number, commas will be re-added to make the number be formatted nicely.

So for this sum, the app would go

  1. 1,000,000 -> 1000000
  2. 1000000 + 0.01 = 1000000.01
  3. 1000000.01 -> 1,000,000.01
  4. Return 1,000,000.01

I know the post is a little bit long but it does work! :grinning:

1 Like

Also, consider using a stored variable rather than the Local Storage component - it’s much handier to work with! :grinning: