phantastes Posted March 23, 2010 Share Posted March 23, 2010 Hi,I want a value of 3.665 to be rounded to 3.67.I have a field provided with a BigDecimal. The field is in a crosstab. I've set the field to show 2 decimal places. The problem I am having is that it doesn't seem to round correctly.In the fields textfield I have:$V{gpaAverageMeasure}.setScale(2, java.math.RoundingMode.HALF_UP)Instead of rounding up to 3.67 it rounds down to 3.66.Any help would be very welcome!Magnus Post Edited by phantastes at 03/23/2010 21:02Post Edited by phantastes at 03/23/2010 22:46 Link to comment Share on other sites More sharing options...
phantastes Posted March 23, 2010 Author Share Posted March 23, 2010 The above $V{gpaAverageMeasure}.setScale(2, java.math.RoundingMode.HALF_UP) , were $V{gpaAverageMeasure} is a BigDecimal, works. I had pulled in floatValue() in the measure calculation which messed it up. So the short of it is, just use BigDecimal.Magnus Link to comment Share on other sites More sharing options...
estebanretana Posted July 10, 2015 Share Posted July 10, 2015 Magnus how you solved it ? I have the same error.But I use $F{FOB75}.setScale(2,BigDecimal. ROUND_HALF_UP).multiply($F{QRV075}.setScale(2,BigDecimal. ROUND_HALF_UP)) Where $F{FOB75} and $F{QRV075} are a bigDecimal field. Any idea how to do that right.Thank you,EstebanR 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