| Author |
how to convert mantissa presentation to double
|
Meir Yan
Ranch Hand
Joined: Apr 27, 2006
Posts: 597
|
|
Hello all im getting from as input mantissa presentation that i know its double it looks like this : 8.0E-4 i need to convert it to its double presentation that i know is 0.0008 how can it be done in java ?
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
|
You can use class java.text.DecimalFormat to format decimal numbers in many different ways. Look it up in the API documentation.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Ronald Schild
Ranch Hand
Joined: Jun 09, 2008
Posts: 117
|
|
|
What would be the best pattern to convert any scientific notation to normal? I've been playing with "####################.###################", it seems to work but feels so random.
|
Java hobbyist.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
|
The System.out.printf method with "%.4f" (or similar) as a format String might work as well.
|
 |
 |
|
|
subject: how to convert mantissa presentation to double
|
|
|