Automatic rounding of big numbers
Hi all!
I have a text-input control with a decimal property on it. When I try to input 12345678901234567890 in it and refresh a section, number rounds to 12345678901234567000. If I try to input 1234567890123456789, I'll get 1234567890123456770 and so on.
If I use a property with type "double", result is the same. I found some kind of solution, but it's not very elegant - custom control, wich just a copy of built-in one.
Someone have another solution?
I thought, java's double type should allow to operate with much bigger values... What's wrong with pega's double?
***Updated by moderator: Lochan to add Categories***


Hi Alexey,
Which version of PRPC/Pega are you using? I do not believe this behavior should have changed between releases, but it will be good to know in case it goes down that path.
At any rate, if you look at your behavior closely, this is not rounding, but rather truncation.
So what you are experiencing is not rounding or a perceived lack of support for a large number in this scenario.
Your value is being truncated after x significant digits. Pega's double allows you to hold a 64-bit floating point value.
It looks like the implementation here supports 17 significant digits.
https://en.wikipedia.org/wiki/Double-precision_floating-point_format
Here is a number even larger than yours that is supported, and it will be truncated as well.
Hi Alexey,
Which version of PRPC/Pega are you using? I do not believe this behavior should have changed between releases, but it will be good to know in case it goes down that path.
At any rate, if you look at your behavior closely, this is not rounding, but rather truncation.
So what you are experiencing is not rounding or a perceived lack of support for a large number in this scenario.
Your value is being truncated after x significant digits. Pega's double allows you to hold a 64-bit floating point value.
It looks like the implementation here supports 17 significant digits.
https://en.wikipedia.org/wiki/Double-precision_floating-point_format
Here is a number even larger than yours that is supported, and it will be truncated as well.
To prove this point, take a look at the scenario on the other end of the spectrum.
Here is a relatively small number, but trying to again surpass 17 significant digits.
You will see the same sort of truncation.
So if you really require storing a value needing more than 17 significant digits, please try setting the value type form Double to Decimal
Thank,
Rett