Number decimal precision issue. 12+ decimal places added

Hi Bubble Forum,

I have a peculiar issue, after doing regular addition and subtraction operations on a number, the results are sometimes appended with a very small decimal variance. In the region of 0.0000000000001.

For instance, I have record with a number value of 3,132.00, this number is then manually allocated to other sub-records by the user - they split this value at their discretion. In this instance sub-record A got 3,053.70, but sub-record B got 78.3000000000002.

There is no way the user is entering any precision smaller than 2dp. they put a value in an input, and the workflow sets this value for the sub-record.

This is an issue as it breaks my API with the 3rd party accounting system on decimal precision grounds. And yes, I am aware I can use ‘rounded to 2’ on my actions, but as a rule I don’t put them on set workflows using only addition and subtraction operations, as they shouldn’t create such issues?

This is more of a “how the hell is this happening?” post haha. Interested to know if anyone else has seen this and knows what is causing it.


Welcome to the world of ‘floating-point arithmetic error’…

You might be forgiven for thinking that computers are incredibly good at maths, and can calculate complex equations to a high degree of accuracy…

But actually, they can’t…

take the classic example of 0.1 + 0.2

Everyone knows that this extremely simply equation equals 0.3

But a computer will give the answer of 0.300000000000000044409

The actual reasons why are quite complex, but put simply it’s because binary (which is a base-2 system), is fundamentally incompatible with decimals (a base-10 system), especially when you have limited resources (which all computers do), which means that certain numbers simply can’t be represented exactly.

Here’s a couple of videos that explain it better than I can, if you’re interested:

Why do computers suck at math? - YouTube

Floating Point Numbers - Computerphile - YouTube

Thanks Adam,

Yeah this has given me flashbacks to my com science undergrad days…
I guess I naively thought Bubble would have safeguards in place to prevent such issues, hence my focus on Bubble itself, as opposed to the arithmetic happening at a machine level.

I guess the only solution is to wrap all calculations/operations using the ‘roundedto’ operator?