The following code will print 'false'.
float f = 1.0F/3.0F;
System.out.println( (f * 3.0F) == 1.0F );
Options :
1) True
2) False
Answer : false..
I feel it should be true because when 1 is divided by 3 it gives 0.33333....i.e 0.334 and when we multiply 0.334 by 3.000 we get 1.002....i.e 1
Hence it should be true..
Any Comments???
Sonir
float f = 1.0F/3.0F;
System.out.println( (f * 3.0F) == 1.0F );
Options :
1) True
2) False
Answer : false..
I feel it should be true because when 1 is divided by 3 it gives 0.33333....i.e 0.334 and when we multiply 0.334 by 3.000 we get 1.002....i.e 1
Hence it should be true..
Any Comments???
Sonir