Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Andrei Alexandrescu
Hello, I think the floating-point operators: a !<>= b a !<> b a <> b a <>= b a !> b a !>= b a !< b a !<= b are useless. A simple peephole optimization in the compiler can automatically rewrite NaN test followed by regular operations into the operations above, for example: i

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Denis Koroskin
On Sun, 17 May 2009 21:14:46 +0400, Andrei Alexandrescu wrote: > Hello, > > > I think the floating-point operators: > >a !<>= b >a !<> b >a <> b >a <>= b >a !> b >a !>= b >a !< b >a !<= b > > are useless. A simple peephole optimization in the compiler can > auto

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Denis Koroskin wrote: > On Sun, 17 May 2009 21:14:46 +0400, Andrei Alexandrescu > wrote: > >> Hello, >> >> >> I think the floating-point operators: >> >>a !<>= b >>a !<> b >>a <> b >>a <>= b >>a !> b >>a !>= b >>a !< b >>

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > Hello, > I think the floating-point operators: >a !<>= b >a !<> b >a <> b >a <>= b >a !> b >a !>= b >a !< b >a !<= b > are useless. A simple peephole optimization in the compiler can > auto

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Jason House
Andrei Alexandrescu Wrote: > Hello, > > > I think the floating-point operators: > >a !<>= b >a !<> b >a <> b >a <>= b >a !> b >a !>= b >a !< b >a !<= b > > are useless. A simple peephole optimization in the compiler can > automatically rewrite NaN test followed

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Michiel Helvensteijn
Andrei Alexandrescu wrote: > I think the floating-point operators: > >a !<>= b >a !<> b >a <> b >a <>= b >a !> b >a !>= b >a !< b >a !<= b > > are useless. Actually, I like the concept of comparison operators for partial orders. When I first read the D1 specs, th

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Don
Denis Koroskin wrote: On Sun, 17 May 2009 21:14:46 +0400, Andrei Alexandrescu wrote: Hello, I think the floating-point operators: a !<>= b a !<> b a <> b a <>= b a !> b a !>= b a !< b a !<= b are useless. A simple peephole optimization in the compiler can automat

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Don
dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Hello, I think the floating-point operators: a !<>= b a !<> b a <> b a <>= b a !> b a !>= b a !< b a !<= b are useless. A simple peephole optimization in the compiler can automatica

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread BCS
Hello Don, But unfortunately, in solving an obscure corner case, the IEEE standard destroyed one of the most basic axioms in mathematics. But math deals with numbers (for the most part) and as the name says NaN is Not a Numebr. (Not that I think it is or isn't a bad idea, I'm not in a posit

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread grauzone
By the way, why is it that the is operator has the same behavior as == regarding NaNs? IMHO is should just compare the values bitwise.

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Andrei Alexandrescu
Don wrote: dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Hello, I think the floating-point operators: a !<>= b a !<> b a <> b a <>= b a !> b a !>= b a !< b a !<= b are useless. A simple peephole optimization in the compiler ca

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Michiel Helvensteijn
Michiel Helvensteijn wrote: > There's this thing, though. I would make it so !(a op b) is equivalent to > (a !op b). It's a nice property. The IEEE standard requires that you set a > certain exception flag when comparing with a NaN value, right? Well, just > set the flag with the extra operators a

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-17 Thread Andrei Alexandrescu
Don wrote: Inclusion of the NCEG operators was a bit of tokenism, making a _very_ strong statement that D took numerical programmers seriously. But I think D's at the point where it can make that statement without relying on tokenism. So is it ok to yank them? Andrei

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-18 Thread Lionello Lunesu
a <> b It's an old wish of mine that this be used for the invocation of opCmp (instead of opEquals), returning an int, and valid for struct/class/built-ins/etc... (like perl's <=>, I think) As for the other operators, I never used them and I don't think I would use them ever often enough

Re: Eliminate the baroque floating-point operators a la !<>=

2009-05-18 Thread Don
Andrei Alexandrescu wrote: Don wrote: Inclusion of the NCEG operators was a bit of tokenism, making a _very_ strong statement that D took numerical programmers seriously. But I think D's at the point where it can make that statement without relying on tokenism. So is it ok to yank them? And