I'm just curious if there's a way that d + 1 == d
. If d is a double.
Maybe someone can share some knowledge with me.
Yes, certainly.
class Main {
public static void main(String args[]) {
System.out.println(1.0e52 + 1);
}
}
prints
1.0E52
This will actually be true for numbers with absolute value at least 253, because the mantissa of a double
has 52 bits of precision.