473,799 Members | 2,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 15642
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.tilbu 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
Nov 14 '05 #4
kal
"Skybuck Flying" <no****@hotmail .com> wrote in message news:<cc******* ***@news5.tilbu 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>
Nov 14 '05 #5
Gregory Pietsch wrote:
"Skybuck Flying" <no****@hotmail .com> wrote in message news:<cc******* ***@news5.tilbu 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 ?

Documentati on 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
3283
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 in a strunct. There is a function in a DLL that takes this struct. This struct comes from a Visual Basic application. My code changes this string.
2
1844
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 page seems to say that only Visual Studio/Borland ide's are supported--I assume that debugging can only be done in these ide's? Can I use 2 separate qt-supported IDEs on Solaris ( K-develop ) and Windows ( Visual Studio .NET ), but use qmake as...
13
2167
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 the college class would use the same software in the classroom as that provided on the CD. Not so. Anyway, I got MS C++ 6.0. If you want to read the final problem, skip to step 18. 1-17 leads up to how I get there however. Here is the steps...
5
3844
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; for(j=i+1;j<=n;j++) sum -= a*b; b=sum/a;
12
5943
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 problem is with nrand48(). Apperently the UNIX system has this routine nrand48() in <stdlib.h>
3
8708
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 accuracy. I've gotten to the point where I now need even more precision in my timers. Many unix platforms have a function gettimeofday() which has microsecond accuracy, but this function is not available on Windows, apparently. Question: Is...
1
5333
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 anynody with experience using gsl under windows (perhaps matlab and mex / or visual c++) and can tell me how to use compiler-commands? (i think that's my problem or perhaps path-declaration.?) did you have another simple example for me?
3
1868
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
3838
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 windows directory tree to mimic the unix tree as closely as possible, but I don't want duplicate files and other inconsistencies. I have come up with an idea but I don't know how close it fits a "typical" windows project. If you know of specific...
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10482
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.