This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to convert mantissa presentation to double

 
Meir Yan
Ranch Hand
Posts: 599
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use class java.text.DecimalFormat to format decimal numbers in many different ways. Look it up in the API documentation.
 
Ronald Schild
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic