www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - comparison operators !< !<> ...

↑ ↓ ← Heinz Saathoff <hsaat despammed.com> writes:
Hello,

I just had a look at math.h and found the macros for isgreater, isless 
and some others. The definition of isgreater is

  #define isgreater(x,y)   !((x) !> (y))

Are these !op comparison operators DMC-extension (I didn't find any 
reference to these elsewhere)? It seems that !op negates the result of 
the comparison, so that

    a !> b    is the same as    !(a > b)

Is this right? If so, why have you extended the standard operators?


- Heinz
Sep 08 2005
↑ ↓ "Walter Bright" <newshound digitalmars.com> writes:
"Heinz Saathoff" <hsaat despammed.com> wrote in message
news:MPG.1d8a0089f315b39d9896f1 news.digitalmars.com...
 I just had a look at math.h and found the macros for isgreater, isless
 and some others. The definition of isgreater is

   #define isgreater(x,y)   !((x) !> (y))

 Are these !op comparison operators DMC-extension (I didn't find any
 reference to these elsewhere)? It seems that !op negates the result of
 the comparison, so that

     a !> b    is the same as    !(a > b)

 Is this right?

Yes.
 If so, why have you extended the standard operators?

Back around 1990 or so, there was a group called NCEG (Numerical C Extensions Group) that was interested in fixing C's deficiencies at numerical computing. They produced an excellent proposal for doing this, and I implemented all of it. Unfortunately for C, it was never adopted by the C standard, though parts of it did find their way into the C99 standard. You can find the documentation for them at www.digitalmars.com/ctg/ctgNumerics.html
Sep 08 2005
↑ ↓ → Heinz Saathoff <hsaat despammed.com> writes:
Walter Bright schrieb...
 I just had a look at math.h and found the macros for isgreater, isless
 and some others. The definition of isgreater is

   #define isgreater(x,y)   !((x) !> (y))

 Are these !op comparison operators DMC-extension (I didn't find any
 reference to these elsewhere)? It seems that !op negates the result of
 the comparison, so that

     a !> b    is the same as    !(a > b)

 Is this right?

Yes.
 If so, why have you extended the standard operators?

Back around 1990 or so, there was a group called NCEG (Numerical C Extensions Group) that was interested in fixing C's deficiencies at numerical computing. They produced an excellent proposal for doing this, and I implemented all of it. Unfortunately for C, it was never adopted by the C standard, though parts of it did find their way into the C99 standard. You can find the documentation for them at www.digitalmars.com/ctg/ctgNumerics.html

Thanks. I will have a look on that article. - Heinz
Sep 08 2005