Movement against float.init being nan
Dark Hole
dark.hole1 at yandex.ru
Sun Aug 21 11:13:02 UTC 2022
On Sunday, 21 August 2022 at 03:25:57 UTC, Walter Bright wrote:
> On 8/20/2022 6:19 AM, Hipreme wrote:
>> I don't see how easier it is to track a nan. Division by zero
>> causes exception which is the best thing ever. Multiplication
>> produces a zero result, which is pretty obvious to track. If
>> the number does not change you will pretty much print both
>> values and you'll easily find the 0 there.
>
> x * NaN => NaN
> x / NaN => NaN
> x + NaN => NaN
> x - NaN => NaN
> -Nan => NaN
> cos(NaN) => NaN
> exp(NaN) => NaN
>
> Only a subset of this is true for 0.
Imagine, we have nullable int (int?) in language.
```d
int? x => null
x * null => null
x / null => null
x + null => null
x - null => null
-cast(int?)null => null
```
Seems like perfect solution (except performance costs)
More information about the Digitalmars-d
mailing list