== Quote from bearophile ([email protected])'s article > The following comes partially from a friend of mine. If you are busy you can skip this post of musings. > From the docs: > http://www.digitalmars.com/d/1.0/faq.html#nan > >Because of the way CPUs are designed, there is no NaN value for integers, so > >D uses 0 instead. It doesn't have the advantages of error detection that NaN has, but at least errors resulting from unintended default initializations will be consistent and therefore more debuggable.< > Seeing how abs(int.min) gives problems, and seeing how CPUs manage nans of FPs efficiently enough, it can be nice for int.min to become the nan of integers (and similar for short, long, and maybe tiny too). Such nan may also be useful for purposes similar to nullable integers of C#. > Bye, > bearophile
This is IMHO (at least at first glance) a reasonable idea in the very long run. However, it isn't practical here and now for D2, because NaN behavior is implemented partly in hardware, and mathematically undefined integer operations throw hardware exceptions instead of returning int.nan on current hardware.
