This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm trying to format a double in scientific notation to a double not in scientific notation. I tried using DecimalFormat to format the scientific notation double to a string. But, when I try to convert it back to a double I get the scientific notation back.
7.399999999999985E-5 To 0.00007 (When I create a new Double I get 7.0E-5 back).
The double itself has no concept of whether it's using scientific notation or not. That is only relevant when you try to convert it to a String. If you have two doubles:
These are exactly equal in all ways. There is no difference at all. What you're asking for is impossible. If you want to convert either of these to a string that doesn't use scientific notation, you need to use the DecimalFormat, or similar methods. (JDK 5 has other methods which can help, e.g. String.format().)
"I'm not back." - Bill Harding, Twister
Joined: Nov 22, 2004
I appreciate you subtlety, I couldn�t agree more! I will rethink what I�m trying to do.