File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Certification
»
Programmer Certification (SCJP/OCPJP)
Author
preserve double precision
Saritha Reddy
Greenhorn
Joined: Jun 17, 2004
Posts: 8
posted
Jul 21, 2005 00:42:00
0
Hi,
I declared a variable double as
double d=5;
d=d+0.00;
when I print it, I get as 5.0.I want 5.00.
Can some one help me how to preserve the precition
Thaks in advance
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
posted
Jul 21, 2005 02:05:00
0
Check
java.text.DecimalFormat
class
NumberFormat nf = new DecimalFormat("0.00"); System.out.println(nf.format(d));
Mani
Quaerendo Invenietis
Tony Morris
Ranch Hand
Joined: Sep 24, 2003
Posts: 1608
posted
Jul 21, 2005 02:59:00
0
http://qa.jtiger.org/GetQAndA.action?qids=46&showAnswers=true
Tony Morris
Java Q&A (FAQ, Trivia)
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: preserve double precision
Similar Threads
UBB code quote
Rotating buffered image
equation problem
Wrapper class
addition accuracy
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter