Confused by Workflow Float Calculation

I was running a small experiment on Bubble and a local workflow calculation got me scratching my head :thinking:

What I did is create a thing called “Population” with a field “size” and a field “growth”.

The initial size is 5 and the initial growth is 0.01.

Then I setup a workflow to run every 2 seconds and modify the Population, so that size = This Population’s size + This Population’s growth.

Now I’d expect the size value to change as follows: 5.01, 5.02, 5.03, 5.04 etc.

But instead I get: things like 5.079999999999998 etc.

So what’s up with decimal numbers here? Why’s Bubble going all nerdy on me? :nerd_face: :slight_smile:

Bubble will go all nerdy on you until you tell it to not go all nerdy on you. :slight_smile:

Seems like you just need to round the calculation to two decimal places, although I’m guessing you may have tried that already?

Best…
Mike

Oh, wait… you’re just literally adding the two numbers together (for some reason, I thought it was more complicated than that). I can’t even imagine how you could get what is happening to happen. The system must think your growth field isn’t really 0.01?

1 Like