This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes round Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "round " Watch "round " New topic
Author

round

deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56
hi,

I need to round eg: 16.490000000000002 to 16.49 (rounded up to the nearest 0.05) i tried this
Math.ceil(value/0.05)*0.05

considering 0.05 as round factor ,but its still the same. Any help is appreciated.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Look at the java.text.DecimalFormat class.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: round
 
Similar Threads
Rounded up to the nearest 0.05
coding problem about Sales Taxes
Rounding decimal number to nearest 0.05
rounding off in java
Rounding off numbers?