DeimalFormat class rounding issues

Posted on 2011-04-26
Medium Priority
Last Modified: 2012-05-11
We are in the process of migrating our applications from Java 4 to Java 6

We see some issues in rounding the double numbers using Decimal Format class.
The rounding is different is different between Java 4 & java 6.

using the following pattern
new DecimalFormat("0.##");

the difference is something like this

34.35  VS 34.34

How can we force to use the same rounding pattern so that they are not different.

Are there any other classes that behave differently between the Java versions


Question by:dhuma
  • 2

Author Comment

ID: 35475716
looks like the Rounding strategy is same in Both java 4 & Java 6. However, the same number is getting rounded differently between those Java version. Does any of the other factors play a role, like 64 bit etc?

LVL 92

Accepted Solution

objects earned 2000 total points
ID: 35479681
no other factors play a role

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question