Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- int main()
- {
- double d = NAN;
- std::cout << isnan(d) << 'n';
- return 0;
- }
- $ g++ -std=c++98 main.cpp; ./a.out
- 1
- $ g++ -std=c++11 main.cpp; ./a.out
- 1
- $ g++ -std=c++14 main.cpp; ./a.out
- 1
- #include <iostream>
- #include <cmath>
- #include <math.h>
- int main()
- {
- double d = NAN;
- std::cout << std::isnan(d) << 'n';
- std::cout << isnan(d) << 'n';
- return 0;
- }
- $ g++ -std=c++98 main.cpp; ./a.out
- 1
- 1
- $ g++ -std=c++11 main.cpp
- main.cpp: In function ‘int main()’:
- main.cpp:10:25: error: ‘isnan’ was not declared in this scope
- std::cout << isnan(d) << 'n';
- ^
- main.cpp:10:25: note: suggested alternative:
- In file included from main.cpp:3:0:
- /usr/include/c++/5/cmath:641:5: note: ‘std::isnan’
- isnan(_Tp __x)
- ^
- $ g++ -std=c++14 main.cpp
- main.cpp: In function ‘int main()’:
- main.cpp:10:25: error: ‘isnan’ was not declared in this scope
- std::cout << isnan(d) << 'n';
- ^
- main.cpp:10:25: note: suggested alternative:
- In file included from main.cpp:3:0:
- /usr/include/c++/5/cmath:641:5: note: ‘std::isnan’
- isnan(_Tp __x)
- ^
- $ clang++-4.0 -std=c++98 main.cpp; ./a.out
- 1
- 1
- $ clang++-4.0 -std=c++11 main.cpp
- main.cpp:10:18: error: use of undeclared identifier 'isnan'
- std::cout << isnan(d) << 'n';
- ^
- 1 error generated.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement