File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes need Math.round(double) help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "need Math.round(double) help" Watch "need Math.round(double) help" New topic

need Math.round(double) help

Charlie Petrie

Joined: Jun 26, 2002
Posts: 10
I'm trying to round out a double (15,045) to the nearest 100 (i.e. 15,000). The reason I'm rounding out a double is because in an earlier calculation I needed to use a double to use the Math.pow(double, double) method. So now I'm left with a double that I want to round out but all I can find is Math.round(double) which returns a long and in any case doesn't do anything for me in trying to only get the nearest 100. Thanks.
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
heres one way to do it, its quick and dirty, so maybe you can think of a better way, and maybe i made a mistake

I agree. Here's the link:
subject: need Math.round(double) help
It's not a secret anymore!