Why is (18446744073709551615 == -1) true?
18,446,744,073,709,551,615 This number mentioned, 18,446,744,073,709,551,615, is actually 2^64 − 1. The important thing here is that 2^64-1 is essentially 0-based 2^64. The first digit of an unsigned integer is 0, not 1. So if the maximum value is 1, it has two possible values: 0, or 1 (2). Let’s look at 2^64 – 1 in … Read more