Jump to content
JasperReports Library 7.0 is now available ×

Compare Double to Integer


2006 IR Open Dicussion

Recommended Posts

By: AllRightyThen - mbruner_earj

Compare Double to Integer

2006-03-07 11:48

I have two filds I would like to compare. One is a calculated Double value. I would like to ROUND this value to a whole number. Then I have an Integer value I would like to compare that to. If I use a mask, no rounding occurs and the comparison is wrong. If I do new Integer($F{DOUBLEFIELD} != $F{INTEGERFIELD}, the double field gets truncated instead of rounded. How do I round that value? Thanks.

 

Michael

 

 

 

 

By: cardondenis - cardondenis

RE: Compare Double to Integer

2006-03-07 12:20

Hi,

 

something like :

 

((int) Math.round($F{mydouble}.doubleValue()))

== $F{myint}.intval()

? "true" : "false"

 

should do it. Perhaps groovy would also help.

 

Cheers,

 

Denis

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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