Hi, I thought Math.ceil and floor returns double NOT int. but I came across couple of questions saying that it returns int. I ran the code myself. it returns double.. Can someone confirm, please? Thanks
Sean <br />SCJP2, SCJP2p1.4, SCWCD
Sudhir Bangera
Ranch Hand
Joined: Oct 10, 2000
Posts: 50
posted
0
Hi Sean, Sun's API documentation says that ceil(double a) Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer.
floor(double a) Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer. http://java.sun.com/j2se/1.3/docs/api/index.html Hence it should return double... HTH....
Udayan Naik
Ranch Hand
Joined: Oct 18, 2000
Posts: 135
posted
0
Hi Sean . The ceil and floor methods of Math class return INTEGRAL values as double values and not primitive type int.Thus if u say floor(13.2) it will return 13.0 , which is an integral value(13) converted to a double value , i.e 13.0. I hope I have been clear enough. ------------------ Come on in !! Drinks are on the house in the Big Moose Saloon !!
Udayan Naik<BR>Sun Certified Programmer for the Java 2 Platform
sean cee
Ranch Hand
Joined: Oct 24, 2000
Posts: 115
posted
0
Thanks guys.. So it won't return 13 . right? 13.0 instead...