Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Non-standard Math functions invsqrt* Removed from "math.h" from Intel(R) C++ Compiler 18.0

$
0
0

Starting from Intel(R) C++ Compiler 18.0, Intel's "math.h" will only contain functions required in C99/C11 standard. For non-standard math functions include invsqrt, invsqrtf, invsqrtl, they have been moved to Intel specific math header "mathimf.h".

Developers who have called those non-standard functions from "math.h" in previous versions, will encounter compiler errors like following after upgrade to 18.0:

../pair_tersoff_intel.cpp(1375): error: no instance of overloaded function "invsqrt" matches the argument list
            argument types are: (float)
    fvec rikinv = invsqrt(rsq2);
                  ^

There are two ways to resolve the compiler errors:

1. Change to include "mathimf.h" for Intel Compiler.

#ifdef __INTEL_COMPILER
#include <mathimf.h>
#endif

 

2. Declare those functions by yourself. For example, for C++ code, declare:

extern double invsqrt(double __x);
extern float invsqrtf(float __x);

Then compile and link with icc to link with Intel(R) Math Library.

 


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>