By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Printing large double values without the exponential notation?

P: n/a
How can I print out the value of a large double in plain decimal form without the exponential notation? For example
(quick code):

PlainPrint.java:
---------------
public class PlainPrint {
public static void main(String[] args) {
double aValue = 123456789.1234;
System.out.println(aValue);
}
}

If you compile and run this, you'll print "1.234567891234E8" instead of "123456789.1234". I need the latter version.

Thanks!
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try using DecimalFormat, like this:

DecimalFormat myFormatter = new DecimalFormat("0.0000");
String output = myFormatter.format(doubleValue);
"Ryoga" <te*******@teamdelsol.co_> wrote in message
news:40***********************@news.frii.net...
How can I print out the value of a large double in plain decimal form without the exponential notation? For example (quick code):

PlainPrint.java:
---------------
public class PlainPrint {
public static void main(String[] args) {
double aValue = 123456789.1234;
System.out.println(aValue);
}
}

If you compile and run this, you'll print "1.234567891234E8" instead of "123456789.1234". I need the latter version.
Thanks!

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.