I am doing following in java- 1- Multiplying a floating point with 10 till the time its fractional part become zero. 2- tested this with
number%1 == 0 // fails here
Prob I am facing- e.g input value is .12 iter-1 .12*10 = 1.199999 iter-2 .12*100 = 12.010** // were expecting fraction as zero here
Expected-
iter-1 .12*10 = 1.2
iter-2 .12*100 = 12.0
What are the ways I can get the same as expected.