File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

preserve double precision

 
Saritha Reddy
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check java.text.DecimalFormat class

 
Tony Morris
Ranch Hand
Posts: 1608
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic