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

Math.round() to two decimal in Ireport V5.0


nhutnhut79

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Try to use BigDecimal.setScale instead Math.round
For example as here:

  public static double round(double value, int decimalPlace) {
      return new BigDecimal(value).setScale(decimalPlace, BigDecimal.ROUND_HALF_UP).doubleValue();
  }

May be it solve your problem.
Welcome to the world of java-computing :))


 

Link to comment
Share on other sites

  • 1 year later...

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