limits.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Boost interval/limits.hpp template implementation file
  2. *
  3. * Copyright 2000 Jens Maurer
  4. * Copyright 2002-2003 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_LIMITS_HPP
  11. #define BOOST_NUMERIC_INTERVAL_LIMITS_HPP
  12. #include <boost/config.hpp>
  13. #include <boost/limits.hpp>
  14. #include <boost/numeric/interval/detail/interval_prototype.hpp>
  15. namespace std {
  16. template<class T, class Policies>
  17. class numeric_limits<boost::numeric::interval<T, Policies> >
  18. : public numeric_limits<T>
  19. {
  20. private:
  21. typedef boost::numeric::interval<T, Policies> I;
  22. typedef numeric_limits<T> bl;
  23. public:
  24. static I min BOOST_PREVENT_MACRO_SUBSTITUTION () BOOST_NOEXCEPT_OR_NOTHROW { return I((bl::min)(), (bl::min)()); }
  25. static I max BOOST_PREVENT_MACRO_SUBSTITUTION () BOOST_NOEXCEPT_OR_NOTHROW { return I((bl::max)(), (bl::max)()); }
  26. static I epsilon() BOOST_NOEXCEPT_OR_NOTHROW { return I(bl::epsilon(), bl::epsilon()); }
  27. BOOST_STATIC_CONSTANT(float_round_style, round_style = round_indeterminate);
  28. BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
  29. static I infinity () BOOST_NOEXCEPT_OR_NOTHROW { return I::whole(); }
  30. static I quiet_NaN() BOOST_NOEXCEPT_OR_NOTHROW { return I::empty(); }
  31. static I signaling_NaN() BOOST_NOEXCEPT_OR_NOTHROW
  32. { return I(bl::signaling_NaN(), bl::signaling_Nan()); }
  33. static I denorm_min() BOOST_NOEXCEPT_OR_NOTHROW
  34. { return I(bl::denorm_min(), bl::denorm_min()); }
  35. private:
  36. static I round_error(); // hide this on purpose, not yet implemented
  37. };
  38. } // namespace std
  39. #endif // BOOST_NUMERIC_INTERVAL_LIMITS_HPP