A Philosophy of Software Design

Walter Bright newshound2 at digitalmars.com
Mon May 25 17:28:29 UTC 2026


On 5/25/2026 5:14 AM, Dom Disc wrote:
> This is why I always suggested a NaN value for all types. For signed integers 
> the unfortunate T.min (0x80..00) which has no positive counterpart is the 
> perfect candidate for NaN. Unsigned types doesn't have such a good candidate - 
> for sure, most calculations that try to prevent overflows are very unlikely to 
> return 0xFF..FF as result, nevertheless this is a valid result. So defining 
> T.max as NaN is possible but ugly.

Unfortunately, since integer arithmetic may use T.min, it's not going to work as 
a NaN value.


More information about the Digitalmars-d mailing list