Strange rounding behaviour with large numbers

I have a “number”-type thing.

The number I would like to save in the database for this is 990858419013566485.

However, for some reason, the datebase automatically rounds the last 3 digits (485) to 500 every time I try to save the number. Instead of saving 990858419013566485, its saving it as 990858419013566500.

I did some testing with the last 3 digits being other numbers and it seems that it keeps rounding the last 3 digits to the nearest ‘100’ no matter what I input. In fact, as soon as there are around 16 digits, the last 1-3 digits start getting rounded up or down or even just changing randomly.

Is this a bug? Is there a way to fix the issue?

Instead of saving as a number try saving it as text instead.

If you need to use that data as a number again, you can apply :converted to number at any point of time.

2 Likes

Does that really need to be a ‘number’? (990 quadrillion!!) - What exactly is it representing?

As far as I understand, the largest number that Javascript can accurately handle is 2^53-1 (or 9,007,199,254,740,991) which is about 9 quadrillion - so you’re roughly 100 times over that limit…

I’m not sure if there’s any workaround in Bubble for working with such large numbers to that degree of accuracy… there might be some external libraries or APIs that can handle larger numbers (assuming you really need to keep it as a number, or need to be that accurate, which will of course depend on what you’re doing with it).

3 Likes

Thanks for responses.
Not a big issue, I’m able to save it as a text string for now.

1 Like