Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Rounding issue with BigDecimal and JSP

richardgundersen-JavaNetJul 9 2007 — edited Jul 11 2007
Hi

In my Java I have two BigDecimals that I pass to a JSP. THey both have a scale of 2, so I have

x = 5.52 and y =1.22

When I add them up in the JSP, the decimal places are lost e.g.

<c:out value="${ x + y)"/>

I get 6, instead of 6.74

Please can someone tell my why I get this rounding error?

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 8 2007
Added on Jul 9 2007
12 comments
1,126 views