A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
formatting double value
Joined: Apr 09, 2008
Mar 25, 2009 03:16:39
can someone please help me out ,
i want to parse double to precision length of 4 digit after '.'
so can anyone tell me what to do to get
thanks in advance.
Joined: Oct 27, 2005
Mar 25, 2009 03:33:38
Use %.4f or %1.4f
The .4 indicates the number of decimals.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
Joined: Oct 13, 2005
Mar 25, 2009 04:39:31
Rob is correct; the problem was that you have the .4 bit after the s.
But you will never get 12.3456 from that number. It will be rounded to 12.3457. You would have to round down, possibly using methods of the
I agree. Here's the link:
subject: formatting double value
Assignments .PLS HLP ME !!!!!
Whats wrong with system.err?
Just finished my first java program :-) Can you please give me suggestions on making my code better?
Dividing a double value produces different results
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013