473,398 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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

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
Nov 14 '05 #1
5 15612
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/bchambl...me_to_clc.html

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

--
Russell Hanneken
eu*******@cbobk.pbz
Use ROT13 to decode my email address.

Nov 14 '05 #2
"Russell Hanneken" <me@privacy.net> 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
Nov 14 '05 #3
"Skybuck Flying" <no****@hotmail.com> wrote in message news:<cc**********@news5.tilbu1.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
Nov 14 '05 #4
kal
"Skybuck Flying" <no****@hotmail.com> wrote in message news:<cc**********@news5.tilbu1.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>
Nov 14 '05 #5
Gregory Pietsch wrote:
"Skybuck Flying" <no****@hotmail.com> wrote in message news:<cc**********@news5.tilbu1.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

Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Yelve Yakut | last post by:
Hello, I am currently messing around with some sample code I found It is about linking VB and CPP through DLL's http://www.flipcode.com/articles/article_vbdlls.shtml There is a string embaded...
2
by: isaac | last post by:
Sorry in advance if this is the incorrect board, but I couldn't find a better-targeted one. I want an IDE that supports building and debugging C++/qt on both Windows and Solaris. The Qt/Windows...
13
by: George | last post by:
I hate to bug you old timers and pros that use C++. So if you will spare me a small moment then I be out of your hair. I am taking a C++ class and got this CD with the book. You would think...
5
by: mma | last post by:
I have been using the lubksb routine in Visual C++ 6.0 and noticed what looks like an error to me. The last section of the method looks like this: for(i=n;i>=1;i--) { sum=b;...
12
by: Skybuck Flying | last post by:
Hello, I have a little piece of C source code which was probably made on a UNIX system. I would like to try and compile/build this source code on/for Windows XP with Visual C/C++ 6.0. The...
3
by: noleander | last post by:
Hi. I'm doing some speed optimization on my Visual C++ program. I'm using timers throughout the program. I'm calling ftime() which works well, but only returns current time to a millisecond...
1
by: MiMu | last post by:
hallo! i wanne use gsl under windows (visual c++, mex (matlab)). when i try to compile my little exeample (from gsl web-site) i will get a linker-error: undefined reference. so, is there...
3
by: Micky G | last post by:
Hey Guys: I know there is a pragma (compiler directive) for pointer_size for gcc on unix; does anyone know if there one on Windows (Visual Studio) too? Thanks! MickyG
1
RRick
by: RRick | last post by:
I have a unix C++ project that needs to be converted over to windows visual studio. I'm not sure of the exact version of VS, but it's a recent version, probabIy 2003 or 2005. I would like the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.