Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. double d = NAN;
  7.  
  8. std::cout << isnan(d) << 'n';
  9.  
  10. return 0;
  11. }
  12.  
  13. $ g++ -std=c++98 main.cpp; ./a.out
  14. 1
  15.  
  16. $ g++ -std=c++11 main.cpp; ./a.out
  17. 1
  18.  
  19. $ g++ -std=c++14 main.cpp; ./a.out
  20. 1
  21.  
  22. #include <iostream>
  23. #include <cmath>
  24. #include <math.h>
  25.  
  26. int main()
  27. {
  28. double d = NAN;
  29.  
  30. std::cout << std::isnan(d) << 'n';
  31. std::cout << isnan(d) << 'n';
  32.  
  33. return 0;
  34. }
  35.  
  36. $ g++ -std=c++98 main.cpp; ./a.out
  37. 1
  38. 1
  39.  
  40. $ g++ -std=c++11 main.cpp
  41. main.cpp: In function ‘int main()’:
  42. main.cpp:10:25: error: ‘isnan’ was not declared in this scope
  43. std::cout << isnan(d) << 'n';
  44. ^
  45. main.cpp:10:25: note: suggested alternative:
  46. In file included from main.cpp:3:0:
  47. /usr/include/c++/5/cmath:641:5: note: ‘std::isnan’
  48. isnan(_Tp __x)
  49. ^
  50.  
  51. $ g++ -std=c++14 main.cpp
  52. main.cpp: In function ‘int main()’:
  53. main.cpp:10:25: error: ‘isnan’ was not declared in this scope
  54. std::cout << isnan(d) << 'n';
  55. ^
  56. main.cpp:10:25: note: suggested alternative:
  57. In file included from main.cpp:3:0:
  58. /usr/include/c++/5/cmath:641:5: note: ‘std::isnan’
  59. isnan(_Tp __x)
  60. ^
  61.  
  62. $ clang++-4.0 -std=c++98 main.cpp; ./a.out
  63. 1
  64. 1
  65.  
  66. $ clang++-4.0 -std=c++11 main.cpp
  67. main.cpp:10:18: error: use of undeclared identifier 'isnan'
  68. std::cout << isnan(d) << 'n';
  69. ^
  70. 1 error generated.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement