jukaukor

Boost_float128.cpp

Jun 30th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include <boost/cstdfloat.hpp> // For float_64_t, float128_t. Must be first include!
  2. #include <boost/math/special_functions/gamma.hpp>
  3. #include <cmath>
  4. #include <stdlib.h>
  5. #include <cinttypes>
  6. #include <iostream>
  7.  
  8. int main()
  9. {
  10.  
  11.  
  12. boost::float128_t b = 2;
  13. //std::cout << std::numeric_limits<float128_t>::digits << std::endl;
  14. std::cout.precision(std::numeric_limits<boost::float128_t>::digits10);
  15. //std::cout << std::numeric_limits<float128_t>::digits10 << std::endl;
  16. std::cout.setf(std::ios_base::showpoint); // Include any trailing zeros.
  17. std::cout.precision(std::numeric_limits<boost::float128_t>::digits10);
  18. std::cout<< log(b) << std::endl; // Shows log(2) = 0.693147180559945309417232121458176575
  19. std::cout << boost::math::tgamma(b) << std::endl;
  20. //std::numeric_limits<float128_t>::max_digits10 = 36
  21. //boost::float128_t pi = 3.14159265358979323846264338327950288Q;
  22. constexpr boost::float128_t pi = 3.14159265358979323846264338327950288Q;
  23. std::cout << "pi = " << pi << std::endl; //pi = 3.14159265358979323846264338327950280
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment