Types.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef MANDEL_TYPES_H
  2. #define MANDEL_TYPES_H
  3. #include <cinttypes>
  4. #include <cmath>
  5. #ifdef WITH_BOOST
  6. # include <boost/multiprecision/cpp_bin_float.hpp>
  7. # if defined(__GNUC__) || defined(__INTEL_COMPILER)
  8. # include <boost/multiprecision/float128.hpp>
  9. # endif
  10. # include <boost/multiprecision/cpp_int.hpp>
  11. #endif
  12. namespace mnd
  13. {
  14. #ifdef WITH_BOOST
  15. #if defined(__GNUC__) || defined(__INTEL_COMPILER)
  16. using Float128 = boost::multiprecision::float128;
  17. #else
  18. using Float128 = boost::multiprecision::cpp_bin_float_quad;
  19. #endif
  20. inline Float128 abs(const Float128& x) { return boost::multiprecision::abs(x); }
  21. inline Float128 floor(const Float128& x) { return boost::multiprecision::floor(x); }
  22. inline Float128 log(const Float128& x) { return boost::multiprecision::log(x); }
  23. using Real = Float128;
  24. using Integer = boost::multiprecision::int128_t;
  25. #else
  26. using Real = double;
  27. using Integer = int64_t;
  28. #endif
  29. inline double abs(double x) { return ::abs(x); }
  30. inline float abs(float x) { return ::abs(x); }
  31. inline double floor(double x) { return ::floor(x); }
  32. inline float floor(float x) { return ::floorf(x); }
  33. inline double log(double x) { return ::log(x); }
  34. inline float log(float x) { return ::logf(x); }
  35. }
  36. #endif // MANDEL_TYPES_H