- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have observed recently (I am using latest update of Intel compilers i.e., version Intel(R) oneAPI DPC++/C++ Compiler 2024.1.0 (2024.1.0.20240308)) that icpx returns warning when compiling a simple code that used "isnan" std function and the warning is:
warning: explicit comparison with NaN in fast floating point mode [-Wtautological-constant-compare]
The code I use for testing is:
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
int main() {
int xxx;
xxx = sqrt(-1);
auto b = std::isnan(xxx);
cout << "b is: " << b << endl;
return 0;
}
Is there any way to modify my code to avoid getting this warning? GNU compilers do not show such warning.
Regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DPC++/C++ compiler is LLVM base. So, clang++ should give a warning on the same code as well.
For floating point, fast mode is on by default with icpx
If you don't want to see the warning message, you can compile with -fp-model strict/precise or with -Wno-tautological-constant-compare flag.
Here is link to clang++ https://godbolt.org/z/bv746h51r
Thanks,
Viet
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DPC++/C++ compiler is LLVM base. So, clang++ should give a warning on the same code as well.
For floating point, fast mode is on by default with icpx
If you don't want to see the warning message, you can compile with -fp-model strict/precise or with -Wno-tautological-constant-compare flag.
Here is link to clang++ https://godbolt.org/z/bv746h51r
Thanks,
Viet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot. I had included "-fp-model precise" in the Makefile but I had to change it to "-fp-model=precise" and now the warning is gone.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page