kunkasurendra Posted February 4, 2009 Share Posted February 4, 2009 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 Link to comment Share on other sites More sharing options...
svenn Posted February 4, 2009 Share Posted February 4, 2009 Check out the Java APIhttp://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html Link to comment Share on other sites More sharing options...
aetherflux Posted February 5, 2009 Share Posted February 5, 2009 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() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now