Movement against float.init being nan

Dom Disc dominikus at scherkl.de
Sat Aug 20 22:49:18 UTC 2022


On Saturday, 20 August 2022 at 18:47:29 UTC, Paul Backus wrote:
> On Saturday, 20 August 2022 at 18:05:59 UTC, Dom Disc wrote:
>> 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.
>
> By the way, you don't have to write this yourself; you can use 
> Checked!(int, WithNaN) [1] from std.checkedint.
>
> [1] https://phobos.dpldocs.info/std.checkedint.WithNaN.html

I know. I like my implementation better, but that's not the point.
My point is: I include this in EVERY of my programs and never use 
other signed integers (unsigned values I use for 
bit-manipulation, not for calculations). checkedint should simply 
BE the int type, not a module.



More information about the Digitalmars-d mailing list