Is this just because all bets are off with -ffast-math (i.e. undefined
behaviour) or is there a problem here?
$ g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: <basedir>/src/gcc-4.3.0/configure --disable-multilib
--prefix=<basedir>/gcc-4.3.0 --enable-version-specific-runtime-libs
--enable-__cxa_atexit --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.3.0 (GCC)
//-------------------------------------------------------------------------
#include <limits>
#include <cmath>
#include <iostream>
int main()
{
double x = std::numeric_limits<double>::quiet_NaN();
std::cout << "x = " << x << '\n';
std::cout << " ::nan() " << ( ::isnan(x) ? "nan" : "not nan") << '\n';
std::cout << "std::nan() " << (std::isnan(x) ? "nan" : "not nan") << '\n';
}
//-------------------------------------------------------------------------
1) compiled with g++ -std=c++98 -ffast-math
Output:
-------
x = nan
::nan() nan
std::nan() not nan
2) compiled with g++ -ffast-math
Output:
-------
x = nan
::nan() not nan
std::nan() not nan
3) compiled with g++ -std=c++98 or just g++
Output:
-------
x = nan
::nan() nan
std::nan() nan
--
Lionel B
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus