Jump to content

Rounding Issue in iReport 3.7 with Double datatype


manshack_one

Recommended Posts

I'm having a similar rounding issue as another user here.  Attached is a sample report.  I ran this query against my database:

select Rate, CallDate, Minutes, Revenue, Commission, call2, call1
from call_detail where CallDate between '2009-12-01' and '2009-12-15'
and Minutes between 1 and 15 and call2 = 'Complete'
and call1 = 'Debit'
group by Minutes, Rate
order by Minutes, Rate;

Revenue and Commission are formatted Double(6,3) in MySQL.  Using iReport 3.7 with Groovy as the default language.  In the attached report you will see that it's not always rounding correctly.  The first Revenue and Commission columns are straight values from the database without any formatting.  The second two are formatted using the pattern in iReport for Currency with 2 decimal places.  Compare "Interstate 1 minute Commission" with it's formatted commission against "Interstate 15 minutes Revenue" with it's formatted revenue.  .155 becomes $0.16 but 5.805 becomes $5.80 instead of $5.81.  Double is accurate enough for me since the beginning calculations are small since at most I'm mulitplying 43 cents by 15 minutes.  But if it's not rounding correctly then by the time it adds up 15,000 records or so it can be a problem.  Please see the attached report to see what I'm talking about.  I've attached the jrxml also if it would help with any troubleshooting regardless of being able to actually fill it on your end.  Thanks in advance.

 

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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...