limits.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  13. #include <boost/config.hpp>
  14. #include <boost/limits.hpp>
  15. #include <boost/numeric/interval/detail/interval_prototype.hpp>
  16. namespace std {
  17. template<class T, class Policies>
  18. class numeric_limits<boost::numeric::interval<T, Policies> >
  19. : public numeric_limits<T>
  20. {
  21. private:
  22. typedef boost::numeric::interval<T, Policies> I;
  23. typedef numeric_limits<T> bl;
  24. public:
  25. static I min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return I((bl::min)(), (bl::min)()); }
  26. static I max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return I((bl::max)(), (bl::max)()); }
  27. static I epsilon() throw() { return I(bl::epsilon(), bl::epsilon()); }
  28. BOOST_STATIC_CONSTANT(float_round_style, round_style = round_indeterminate);
  29. BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
  30. static I infinity () throw() { return I::whole(); }
  31. static I quiet_NaN() throw() { return I::empty(); }
  32. static I signaling_NaN() throw()
  33. { return I(bl::signaling_NaN(), bl::signaling_Nan()); }
  34. static I denorm_min() throw()
  35. { return I(bl::denorm_min(), bl::denorm_min()); }
  36. private:
  37. static I round_error(); // hide this on purpose, not yet implemented
  38. };
  39. } // namespace std
  40. #endif
  41. #endif // BOOST_NUMERIC_INTERVAL_LIMITS_HPP