aspose file tools*
The moose likes Beginning Java and the fly likes how to convert mantissa presentation to double  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to convert mantissa presentation to double  " Watch "how to convert mantissa presentation to double  " New topic
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
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14107
    
  16

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: 38353
    
  23
The System.out.printf method with "%.4f" (or similar) as a format String might work as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to convert mantissa presentation to double