C99 comparison macro's

Discussion in 'C Programming' started by Serve La, Oct 11, 2003.

  1. Serve La

    Serve La Guest

    Now that implementations are becoming available, I've started to
    learn more about C99.
    Now I was reading about the isgreater/isgreaterequal/isless/...
    macro's and I'm wondering about why they are here? What's the
    difference with the normal relational operators?
     
    Serve La, Oct 11, 2003
    #1
    1. Advertising

  2. In article <>, Serve La wrote:
    > Now that implementations are becoming available, I've started to
    > learn more about C99.
    > Now I was reading about the isgreater/isgreaterequal/isless/...
    > macro's and I'm wondering about why they are here? What's the
    > difference with the normal relational operators?



    The macros does not, according to the standard, raise the
    "invalid" floating-point exception when the arguments are
    unordered (one of them is NaN). According to the rationale, the
    macros were chosen instead of new operators like ?<, ?<=, ?>=,
    and ?> since new operators for florating-point only would be a
    too great a change to the base language. The macros do not work
    with integers, since there is no NaN integer.

    --
    Andreas Kähäri
     
    Andreas Kahari, Oct 11, 2003
    #2
    1. Advertising

  3. Serve La <> wrote:

    >Now that implementations are becoming available, I've started to
    >learn more about C99.
    >Now I was reading about the isgreater/isgreaterequal/isless/...
    >macro's and I'm wondering about why they are here? What's the
    >difference with the normal relational operators?


    From ISO/IEC 9899:1999 Annex F.3:

    [...]
    The relational and equality operators provide IEC 60559 comparisons.
    IEC 60559 identifies a need for additional comparison predicates to
    facilitate writing code that accounts for NaNs. The comparison macros
    (isgreater, isgreaterequal, isless, islessequal, islessgreater, and
    isunordered) in <math.h> supplement the language operators to address
    this need. The islessgreater and isunordered macros provide respectively
    a quiet version of the <> predicate and the unordered predicate
    recommended in the Appendix to IEC 60559.

    Regards
    --
    Irrwahn
    ()
     
    Irrwahn Grausewitz, Oct 11, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Giannis Papadopoulos

    Comparison between C89 and C99

    Giannis Papadopoulos, Aug 4, 2005, in forum: C Programming
    Replies:
    3
    Views:
    4,297
    Randy Howard
    Aug 4, 2005
  2. Replies:
    3
    Views:
    3,756
    Chris Torek
    Feb 20, 2006
  3. Replies:
    3
    Views:
    626
    Keith Thompson
    Mar 31, 2007
  4. Guillaume Dargaud

    On use of C99 __func__ macro

    Guillaume Dargaud, Dec 5, 2007, in forum: C Programming
    Replies:
    10
    Views:
    915
    Tor Rustad
    Dec 9, 2007
  5. Deepu
    Replies:
    1
    Views:
    266
    ccc31807
    Feb 7, 2011
Loading...

Share This Page