UNIX's int isnan(double x) routine for Windows/Visual C/C++ 6.0 ?

Discussion in 'C Programming' started by Skybuck Flying, Jul 5, 2004.

  1. Hi,

    I have one more remaining "problem" with compiling a unix source code for
    windows/visual c/c++ 6.0

    What does the isnan routine do ?

    Documentation says it checks for NaN ? What does that mean ?

    What is a good replacement for Visual C/C++ 6.0 ?

    Bye,
    Skybuck
     
    Skybuck Flying, Jul 5, 2004
    #1
    1. Advertising

  2. Re: [OT] UNIX's int isnan(double x) routine for Windows/Visual C/C++ 6.0 ?

    Skybuck Flying wrote:
    >
    > What does the isnan routine do ?
    >
    > Documentation says it checks for NaN ? What does that mean ?


    As I understand it:

    The IEEE 754-1985 standard defines ways of representing floating point
    values as binary numbers. One bit-pattern called NaN ("not a number") is a
    special case; it is used to represent values that don't have a valid
    representation in the IEEE format (for example, square root of a negative
    number).

    Many (but not all) implementations of C abide by the IEEE standard for
    representing floating point numbers.

    The Single Unix Specification defines the C function isnan. You pass it a
    double, and it tells you if the value is NaN (i.e., it returns a nonzero
    value if the parameter is NaN, 0 if it is not). (For systems that have the
    isnan function but don't support NaN values, isnan always returns 0.)

    > What is a good replacement for Visual C/C++ 6.0 ?


    The Microsoft C library seems to have a function called _isnan (note the
    leading underscore) that works like the Unix function isnan. However, it is
    declared in the header <float.h> instead of <math.h>.

    Anyway, that's my understanding. I'm not an expert on these issues. IEEE
    754-1985, the Single Unix Specification, and Microsoft C implementation are
    off-topic for this newsgroup. See the welcome message:

    http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html

    If you want more information, you'd be better off directing your queries to
    another newsgroup.

    --
    Russell Hanneken

    Use ROT13 to decode my email address.
     
    Russell Hanneken, Jul 5, 2004
    #2
    1. Advertising

  3. Skybuck Flying

    Richard Bos Guest

    Re: [OT] UNIX's int isnan(double x) routine for Windows/Visual C/C++ 6.0 ?

    "Russell Hanneken" <> wrote:

    > Skybuck Flying wrote:
    > >
    > > What does the isnan routine do ?
    > >
    > > Documentation says it checks for NaN ? What does that mean ?

    >
    > As I understand it:
    >
    > The IEEE 754-1985 standard defines ways of representing floating point
    > values as binary numbers. One bit-pattern called NaN ("not a number") is a
    > special case; it is used to represent values that don't have a valid
    > representation in the IEEE format (for example, square root of a negative
    > number).
    >
    > Many (but not all) implementations of C abide by the IEEE standard for
    > representing floating point numbers.
    >
    > The Single Unix Specification defines the C function isnan.


    More on-topic, C99 defines a macro with that name, with the expected
    semantics. This may not be useful for VC 6.0.

    Richard
     
    Richard Bos, Jul 6, 2004
    #3
  4. "Skybuck Flying" <> wrote in message news:<cccg0k$gi2$1.nb.home.nl>...
    > Hi,
    >
    > I have one more remaining "problem" with compiling a unix source code for
    > windows/visual c/c++ 6.0
    >
    > What does the isnan routine do ?
    >
    > Documentation says it checks for NaN ? What does that mean ?
    >
    > What is a good replacement for Visual C/C++ 6.0 ?
    >
    > Bye,
    > Skybuck


    In C99, the isnan() macro, defined in <math.h>, is nonzero if its
    argument is a NaN (not-a-number).

    Floating-point numbers can be classified into one of the following
    categories: normal nonzero numbers, subnormal nonzero numbers, zero,
    infinity, and not-a-numbers (bit sequences that do not represent any
    number).

    One way of representing the macro in C99 is:

    #define isnan(_X) (fpclassify(_X)==FP_NAN)

    It would be nice if M$ provided a C99-compatible <math.h> that had a
    C99-compatible fpclassify() macro and FP_NAN for the above to make
    sense.

    Gregory Pietsch
     
    Gregory Pietsch, Jul 16, 2004
    #4
  5. Skybuck Flying

    kal Guest

    "Skybuck Flying" <> wrote in message news:<cccg0k$gi2$1.nb.home.nl>...

    > What does the isnan routine do ?
    >
    > Documentation says it checks for NaN ? What does that mean ?
    >
    > What is a good replacement for Visual C/C++ 6.0 ?


    Try "_isnan" function declared in <float.h>
     
    kal, Jul 16, 2004
    #5
  6. Skybuck Flying

    Guest

    Re: UNIX's int isnan(double x) routine for Windows/Visual C/C++ 6.0?

    Gregory Pietsch wrote:
    > "Skybuck Flying" <> wrote in message news:<cccg0k$gi2$1.nb.home.nl>...
    >
    >>Hi,
    >>
    >>I have one more remaining "problem" with compiling a unix source code for
    >>windows/visual c/c++ 6.0
    >>
    >>What does the isnan routine do ?
    >>
    >>Documentation says it checks for NaN ? What does that mean ?
    >>
    >>What is a good replacement for Visual C/C++ 6.0 ?


    C/C++ interpreter Ch has a good support for C99 complex, IEEE-754
    floating-point arithmetic, generic mathematical functions, VLA etc.
    It works in windows, linux, solaris, HP-UX, MacOSX and FreeBSD.

    You can google search to find it.

    >>
    >>Bye,
    >> Skybuck

    >
    >
    > In C99, the isnan() macro, defined in <math.h>, is nonzero if its
    > argument is a NaN (not-a-number).
    >
    > Floating-point numbers can be classified into one of the following
    > categories: normal nonzero numbers, subnormal nonzero numbers, zero,
    > infinity, and not-a-numbers (bit sequences that do not represent any
    > number).
    >
    > One way of representing the macro in C99 is:
    >
    > #define isnan(_X) (fpclassify(_X)==FP_NAN)
    >
    > It would be nice if M$ provided a C99-compatible <math.h> that had a
    > C99-compatible fpclassify() macro and FP_NAN for the above to make
    > sense.
    >
    > Gregory Pietsch
     
    , Jul 17, 2004
    #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. Sydex
    Replies:
    12
    Views:
    6,507
    Victor Bazarov
    Feb 17, 2005
  2. Schnoffos
    Replies:
    2
    Views:
    1,223
    Martien Verbruggen
    Jun 27, 2003
  3. Hal Styli
    Replies:
    14
    Views:
    1,650
    Old Wolf
    Jan 20, 2004
  4. Skybuck Flying

    UNIX's nrand48() routine for Windows/Visual C/C++ 6.0 ?

    Skybuck Flying, Jul 5, 2004, in forum: C Programming
    Replies:
    12
    Views:
    876
    Nitin Bhardwaj
    Jul 8, 2004
  5. Shriramana Sharma
    Replies:
    8
    Views:
    275
    Gerhard Fiedler
    Jun 18, 2013
Loading...

Share This Page