It has been said in K&B that in round(),if the number after the decimal point is greater than or equal to 0.5 then Math.round() is equal to Math.ceil()
The output is -4. How come the output is -4 it should be -3 .Am i right.
the easiest trick is ... Math.round(-3.5) is -3 ceil the number if -'ve fraction is <=5. Math.round(-3.6) is -4 floor the number if -'ve fraction is >=5. Math.round(3.5) is 4 The reverse strategy applies for +'ve fractions
i.e floor the number if +'ve fraction is <=5 & ceil the number if +'ve fraction is >5
Javainn<br /> <br />SCJP,SCWCD,SCBCD,<br />ICED (IBM-287,IBM-484,IBM-486)
IBM certified in DB2 V 8.1 Family Fundamentals (IBM 700)