3 ms·
> 0 being the only good choice Devil's advocate: why not a maximum integer like 18446744073709551615 or 9223372036854775807? 0 looks like a valid number, whil
by otabdeveloper2 8y ago
> 0 being the only good choice
Devil's advocate: why not a maximum integer like 18446744073709551615 or 9223372036854775807?
0 looks like a valid number, while 18446744073709551615 is an obvious NaN for any programmer looking at the output.
- spooneybarger 8y agoPony core team member here. In some domains it might be. In others it might not. It's no more right or wrong in my mind. I think the size of the integer needs to be considered in your thinking as well: If you have unsigned 8 bit integers, the max value is 255, is that really going seem NaN? How about 127 for a signed 8 bit integer? And, should the result of division by zero vary based on the bit size of the integer? That's a discussion unto itself.