0

A PROBLEM WITH A FLOAT NUMBER

float a = 1.1f; System.out.println( a > 1.1 ); Why does it prints a true? i think it supposed to print a false

16th Jan 2020, 9:07 AM
Cruz R
Cruz R - avatar
1 Resposta
+ 7
If you write a number like 1.1, it should automatically be a double instead of a float. Floats and doubles both have a little inaccuracy, but to a different degree, so the result can slightly differ.
16th Jan 2020, 9:28 AM
HonFu
HonFu - avatar