posted 23 years ago
Hi Varsha.The general rule about rounding is :
round() will give the closest result to the argument passed to it. So from 0.0 to 0.4 it will give 0.0(nearest lower number) and from 0.5 to 1.0 it will give 1.0(nearest higher number).When u give a middle range argument(like 0.5) it will give the next higher number(like 1.0).
For negative numbers , -9 is greater than -9.5 thus u get round(-9.5) as -9 which is nearest higher number.
For -9.6 the nearest lower number is -10.0 thus round(-9.6) is -10.
------------------
Come on in !! Drinks are on the house in the Big Moose Saloon !!
Udayan Naik<BR>Sun Certified Programmer for the Java 2 Platform