I was referring this Oracle documentation. While trying to execute the following,
public static void main(String args[]){
float f = 1.1f;
double df = 1.1f;
System.out.println("f=" + f);
System.out.println("df=" + df);
f = 1.5f;
df = 1.5f;
System.out.println("f=" + f);
System.out.println("df=" + df);
}
Output is
f = 1.1
df = 1.100000023841858
f = 1.5
df = 1.5
Why the second line of output is showing an approximate value. But not for fourth line. How the value is getting calculated?