473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Printing large double values without the exponential notation?

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
1 20521
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Timothy Fitz | last post by:
Why are all numberical literals in exponential notation floats? To me it is counter-intuitive for 1e3 to behave so fundamentally different from 1000. Timothy Fitz
5
by: DAVID SCHULMAN | last post by:
I've been trying to perform a calculation that has been running into an underflow (insufficient precision) problem in Microsoft Excel, which calculates using at most 15 significant digits. For this...
2
by: Rod Brick | last post by:
I'm trying to print a Double in straight decimal form, not exponential. I can't seem to accomplish this. This seems like it should be simple enough. The output I'm looking for is "0.00001", not...
6
by: Jay | last post by:
I need to convert from a string a double that is followed by a scaling character (k means *1e3, M=*1e6, etc) then apply the scaling character. Example: "-1.345k #comment" I know roughly how...
4
by: b4ukiran | last post by:
Hi all, I have a requirement to print large double values without the exponential notaion. The double value can be a declared variable or any calculated value within the code. In any case, I...
2
by: utab | last post by:
Dear all, On a formatted printing operation that I am trying to accomplish for doubles, I have a question. I would like to print a double, d, and its square, d*d, but I would like to make the...
8
by: pereges | last post by:
Hi, can anyone please tell me what is wrong in this program and why does it keep givng nan as the output(eg. take input as 1.2e+10) ? #include <stdio.h> #define PLANCK 6.626068e10-34 int...
3
ashsa
by: ashsa | last post by:
Hi everyone, I am trying to display a numeric value fetched from an sql server table which is stored in the exponential notation. For eg, 0.08 is getting stored in the table as...
0
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a deposit's report. I created a class to store the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.