A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
rounding a double to two decimals
Joined: Dec 06, 2000
Jan 27, 2002 20:03:00
Can some one tell me how to round a double number to nearest two decimal. Math.round method just round it into long.
Thanks in advance.
Marilyn de Queiroz
Joined: Jul 22, 2000
Jan 27, 2002 22:31:00
You could multiply the double by 100, round it, and then divide by 100.0 That's one way.
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I agree. Here's the link:
subject: rounding a double to two decimals
How to round a double to two decimal place?
Rounding Doubles to Two Decimal Places
One Question Quiz for Newcomers
rounding a fraction+time
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013