Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Though it is printing true but I am surprised with the answer.In my opinion it should be false because dividing 1.0f/3.0f will give a resulting float with somevalue like .33333... Again multiplying this number by 3 will not print 1..(will be slightly less than one).
First I apologize for the explaination.....answer is correct but explaination is not satisfiable...I'm apologize all for that.
Mathematically you are right........Sanjeev, but if you print(f*3.0F) its printing 1.0 why because as of Java 5 our JVM is considering 0.99999999 as 1.0 so when we devide 1.0 by 3.0 it will be 0.33333333..... when again we multiply this factor by 3.0 then the answer is 0.99999999... Mathematically we can't prdict the no.of 9's but our JVM is having limitation of memory. Thats why its considering it 1.0 and printing true.......!
This is how I think about it...any other views about it.. always welcome....!