1 /* Coefficient types of weakly-relational domains: declarations.
2    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3    Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_WRD_coefficient_types_defs_hh
25 #define PPL_WRD_coefficient_types_defs_hh 1
26 
27 #include "meta_programming.hh"
28 
29 namespace Parma_Polyhedra_Library {
30 
31 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
32 /*! \ingroup PPL_CXX_interface \brief
33   The production policy for checked numbers used in weakly-relational
34   domains.
35  */
36 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
37 struct WRD_Extended_Number_Policy {
38   //! Check for overflowed result.
39   const_bool_nodef(check_overflow, true);
40 
41   //! Do not check for attempts to add infinities with different sign.
42   const_bool_nodef(check_inf_add_inf, false);
43 
44   //! Do not check for attempts to subtract infinities with same sign.
45   const_bool_nodef(check_inf_sub_inf, false);
46 
47   //! Do not check for attempts to multiply infinities by zero.
48   const_bool_nodef(check_inf_mul_zero, false);
49 
50   //! Do not check for attempts to divide by zero.
51   const_bool_nodef(check_div_zero, false);
52 
53   //! Do not check for attempts to divide infinities.
54   const_bool_nodef(check_inf_div_inf, false);
55 
56   //! Do not check for attempts to compute remainder of infinities.
57   const_bool_nodef(check_inf_mod, false);
58 
59   //! Do not checks for attempts to take the square root of a negative number.
60   const_bool_nodef(check_sqrt_neg, false);
61 
62   //! Handle not-a-number special value.
63   const_bool_nodef(has_nan, true);
64 
65   //! Handle infinity special values.
66   const_bool_nodef(has_infinity, true);
67 
68   // `convertible' is intentionally not defined: the compile time
69   // error on conversions is the expected behavior.
70 
71   //! Honor requests to check for FPU inexact results.
72   const_bool_nodef(fpu_check_inexact, true);
73 
74   //! Do not make extra checks to detect FPU NaN results.
75   const_bool_nodef(fpu_check_nan_result, false);
76 
77   // ROUND_DEFAULT_CONSTRUCTOR is intentionally not defined.
78   // ROUND_DEFAULT_OPERATOR is intentionally not defined.
79   // ROUND_DEFAULT_FUNCTION is intentionally not defined.
80   // ROUND_DEFAULT_INPUT is intentionally not defined.
81   // ROUND_DEFAULT_OUTPUT is intentionally not defined.
82 
83   /*! \brief
84     Handles \p r: called by all constructors, operators and functions that
85     do not return a Result value.
86   */
87   static void handle_result(Result r);
88 };
89 
90 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
91 /*! \ingroup PPL_CXX_interface \brief
92   The debugging policy for checked numbers used in weakly-relational
93   domains.
94  */
95 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
96 struct Debug_WRD_Extended_Number_Policy {
97   //! Check for overflowed result.
98   const_bool_nodef(check_overflow, true);
99 
100   //! Check for attempts to add infinities with different sign.
101   const_bool_nodef(check_inf_add_inf, true);
102 
103   //! Check for attempts to subtract infinities with same sign.
104   const_bool_nodef(check_inf_sub_inf, true);
105 
106   //! Check for attempts to multiply infinities by zero.
107   const_bool_nodef(check_inf_mul_zero, true);
108 
109   //! Check for attempts to divide by zero.
110   const_bool_nodef(check_div_zero, true);
111 
112   //! Check for attempts to divide infinities.
113   const_bool_nodef(check_inf_div_inf, true);
114 
115   //! Check for attempts to compute remainder of infinities.
116   const_bool_nodef(check_inf_mod, true);
117 
118   //! Checks for attempts to take the square root of a negative number.
119   const_bool_nodef(check_sqrt_neg, true);
120 
121   //! Handle not-a-number special value.
122   const_bool_nodef(has_nan, true);
123 
124   //! Handle infinity special values.
125   const_bool_nodef(has_infinity, true);
126 
127   // `convertible' is intentionally not defined: the compile time
128   // error on conversions is the expected behavior.
129 
130   //! Honor requests to check for FPU inexact results.
131   const_bool_nodef(fpu_check_inexact, true);
132 
133   //! Make extra checks to detect FPU NaN results.
134   const_bool_nodef(fpu_check_nan_result, true);
135 
136   // ROUND_DEFAULT_CONSTRUCTOR is intentionally not defined.
137   // ROUND_DEFAULT_OPERATOR is intentionally not defined.
138   // ROUND_DEFAULT_FUNCTION is intentionally not defined.
139   // ROUND_DEFAULT_INPUT is intentionally not defined.
140   // ROUND_DEFAULT_OUTPUT is intentionally not defined.
141 
142   /*! \brief
143     Handles \p r: called by all constructors, operators and functions that
144     do not return a Result value.
145   */
146   static void handle_result(Result r);
147 };
148 
149 } // namespace Parma_Polyhedra_Library
150 
151 #include "WRD_coefficient_types_inlines.hh"
152 
153 #endif // !defined(PPL_WRD_coefficient_types_defs_hh)
154