c99_rounding_control.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Boost interval/detail/c99_rounding_control.hpp file
  2. *
  3. * Copyright 2000 Jens Maurer
  4. * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
  5. *
  6. * Distributed under the Boost Software License, Version 1.0.
  7. * (See accompanying file LICENSE_1_0.txt or
  8. * copy at http://www.boost.org/LICENSE_1_0.txt)
  9. */
  10. #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_C99_ROUNDING_CONTROL_HPP
  11. #define BOOST_NUMERIC_INTERVAL_DETAIL_C99_ROUNDING_CONTROL_HPP
  12. #include <boost/numeric/interval/detail/c99sub_rounding_control.hpp>
  13. namespace boost {
  14. namespace numeric {
  15. namespace interval_lib {
  16. template<>
  17. struct rounding_control<float>:
  18. detail::c99_rounding_control
  19. {
  20. static float force_rounding(float const &r)
  21. { volatile float r_ = r; return r_; }
  22. };
  23. template<>
  24. struct rounding_control<double>:
  25. detail::c99_rounding_control
  26. {
  27. static double force_rounding(double const &r)
  28. { volatile double r_ = r; return r_; }
  29. };
  30. template<>
  31. struct rounding_control<long double>:
  32. detail::c99_rounding_control
  33. {
  34. static long double force_rounding(long double const &r)
  35. { volatile long double r_ = r; return r_; }
  36. };
  37. } // namespace interval_lib
  38. } // namespace numeric
  39. } // namespace boost
  40. #undef BOOST_NUMERIC_INTERVAL_NO_HARDWARE
  41. #endif // BOOST_NUMERIC_INTERVAL_DETAIL_C99_ROUNDING_CONTROL_HPP