Editions Ideas

Dom Disc dominikus at scherkl.de
Sun Dec 14 13:43:55 UTC 2025


On Sunday, 14 December 2025 at 13:27:19 UTC, Dom Disc wrote:
> NaN > 0 is false and NaN <= 0 is also false.
> One can see this as a contradiction, but it isn't.
> So why can not also NaN == 0 and NaN != 0 both be false?
> I would consider this IEEE754 compliant.

I mean, the rule is really easy: Simply any comparison involving 
NaN should result in false. Only the result of the comparison can 
be further processed as boolean expression.

Consider this:

```d
if(a!=a) { /*kill your harddisk*/ }
```

Would you expect this code to ever be executed?

But if you set float a = NaN, then it will!
We should avoid this.



More information about the Digitalmars-d mailing list