Re: NaN's origin

Discussion in 'C++' started by Frank Schmitt, Jul 7, 2003.

  1. "Victor Bazarov" <> writes:

    > "klaas" <> wrote...
    > > How does a NaN occur?

    >
    > 0 * infinity, 0/0, infinity + / - infinity.


    This makes me wonder - shouldn't infinity + infinity just
    return infinity?

    regards
    frank

    --
    Frank Schmitt
    4SC AG phone: +49 89 700763-0
    e-mail: frank DOT schmitt AT 4sc DOT com
     
    Frank Schmitt, Jul 7, 2003
    #1
    1. Advertising

  2. "Frank Schmitt" <> wrote...
    > "Victor Bazarov" <> writes:
    >
    > > "klaas" <> wrote...
    > > > How does a NaN occur?

    > >
    > > 0 * infinity, 0/0, infinity + / - infinity.

    >
    > This makes me wonder - shouldn't infinity + infinity just
    > return infinity?


    You're right. Different sources tell different stories.
    I wasn't using any IEEE-certified document, just some web
    site. Another site claims the same except inf + inf. That
    does allegedly result in infinity.

    Victor
     
    Victor Bazarov, Jul 7, 2003
    #2
    1. Advertising

  3. Frank Schmitt

    Pete Becker Guest

    Victor Bazarov wrote:
    >
    > "Frank Schmitt" <> wrote...
    > > "Victor Bazarov" <> writes:
    > >
    > > > "klaas" <> wrote...
    > > > > How does a NaN occur?
    > > >
    > > > 0 * infinity, 0/0, infinity + / - infinity.

    > >
    > > This makes me wonder - shouldn't infinity + infinity just
    > > return infinity?

    >
    > You're right. Different sources tell different stories.
    > I wasn't using any IEEE-certified document, just some web
    > site. Another site claims the same except inf + inf. That
    > does allegedly result in infinity.
    >


    Infinities are usually signed. My recollection is that under IEEE-754,
    positive infinity + positive infinity is positive infinity; negative
    infinity + negative infinity is negative infinity. When the signs of the
    infinities are different the result is NaN.

    --

    Pete Becker
    Dinkumware, Ltd. (http://www.dinkumware.com)
     
    Pete Becker, Jul 8, 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. Nicol Nghia
    Replies:
    0
    Views:
    361
    Nicol Nghia
    Dec 3, 2005
  2. Walter

    Re: NaN's origin

    Walter, Jul 1, 2003, in forum: C++
    Replies:
    0
    Views:
    361
    Walter
    Jul 1, 2003
  3. E. Robert Tisdale

    Re: NaN's origin

    E. Robert Tisdale, Jul 1, 2003, in forum: C++
    Replies:
    0
    Views:
    438
    E. Robert Tisdale
    Jul 1, 2003
  4. max(NaN,0) should be NaN

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

Share This Page