www.digitalmars.com         C & C++   DMDScript  

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

reply 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
parent reply "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
parent 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