aspose file tools*
The moose likes Java in General and the fly likes A question about double type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "A question about double type" Watch "A question about double type" New topic
Author

A question about double type

YuenLian Wu
Ranch Hand

Joined: Nov 16, 2005
Posts: 73
Hi all,

I am currently using double to sum up a bunch of big number with decimal places. I try to export some data in csv format, and one of the field belong to what I just said. However, i see 7.8923932482495E9(for example) in my csv file. I am wonder how can I get the number completely, e.g 78923932482495.79. My friend tell me to use BigDecimal class, however, I only see it has some functions to wrap up the long data type. "long" is not what I want since my field has decimal places.

Can anybody give me suggestions to solve this question?

Myriads Thanks

Transistor
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

When you print your numbers, you have to format them deliberately the way you want them, or be happy with the default. The way to format numbers deliberately is with the java.text.DecimalFormat class.

I'm moving this to Java in General (Intermediate.)


[Jess in Action][AskingGoodQuestions]
YuenLian Wu
Ranch Hand

Joined: Nov 16, 2005
Posts: 73
seems cooL, thanks....
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
My friend tell me to use BigDecimal class, however, I only see it has some functions to wrap up the long data type...
What in the documentation gave you that idea. Even the name BigDecimal should give you some indication of the type of operations this class was created for.


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A question about double type