We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

DeimalFormat class rounding issues

dhuma
dhuma asked
on
Medium Priority
271 Views
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

thanks


Comment
Watch Question

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:

Author

Commented:
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?

Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.