How to sum BigDecimal values

0

Hi ,

I am new to java,I am trying to add the two BigDecimal values,

Please help some one,

How to add BigDecimal values.

 

Thanks in advance,

Surendra

 

 

kunkasurendra's picture
Joined: Jun 12 2007 - 3:43pm
Last seen: 7 months 3 weeks ago

2 Answers:

-1
svenn's picture
1345
Joined: Mar 19 2007 - 5:57am
Last seen: 12 years 1 month ago
1

The API is good if you want to do precision mathematics, but let me give you an easier answer.

You can't add two BigDecimals together because that would be crashing two objects into each other, essentially. :-)

Your best bet is to take the .doubleValue() of each and add those together, since that method returns a primitive type that you can do arithmetic on.

Code:
$F{MYDECIMAL1}.doubleValue() + $F{MYDECIMAL2}.doubleValue()</td></tr></tbody></table>
aetherflux's picture
Joined: Apr 11 2007 - 10:30pm
Last seen: 5 years 5 months ago
Feedback