PPL  1.2
Coefficient_types.hh
Go to the documentation of this file.
1 /* Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
2  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
3 
4 This file is free software; as a special exception the author gives
5 unlimited permission to copy and/or distribute it, with or without
6 modifications, as long as this notice is preserved.
7 
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. */
12 
13 #ifndef PPL_Coefficient_types_hh
14 #define PPL_Coefficient_types_hh 1
15 
16 #include "Checked_Number_defs.hh"
17 
18 #ifdef PPL_GMP_INTEGERS
19 #include "GMP_Integer_types.hh"
20 #endif
21 
22 #if defined(PPL_CHECKED_INTEGERS) || defined(PPL_NATIVE_INTEGERS)
23 
24 namespace Parma_Polyhedra_Library {
25 
27 
28 struct Bounded_Integer_Coefficient_Policy {
30  const_bool_nodef(check_overflow, true);
31 
33  const_bool_nodef(check_inf_add_inf, false);
34 
36  const_bool_nodef(check_inf_sub_inf, false);
37 
39  const_bool_nodef(check_inf_mul_zero, false);
40 
42  const_bool_nodef(check_div_zero, false);
43 
45  const_bool_nodef(check_inf_div_inf, false);
46 
48  const_bool_nodef(check_inf_mod, false);
49 
51  const_bool_nodef(check_sqrt_neg, false);
52 
54  const_bool_nodef(has_nan, false);
55 
57  const_bool_nodef(has_infinity, false);
58 
63  const_bool_nodef(convertible, true);
64 
67 
69  const_bool_nodef(fpu_check_nan_result, true);
70 
75  static const Rounding_Dir ROUND_DEFAULT_CONSTRUCTOR = ROUND_NATIVE;
76 
81  static const Rounding_Dir ROUND_DEFAULT_OPERATOR = ROUND_NATIVE;
82 
87  static const Rounding_Dir ROUND_DEFAULT_INPUT = ROUND_NATIVE;
88 
93  static const Rounding_Dir ROUND_DEFAULT_OUTPUT = ROUND_NATIVE;
94 
99  static const Rounding_Dir ROUND_DEFAULT_FUNCTION = ROUND_NATIVE;
100 
105  static void handle_result(Result r);
106 };
107 
108 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
109 
111 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
112 template <typename Policy>
113 struct Coefficient_traits_template<Checked_Number<int8_t, Policy> > {
115  typedef Checked_Number<int8_t, Policy> const_reference;
116 };
117 
118 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
119 
121 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
122 template <typename Policy>
123 struct Coefficient_traits_template<Checked_Number<int16_t, Policy> > {
125  typedef Checked_Number<int16_t, Policy> const_reference;
126 };
127 
128 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
129 
131 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
132 template <typename Policy>
133 struct Coefficient_traits_template<Checked_Number<int32_t, Policy> > {
135  typedef Checked_Number<int32_t, Policy> const_reference;
136 };
137 
138 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
139 
141 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
142 template <typename Policy>
143 struct Coefficient_traits_template<Checked_Number<int64_t, Policy> > {
145  typedef const Checked_Number<int64_t, Policy>& const_reference;
146 };
147 
148 } // namespace Parma_Polyhedra_Library
149 
150 #endif // defined(PPL_CHECKED_INTEGERS) || defined(PPL_NATIVE_INTEGERS)
151 
152 namespace Parma_Polyhedra_Library {
153 
155 
172 typedef PPL_COEFFICIENT_TYPE Coefficient;
173 
174 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
175 
177 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
179 
180 } // namespace Parma_Polyhedra_Library
181 
182 #endif // !defined(PPL_Coefficient_types_hh)
Coefficient_traits_template< Coefficient > Coefficient_traits
An alias for easily naming the coefficient traits.
Rounding_Dir
Rounding directions for arithmetic computations.
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
#define const_bool_nodef(name, value)
Declares a per-class constant of type bool, called name and with value value.
int fpu_check_inexact()
Queries the inexact computation status.
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
The entire library is confined to this namespace.
Definition: version.hh:61