cancel
Showing results for 
Search instead for 
Did you mean: 

UDF - Java issue

Former Member
0 Kudos

Hi there

I have some values that I need to add up but it is too big for a normal double value. How do I manage around this? The values can be negative or positive and can go up to $99 999 999 999.99. I have a context array that I need to loop through and add up these values.

Thanks,

Jan

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Got it working.

BigDecimal d1 = new BigDecimal(value);

BigDecimal d2 = d1.setScale(2, BigDecimal.ROUND_HALF_DOWN);

result.addValue(d2+"");

Cheers,

Jan

Former Member
0 Kudos

Hi again

The decimal is not really my issue, I can loop through the string values, parse it to Double and add them up but when I convert it back to a string I get something like

3.450041159E7 or -3.450041159E7

How do I change this to be a normal string?

Former Member
0 Kudos

Hi,


The basic ·value space· of double consists of the values m × 2^e, where m is an integer whose absolute value is less than 2^53, and e is an integer between -1075 and 970, inclusive. In addition to the basic ·value space· described above, the ·value space· of double also contains the following three special values: positive and negative infinity and not-a-number (NaN)

2^53 = 9.00719925 × 10^15 

I think double data type is enough for ur requirement

jyothi_anagani
Active Contributor
0 Kudos

Hi,

You can use formatNumber standard Function. and take 11 '0's and 2 decimals.and decimal separator as ' . '

like


  input---------------formatNumber[00000000000.00]--------------output

Thanks.