[Issue 13489] Boolean semantics of floating point types should use "<> 0"
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Oct 9 07:13:28 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13489
Dicebot <public at dicebot.lv> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |public at dicebot.lv
--- Comment #13 from Dicebot <public at dicebot.lv> ---
(In reply to monarchdodra from comment #12)
> (In reply to Don from comment #11)
> > But I am certain that the current behaviour, that assert(NaN) passes, is
> > wrong.
>
> Agreed. It was my understanding anyways that anything that operates on NaN
> produces "false" anyways.
>
> I'd expect *both*:
> assert( NaN);
> assert(!NaN;
>
> to fail, actually, since the fist one is "Are you non 0? No" and the second
> is "Are you 0? No."
I agree with this.
One additional thing to point out is that `assert` has already a precedent of
being more than just check for 0 - it calls object invariant. Thus meaning of
`assert(object)` is closer to "check if this thing is in usable state" and NaN
is not a usable state by definition.
--
More information about the Digitalmars-d-bugs
mailing list