Jump to content
We've recently updated our Privacy Statement, available here ×

Math.round in Ireport


nhutnhut79

Recommended Posts

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.

 

Ireport_and_Crystal.jpg.43a6bd177946928ce30ac816f7f5fe66.jpg

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

1.
>> Result is fine but with data have many record is result fine yet

Is 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.0499999999997
Check your report. What are you show in report? Are you sure that it is result of setScale?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...