Movement against float.init being nan

Dom Disc dominikus at scherkl.de
Sat Aug 20 18:05:59 UTC 2022


On Saturday, 20 August 2022 at 01:01:07 UTC, Walter Bright wrote:
> If there was a NaN value for int, I would have used it as the 
> default. int.min is not really a NaN.

But it should be!
int.min is a notorious bogus value. You can't even use abs() on 
it: it will either give you a different type or return garbage. 
There is not even a working literal for it (at least for 
long.min). So it should never have been a valid value from 
beginning.
The first thing I include in every of my programs is a module 
that define exactly that: an alias to byte/short/int/long that 
takes T.min as invalid value (and uses it as default value) and 
gives T.min+1 as its real min value.


More information about the Digitalmars-d mailing list