DeimalFormat class rounding issues

Posted on 2011-04-26
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
    LVL 92

    Expert Comment


    Author Comment

    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

    no other factors play a role

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    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 …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    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.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now