fork(2) download
  1. #include <iostream>
  2. #include <limits>
  3.  
  4. int main()
  5. {
  6. std::cout << "float, double, long double" << std::endl;
  7.  
  8. std::cout << "sizeof = "
  9. << sizeof( float) << ", "
  10. << sizeof( double) << ", "
  11. << sizeof(long double) << std::endl;
  12.  
  13. std::cout << "digits = "
  14. << std::numeric_limits< float>::digits << ", "
  15. << std::numeric_limits< double>::digits << ", "
  16. << std::numeric_limits<long double>::digits << std::endl;
  17.  
  18. std::cout << "digits10 = "
  19. << std::numeric_limits< float>::digits10 << ", "
  20. << std::numeric_limits< double>::digits10 << ", "
  21. << std::numeric_limits<long double>::digits10 << std::endl;
  22.  
  23. std::cout << "max_digits10 = "
  24. << std::numeric_limits< float>::max_digits10 << ", "
  25. << std::numeric_limits< double>::max_digits10 << ", "
  26. << std::numeric_limits<long double>::max_digits10 << std::endl;
  27.  
  28. std::cout << "min_exponent10 = "
  29. << std::numeric_limits< float>::min_exponent10 << ", "
  30. << std::numeric_limits< double>::min_exponent10 << ", "
  31. << std::numeric_limits<long double>::min_exponent10 << std::endl;
  32.  
  33. std::cout << "max_exponent10 = "
  34. << std::numeric_limits< float>::max_exponent10 << ", "
  35. << std::numeric_limits< double>::max_exponent10 << ", "
  36. << std::numeric_limits<long double>::max_exponent10 << std::endl;
  37.  
  38. std::cout << "epsilon = "
  39. << std::numeric_limits< float>::epsilon() << ", "
  40. << std::numeric_limits< double>::epsilon() << ", "
  41. << std::numeric_limits<long double>::epsilon() << std::endl;
  42.  
  43. std::cout << "min = "
  44. << std::numeric_limits< float>::min() << ", "
  45. << std::numeric_limits< double>::min() << ", "
  46. << std::numeric_limits<long double>::min() << std::endl;
  47.  
  48. std::cout << "lowest = "
  49. << std::numeric_limits< float>::lowest() << ", "
  50. << std::numeric_limits< double>::lowest() << ", "
  51. << std::numeric_limits<long double>::lowest() << std::endl;
  52.  
  53. std::cout << "max = "
  54. << std::numeric_limits< float>::max() << ", "
  55. << std::numeric_limits< double>::max() << ", "
  56. << std::numeric_limits<long double>::max() << std::endl;
  57. }
  58.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
float, double, long double
sizeof = 4, 8, 12
digits = 24, 53, 64
digits10 = 6, 15, 18
max_digits10 = 9, 17, 21
min_exponent10 = -37, -307, -4931
max_exponent10 = 38, 308, 4932
epsilon = 1.19209e-07, 2.22045e-16, 1.0842e-19
min = 1.17549e-38, 2.22507e-308, 3.3621e-4932
lowest = -3.40282e+38, -1.79769e+308, -1.18973e+4932
max = 3.40282e+38, 1.79769e+308, 1.18973e+4932