annotate DEPENDENCIES/generic/include/boost/numeric/interval/detail/c99sub_rounding_control.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /* Boost interval/detail/c99sub_rounding_control.hpp file
Chris@16 2 *
Chris@16 3 * Copyright 2000 Jens Maurer
Chris@16 4 * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
Chris@16 5 *
Chris@16 6 * Distributed under the Boost Software License, Version 1.0.
Chris@16 7 * (See accompanying file LICENSE_1_0.txt or
Chris@16 8 * copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 */
Chris@16 10
Chris@16 11 #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_C99SUB_ROUNDING_CONTROL_HPP
Chris@16 12 #define BOOST_NUMERIC_INTERVAL_DETAIL_C99SUB_ROUNDING_CONTROL_HPP
Chris@16 13
Chris@16 14 #include <boost/detail/fenv.hpp> // ISO C 99 rounding mode control
Chris@16 15
Chris@16 16 namespace boost {
Chris@16 17 namespace numeric {
Chris@16 18 namespace interval_lib {
Chris@16 19 namespace detail {
Chris@16 20
Chris@16 21 extern "C" { double rint(double); }
Chris@16 22
Chris@16 23 struct c99_rounding_control
Chris@16 24 {
Chris@16 25 typedef int rounding_mode;
Chris@16 26
Chris@16 27 static void set_rounding_mode(rounding_mode mode) { fesetround(mode); }
Chris@16 28 static void get_rounding_mode(rounding_mode &mode) { mode = fegetround(); }
Chris@16 29 static void downward() { set_rounding_mode(FE_DOWNWARD); }
Chris@16 30 static void upward() { set_rounding_mode(FE_UPWARD); }
Chris@16 31 static void to_nearest() { set_rounding_mode(FE_TONEAREST); }
Chris@16 32 static void toward_zero() { set_rounding_mode(FE_TOWARDZERO); }
Chris@16 33
Chris@16 34 template<class T>
Chris@16 35 static T to_int(const T& r) { return rint(r); }
Chris@16 36 };
Chris@16 37
Chris@16 38 } // namespace detail
Chris@16 39 } // namespace interval_lib
Chris@16 40 } // namespace numeric
Chris@16 41 } // namespace boost
Chris@16 42
Chris@16 43 #endif // BOOST_NUMERIC_INTERVAL_DETAIL_C99SUB_ROUBDING_CONTROL_HPP