this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at develop 140 lines 5.9 kB view raw
1/* Boost interval/rounded_transc.hpp template implementation file 2 * 3 * Copyright 2002-2003 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion 4 * 5 * Distributed under the Boost Software License, Version 1.0. 6 * (See accompanying file LICENSE_1_0.txt or 7 * copy at http://www.boost.org/LICENSE_1_0.txt) 8 */ 9 10#ifndef GECODE_BOOST_NUMERIC_INTERVAL_ROUNDED_TRANSC_HPP 11#define GECODE_BOOST_NUMERIC_INTERVAL_ROUNDED_TRANSC_HPP 12 13#include <gecode/third-party/boost/numeric/interval/rounding.hpp> 14#include <gecode/third-party/boost/numeric/interval/detail/bugs.hpp> 15#include <gecode/third-party/boost/config/no_tr1/cmath.hpp> 16 17namespace gecode_boost { 18namespace numeric { 19namespace interval_lib { 20 21template<class T, class Rounding> 22struct rounded_transc_exact: Rounding 23{ 24# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 25 T f##_down(const T& x) { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); return f(x); } \ 26 T f##_up (const T& x) { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); return f(x); } 27 GECODE_BOOST_NUMERIC_INTERVAL_new_func(exp) 28 GECODE_BOOST_NUMERIC_INTERVAL_new_func(log) 29 GECODE_BOOST_NUMERIC_INTERVAL_new_func(sin) 30 GECODE_BOOST_NUMERIC_INTERVAL_new_func(cos) 31 GECODE_BOOST_NUMERIC_INTERVAL_new_func(tan) 32 GECODE_BOOST_NUMERIC_INTERVAL_new_func(asin) 33 GECODE_BOOST_NUMERIC_INTERVAL_new_func(acos) 34 GECODE_BOOST_NUMERIC_INTERVAL_new_func(atan) 35 GECODE_BOOST_NUMERIC_INTERVAL_new_func(sinh) 36 GECODE_BOOST_NUMERIC_INTERVAL_new_func(cosh) 37 GECODE_BOOST_NUMERIC_INTERVAL_new_func(tanh) 38# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 39# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 40 T f##_down(const T& x) { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); return f(x); } \ 41 T f##_up (const T& x) { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); return f(x); } 42 GECODE_BOOST_NUMERIC_INTERVAL_new_func(asinh) 43 GECODE_BOOST_NUMERIC_INTERVAL_new_func(acosh) 44 GECODE_BOOST_NUMERIC_INTERVAL_new_func(atanh) 45# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 46}; 47 48template<class T, class Rounding> 49struct rounded_transc_std: Rounding 50{ 51# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 52 T f##_down(const T& x) \ 53 { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); \ 54 this->downward(); return this->force_rounding(f(x)); } \ 55 T f##_up (const T& x) \ 56 { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); \ 57 this->upward(); return this->force_rounding(f(x)); } 58 GECODE_BOOST_NUMERIC_INTERVAL_new_func(exp) 59 GECODE_BOOST_NUMERIC_INTERVAL_new_func(log) 60 GECODE_BOOST_NUMERIC_INTERVAL_new_func(sin) 61 GECODE_BOOST_NUMERIC_INTERVAL_new_func(cos) 62 GECODE_BOOST_NUMERIC_INTERVAL_new_func(tan) 63 GECODE_BOOST_NUMERIC_INTERVAL_new_func(asin) 64 GECODE_BOOST_NUMERIC_INTERVAL_new_func(acos) 65 GECODE_BOOST_NUMERIC_INTERVAL_new_func(atan) 66 GECODE_BOOST_NUMERIC_INTERVAL_new_func(sinh) 67 GECODE_BOOST_NUMERIC_INTERVAL_new_func(cosh) 68 GECODE_BOOST_NUMERIC_INTERVAL_new_func(tanh) 69# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 70# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 71 T f##_down(const T& x) \ 72 { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); \ 73 this->downward(); return this->force_rounding(f(x)); } \ 74 T f##_up (const T& x) \ 75 { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); \ 76 this->upward(); return this->force_rounding(f(x)); } 77 GECODE_BOOST_NUMERIC_INTERVAL_new_func(asinh) 78 GECODE_BOOST_NUMERIC_INTERVAL_new_func(acosh) 79 GECODE_BOOST_NUMERIC_INTERVAL_new_func(atanh) 80# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 81}; 82 83template<class T, class Rounding> 84struct rounded_transc_opp: Rounding 85{ 86# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 87 T f##_down(const T& x) \ 88 { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); \ 89 this->downward(); T y = this->force_rounding(f(x)); \ 90 this->upward(); return y; } \ 91 T f##_up (const T& x) \ 92 { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); \ 93 return this->force_rounding(f(x)); } 94 GECODE_BOOST_NUMERIC_INTERVAL_new_func(exp) 95 GECODE_BOOST_NUMERIC_INTERVAL_new_func(log) 96 GECODE_BOOST_NUMERIC_INTERVAL_new_func(cos) 97 GECODE_BOOST_NUMERIC_INTERVAL_new_func(acos) 98 GECODE_BOOST_NUMERIC_INTERVAL_new_func(cosh) 99# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 100# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 101 T f##_down(const T& x) \ 102 { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); \ 103 return -this->force_rounding(-f(x)); } \ 104 T f##_up (const T& x) \ 105 { GECODE_BOOST_NUMERIC_INTERVAL_using_math(f); \ 106 return this->force_rounding(f(x)); } 107 GECODE_BOOST_NUMERIC_INTERVAL_new_func(sin) 108 GECODE_BOOST_NUMERIC_INTERVAL_new_func(tan) 109 GECODE_BOOST_NUMERIC_INTERVAL_new_func(asin) 110 GECODE_BOOST_NUMERIC_INTERVAL_new_func(atan) 111 GECODE_BOOST_NUMERIC_INTERVAL_new_func(sinh) 112 GECODE_BOOST_NUMERIC_INTERVAL_new_func(tanh) 113# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 114# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 115 T f##_down(const T& x) \ 116 { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); \ 117 this->downward(); T y = this->force_rounding(f(x)); \ 118 this->upward(); return y; } \ 119 T f##_up (const T& x) \ 120 { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); \ 121 return this->force_rounding(f(x)); } 122 GECODE_BOOST_NUMERIC_INTERVAL_new_func(asinh) 123 GECODE_BOOST_NUMERIC_INTERVAL_new_func(atanh) 124# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 125# define GECODE_BOOST_NUMERIC_INTERVAL_new_func(f) \ 126 T f##_down(const T& x) \ 127 { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); \ 128 return -this->force_rounding(-f(x)); } \ 129 T f##_up (const T& x) \ 130 { GECODE_BOOST_NUMERIC_INTERVAL_using_ahyp(f); \ 131 return this->force_rounding(f(x)); } 132 GECODE_BOOST_NUMERIC_INTERVAL_new_func(acosh) 133# undef GECODE_BOOST_NUMERIC_INTERVAL_new_func 134}; 135 136} // namespace interval_lib 137} // namespace numeric 138} // namespace gecode_boost 139 140#endif // GECODE_BOOST_NUMERIC_INTERVAL_ROUNDED_TRANSC_HPP