Dump special floating point operators
Don
nospam at nospam.com
Fri Dec 4 00:15:13 PST 2009
Walter Bright wrote:
> !<>=
> <>
> <>=
> !<=
> !<
> !>=
> !>
> !>=
>
> http://www.digitalmars.com/d/2.0/expression.html#RelExpression
>
> While I like them a lot, it's time for them to go:
>
> 1. It's hard to remember which one does what
> 2. They've failed to catch on
> 3. No operator overloading for them
> 4. They are only rarely needed; a special operator is not justified
I think I've used them more than anyone else, and I agree. What I've
noticed is that you _always_ want to treat NaNs as a special case. In
asm, you can have a 3-way branch: eg,
cmp a, b;
jp L_nan;
jl L_less;
Lgreater_eq: // a >= b
L_less: // a < b
L_nan: // a or b is NaN.
But the NCEG operators don't let you do that. They only allow you to
chose which way NaNs should go. In almost all cases, you can replace
a!>b with !(a<=b), so the cases where they are beneficial are very, very
limited.
Currently one use is in CTFE:
isNaN(x) doesn't work in CTFE at the moment, whereas x<>=0 does. But of
course isNaN should work in CTFE.
More information about the Digitalmars-d
mailing list