To see the exact value of your float, you can use a BigDecimal:
float x = 0.98123452f;
System.out.println(new BigDecimal(x));
which outputs: 0.981234490871429443359375
float x = 0.98123452f;
System.out.println(new BigDecimal(x));
which outputs: 0.981234490871429443359375
So technically, this float:
float x = 0.981234490871429443359375f;
System.out.println(new BigDecimal(x)); //prints 0.981234490871429443359375
has 24 digits precision (it was obviously cherry-picked)...
So technically, this floatForget what is above:
float x = 0.981234490871429443359375f;
System.out.println(new BigDecimal(x)); //prints 0.981234490871429443359375
BigDecimal only has 24 digits precision (ita double constructor so there was obviously cherry-picked)..a cast to double and the logic above is flawed.
Bottom line: not all numbers can be represented as a float and the gap between one float and the next one varies depending on the magnitude of the number.