Re: NaN

Discussion in 'C Programming' started by HENRY Eshbaugh, Aug 29, 2011.

  1. IME the NaN is the result of an error raised when you try to operate
    on it.

    But that's just Python talking.
     
    HENRY Eshbaugh, Aug 29, 2011
    #1
    1. Advertising

  2. HENRY Eshbaugh

    James Kuyper Guest

    On 08/29/2011 08:49 AM, HENRY Eshbaugh wrote:
    > IME the NaN is the result of an error raised when you try to operate
    > on it.
    >
    > But that's just Python talking.


    Your subject line contains "Re:", implying that it's a response to some
    other message with a Subject: of "NaN". However, your message headers
    don't indicate which message it's a response to, and a Google Groups
    search turns up no obvious candidates. Is this just a random comment?

    It would be more appropriate to say that a NaN indicates a special case,
    rather than an error. You can write code that detects the special case,
    and avoids performing a calculation that might otherwise result in
    creation of a NaN. However, when using a system known to produce
    non-signaling NaN's when appropriate, it can be entirely appropriate to
    write code which relies upon that behavior (it can also be a big
    mistake, depending upon the context). It's often more convenient to deal
    with special cases by detecting a NaN, rather than by avoiding creation
    of the NaN.
     
    James Kuyper, Aug 29, 2011
    #2
    1. Advertising

  3. On Aug 29, 6:42 pm, James Kuyper <> wrote:
    >
    > It would be more appropriate to say that a NaN indicates a special case,
    > rather than an error.
    >

    Nan's a bit like null pointer. It sounds rather specialised, but once
    you have it, you use it in all sorts of places.
     
    Malcolm McLean, Aug 29, 2011
    #3
  4. HENRY Eshbaugh

    James Kuyper Guest

    On 08/29/2011 02:27 PM, Malcolm McLean wrote:
    > On Aug 29, 6:42 pm, James Kuyper <> wrote:
    >>
    >> It would be more appropriate to say that a NaN indicates a special case,
    >> rather than an error.
    >>

    > Nan's a bit like null pointer. It sounds rather specialised, but once
    > you have it, you use it in all sorts of places.


    I think you're using "specialized" in a different sense than I was. When
    I said that a NaN indicates a special case, I was referring to the fact
    that expressions which are permitted (or required, if __STDC_IEC_559__
    is pre#defined by the implementation) to have a value of NaN can
    generally do so only for special values of their operands: acos(2.0),
    log(-1.0), pow(-1.0, 0.5), tgamma(-1.0), fmod(0.0, 0.0).
     
    James Kuyper, Aug 29, 2011
    #4
  5. On Aug 29, 11:42 am, James Kuyper <> wrote:
    > On 08/29/2011 08:49 AM, HENRY Eshbaugh wrote:
    >
    > > IME the NaN is the result of an error raised when you try to operate
    > > on it.

    >
    > > But that's just Python talking.

    >
    > Your subject line contains "Re:", implying that it's a response to some
    > other message with a Subject: of "NaN". However, your message headers
    > don't indicate which message it's a response to, and a Google Groups
    > search turns up no obvious candidates. Is this just a random comment?
    >
    > It would be more appropriate to say that a NaN indicates a special case,
    > rather than an error. You can write code that detects the special case,
    > and avoids performing a calculation that might otherwise result in
    > creation of a NaN. However, when using a system known to produce
    > non-signaling NaN's when appropriate, it can be entirely appropriate to
    > write code which relies upon that behavior (it can also be a big
    > mistake, depending upon the context). It's often more convenient to deal
    > with special cases by detecting a NaN, rather than by avoiding creation
    > of the NaN.


    No, I fucked up replying. Slip-up.
     
    HENRY Eshbaugh, Aug 30, 2011
    #5
  6. On Aug 30, 7:09 am, HENRY Eshbaugh <> wrote:
    >
    > No, I ----- up replying. Slip-up.
    >

    Please. We're mostly educated professionals here, and we like to keep
    up standards.
     
    Malcolm McLean, Aug 30, 2011
    #6
    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. DiscoStu
    Replies:
    9
    Views:
    782
    Harald Hein
    Aug 5, 2003
  2. kt
    Replies:
    3
    Views:
    40,317
    Betty
    Apr 22, 2005
  3. Replies:
    7
    Views:
    5,593
    Googmeister
    Sep 8, 2005
  4. max(NaN,0) should be NaN

    , Aug 28, 2006, in forum: C Programming
    Replies:
    61
    Views:
    1,302
    Michel Hack
    Sep 8, 2006
  5. Replies:
    6
    Views:
    1,618
    Richard Tobin
    Mar 19, 2009
Loading...

Share This Page