Warning, file /include/boost/numeric/interval/detail/ia64_rounding_control.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_NUMERIC_INTERVAL_DETAIL_IA64_ROUNDING_CONTROL_HPP
0011 #define BOOST_NUMERIC_INTERVAL_DETAIL_IA64_ROUNDING_CONTROL_HPP
0012
0013 #if !defined(ia64) && !defined(__ia64) && !defined(__ia64__)
0014 #error This header only works on ia64 CPUs.
0015 #endif
0016
0017 #if defined(__hpux)
0018
0019 # include <fenv.h>
0020
0021 namespace boost {
0022 namespace numeric {
0023 namespace interval_lib {
0024 namespace detail {
0025
0026
0027 struct ia64_rounding_control
0028 {
0029 typedef unsigned int rounding_mode;
0030
0031 static void set_rounding_mode(const rounding_mode& mode) {
0032 fesetround(mode); }
0033 static void get_rounding_mode(rounding_mode& mode) { mode = fegetround(); }
0034
0035 static void downward() { set_rounding_mode(FE_DOWNWARD); }
0036 static void upward() { set_rounding_mode(FE_UPWARD); }
0037 static void to_nearest() { set_rounding_mode(FE_TONEAREST); }
0038 static void toward_zero() { set_rounding_mode(FE_TOWARDZERO); }
0039 };
0040
0041 }
0042
0043 extern "C" {
0044 float rintf(float);
0045 double rint(double);
0046 long double rintl(long double);
0047 }
0048
0049 template<>
0050 struct rounding_control<float>:
0051 detail::ia64_rounding_control
0052 {
0053 static float force_rounding(const float r)
0054 { volatile float _r = r; return _r; }
0055 static float to_int(const float& x) { return rintf(x); }
0056 };
0057
0058 template<>
0059 struct rounding_control<double>:
0060 detail::ia64_rounding_control
0061 {
0062 static const double & force_rounding(const double& r) { return r; }
0063 static double to_int(const double& r) { return rint(r); }
0064 };
0065
0066 template<>
0067 struct rounding_control<long double>:
0068 detail::ia64_rounding_control
0069 {
0070 static const long double & force_rounding(const long double& r) { return r; }
0071 static long double to_int(const long double& r) { return rintl(r); }
0072 };
0073
0074 }
0075 }
0076 }
0077
0078 #undef BOOST_NUMERIC_INTERVAL_NO_HARDWARE
0079
0080 #endif
0081
0082 #endif
0083