Mock Exam: What is displayed when the following is executed: double d1 = -0.5; System.out.println("Ceil d1 = " + Math.ceil(d1)); System.out.println("floor d1 = " + Math.floor(d1)); Answer: -0.0, -1.0. I compiled and run, it is true. So what is the difference between -0.0 and 0.0?
Hi Ego... 0.0 & -0.0 : 1. they both are Floating Point Literals. 2. they considered equal when you use (0.0 == -0.0) 3. but produce different result when used in some calculation. for example : (1.0/0.0) produces positive invinity, and (1.0/-0.0) produces negative invinity. hope this help stevie
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, that will fit in a stocking