nhutnhut79 Posted November 2, 2013 Share Posted November 2, 2013 Hello everyone, SANBEZ had helped me, try to use BigDecimal.setScale instead Math.round: http://community.jaspersoft.com/questions/820117/mathround-two-decimal-ireport-v50. Result is fine but with data have many record is result fine yet. I think problem at round funtion in Ireprot. I have an example with 20 record. My job current is convert formulars from Crystal report to Ireport Jasper. I have many difficulties with Round function because result on report don't same with old report. We don't use Pattern property for this case. I want Math.round(), setScale() return: 20.05 not 20.049999999999997. Please help me! Link to comment Share on other sites More sharing options...
sanbez Posted November 5, 2013 Share Posted November 5, 2013 1.>> Result is fine but with data have many record is result fine yetIs it means that all fine? "is fine but... fine yet" : why "but" if all fine?2.>> new BigDecimal.setScale(2,ROUND_HULF_UP)This operation always return 20.05 not 20.0499999999997Check your report. What are you show in report? Are you sure that it is result of setScale? Link to comment Share on other sites More sharing options...
nhutnhut79 Posted November 8, 2013 Author Share Posted November 8, 2013 Thank Sanbez. I change all data from Number to BigDecimal ----> result very good! 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