Numbers too big become negative, why?
Question

Hi.

My program need to show a big number, that number is growing all the time.

It is stored in a variable and than saved to the database time to time.

and that number goes above trillion.

But when it happens the number starts to go negative like that:  -1124763612219894.81970104

and starts to go crazy.

Outsystems doesnt support big numbers?

Kind regards,

Pedro Boffa

mvp_badge
MVP

Hello Pedro.

If you are using Integer, the maximum is 2147483647 (2^31-1).

If you use Long Integer, it can go up to 9223372036854775807 (2^63-1).

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Data_Types/Available_Data_Types

So you  just need to change the type in the variable and attribute.

Hi Nuno,

Thank you for your answer.

yes I know.

The problem is that I need to use decimal.

Even tho I used long Integer before and the problem also happened.

But it seems it cant go too high even using long integer.

I dont know how people do it, I mean I am made a click game, its like many you have around there, and the numbers go beyond decitillions etc, without a problem. 

Dont know how they do it.

Anyways,

thank you for you time.

Kind regards, 

Pedro Boffa


mvp_badge
MVP

Hi Pedro,

Like Nuno said, long integers use 64 bit, and go up to 2^63, which is about almost 10^19. Decimals can go all the way up to 10^28 (and a bit). So decimals can go further than long integers. If you really need even bigger numbers, you'd have to make something yourself, but database storage will be more difficult in that case, as there's no standard way to handle such big numbers.

That said, humans can't perceive such large numbers with ease, so you'd have to ask yourself if it's really useful to want to store such large numbers with such precision.

mvp_badge
MVP

Hi Pedro,

What data type are you currently using to store the large number? Given that you have decimals, I assume it's a Decimal? If so, how is it defined?

In general, if you add something to a very large (signed) number, it overflows and becomes negative, but I'm not sure whether this is supposed to happen with Decimals.

Finally, "Outsystems doesnt support big numbers?" - OutSystems is built on .NET and SQL Server/Oracle, and it supports whatever those platforms are supporting.

Hi,

Yes, I am using Decimals.

I did a research  and what I found is that people that create those Click Games they create formulas or ways to  show the number like instead of showing 1.000.000 would be 1.0M or something like that. I need to think a way to do it.

Thank you very much for all the answer and for your time.

Kind regards,

Pedro Boffa

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.