Windows compiler doesn't recognize: Isnan(), Isinf(); __DBL_EPSILON__, sort

Windows compiler doesn't recognize: Isnan(), Isinf(); __DBL_EPSILON__, sort

Supposedly, the Intel Math Kernel, which is linked by default, defins isnan(), isinf() etc, but when I try to compile the code with the above functions ( ported from Linux ), I get errors. STL alogs, like 'sort', are not recognized by the compiler either. How can I fix it?

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting - user20090419
Supposedly, the Intel Math Kernel, which is linked by default, defins isnan(), isinf() etc, but when I try to compile the code with the above functions ( ported from Linux ), I get errors. STL alogs, like 'sort', are not recognized by the compiler either. How can I fix it?

No, Math Kernel Library isn't linked by default, and no, isnan() and isinf() aren't part of MKL, they are standard C99 functions. If you attempt compilation in a strict C89 or C++ mode, of course, they won't be available. There is a standard C macro DBL_EPSILON in . The form with the extra underscores is reserved for the internal machinery of the implementation, so that you could, for example, write code which depends on availability of glibc, hoping that it will break in other environments.
As you are having difficulty explaining yourself, an example (source code and compile command) appears to be needed. For example, do you have difficulty with the wikipedia C++ sort examples, using one or another of MSVC or ICL (which version of each)? If you have code which was meant for some ancient non-standard version of g++, but doesn't work with current g++, you would have to fix it to work on current linux or Windows.

Quoting - tim18

No, Math Kernel Library isn't linked by default, and no, isnan() and isinf() aren't part of MKL, they are standard C99 functions. If you attempt compilation in a strict C89 or C++ mode, of course, they won't be available. There is a standard C macro DBL_EPSILON in . The form with the extra underscores is reserved for the internal machinery of the implementation, so that you could, for example, write code which depends on availability of glibc, hoping that it will break in other environments.
As you are having difficulty explaining yourself, an example (source code and compile command) appears to be needed. For example, do you have difficulty with the wikipedia C++ sort examples, using one or another of MSVC or ICL (which version of each)? If you have code which was meant for some ancient non-standard version of g++, but doesn't work with current g++, you would have to fix it to work on current linux or Windows.

You answer clarified a few points. Thank you. But the isinf() problem remains:

For example, the following code compiles under Linux (with either g++ or the Intel compiler) and under Cygwin (g++). The compile command is just < g++ code.cpp >

But it doesn't compile with the Intel C++ compiler for Windows, using the Build Solution method in Visual Studio. Visual C++ has problems with these functions ( isinf() and isnan() ) as well.

What am I missing?

#include "stdafx.h"
#include

using namespace std ;

int _tmain(int argc, _TCHAR* argv[])

// int main(int argc, char *argv[])
{
double x = 1.0;
isinf(x);
isnan(x);
return 0;
}

I included "mathimf.h" to use Intel C++ compiler math library.

// tstcase.cpp

#include

# ifdef __INTEL_COMPILER
# include
# else
# include
# endif

using namespace std ;

int main(int argc, char *argv[])
{
double x = 1.0;
isinf(x);
isnan(x);
return 0;
}

I compiled above using "icl tstcase.cpp" on Windows XP and Intel C++ compiler.

Yes, including did the trick. Thanks!

Leave a Comment

Please sign in to add a comment. Not a member? Join today