00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_checked_defs_hh
00025 #define PPL_checked_defs_hh 1
00026
00027 #include <iostream>
00028 #include <gmpxx.h>
00029 #include "mp_std_bits.defs.hh"
00030 #include "Temp.defs.hh"
00031 #include "Rounding_Dir.defs.hh"
00032 #include "Numeric_Format.defs.hh"
00033 #include "Float.defs.hh"
00034
00035 namespace Parma_Polyhedra_Library {
00036
00037 namespace Checked {
00038
00039
00040
00041
00042
00043
00044
00045 #define PPL_FUNCTION_CLASS(name) name ## _function_struct
00046
00047 #define PPL_DECLARE_FUN1_0_0(name, ret_type, qual, type) \
00048 template <typename Policy, typename type> \
00049 struct PPL_FUNCTION_CLASS(name); \
00050 template <typename Policy, typename type> \
00051 inline ret_type name(qual type& arg) { \
00052 return PPL_FUNCTION_CLASS(name)<Policy, type>::function(arg); \
00053 }
00054
00055 #define PPL_DECLARE_FUN1_0_1(name, ret_type, qual, type, after1) \
00056 template <typename Policy, typename type> \
00057 struct PPL_FUNCTION_CLASS(name); \
00058 template <typename Policy, typename type> \
00059 inline ret_type name(qual type& arg, after1 a1) { \
00060 return PPL_FUNCTION_CLASS(name)<Policy, type>::function(arg, a1); \
00061 }
00062
00063 #define PPL_DECLARE_FUN1_0_2(name, ret_type, qual, type, after1, after2) \
00064 template <typename Policy, typename type> \
00065 struct PPL_FUNCTION_CLASS(name); \
00066 template <typename Policy, typename type> \
00067 inline ret_type name(qual type& arg, after1 a1, after2 a2) { \
00068 return PPL_FUNCTION_CLASS(name)<Policy, type>::function(arg, a1, a2); \
00069 }
00070
00071 #define PPL_DECLARE_FUN1_0_3(name, ret_type, qual, type, \
00072 after1, after2, after3) \
00073 template <typename Policy, typename type> \
00074 struct PPL_FUNCTION_CLASS(name); \
00075 template <typename Policy, typename type> \
00076 inline ret_type name(qual type& arg, \
00077 after1 a1, after2 a2, after3 a3) { \
00078 return PPL_FUNCTION_CLASS(name)<Policy, type>::function(arg, \
00079 a1, a2, a3); \
00080 }
00081
00082 #define PPL_DECLARE_FUN1_1_1(name, ret_type, before1, qual, type, after1) \
00083 template <typename Policy, typename type> \
00084 struct PPL_FUNCTION_CLASS(name); \
00085 template <typename Policy, typename type> \
00086 inline ret_type name(before1 b1, qual type& arg, after1 a1) { \
00087 return PPL_FUNCTION_CLASS(name)<Policy, type>::function(b1, arg, a1); \
00088 }
00089
00090 #define PPL_DECLARE_FUN1_1_2(name, ret_type, before1, qual, type, \
00091 after1, after2) \
00092 template <typename Policy, typename type> \
00093 struct PPL_FUNCTION_CLASS(name); \
00094 template <typename Policy, typename type> \
00095 inline ret_type name(before1 b1, qual type& arg, \
00096 after1 a1, after2 a2) { \
00097 return PPL_FUNCTION_CLASS(name)<Policy, type>::function(b1, arg, \
00098 a1, a2); \
00099 }
00100
00101 #define PPL_DECLARE_FUN1_2_2(name, ret_type, before1, before2, qual, type, \
00102 after1, after2) \
00103 template <typename Policy, typename type> \
00104 struct PPL_FUNCTION_CLASS(name); \
00105 template <typename Policy, typename type> \
00106 inline ret_type name(before1 b1, before2 b2, qual type& arg, \
00107 after1 a1, after2 a2) { \
00108 return PPL_FUNCTION_CLASS(name)<Policy, type>::function(b1, b2, arg, \
00109 a1, a2); \
00110 }
00111
00112 #define PPL_DECLARE_FUN2_0_0(name, ret_type, qual1, type1, qual2, type2) \
00113 template <typename Policy1, typename Policy2, \
00114 typename type1, typename type2> \
00115 struct PPL_FUNCTION_CLASS(name); \
00116 template <typename Policy1, typename Policy2, \
00117 typename type1, typename type2> \
00118 inline ret_type name(qual1 type1& arg1, qual2 type2& arg2) { \
00119 return PPL_FUNCTION_CLASS(name)<Policy1, Policy2, \
00120 type1, type2>::function(arg1, arg2); \
00121 }
00122
00123 #define PPL_DECLARE_FUN2_0_1(name, ret_type, qual1, type1, \
00124 qual2, type2, after1) \
00125 template <typename Policy1, typename Policy2, \
00126 typename type1, typename type2> \
00127 struct PPL_FUNCTION_CLASS(name); \
00128 template <typename Policy1, typename Policy2, \
00129 typename type1, typename type2> \
00130 inline ret_type name(qual1 type1& arg1, qual2 type2& arg2, \
00131 after1 a1) { \
00132 return PPL_FUNCTION_CLASS(name)<Policy1, Policy2, \
00133 type1, type2>::function(arg1, arg2, a1); \
00134 }
00135
00136 #define PPL_DECLARE_FUN2_0_2(name, ret_type, qual1, type1, qual2, type2, \
00137 after1, after2) \
00138 template <typename Policy1, typename Policy2, \
00139 typename type1, typename type2> \
00140 struct PPL_FUNCTION_CLASS(name); \
00141 template <typename Policy1, typename Policy2, \
00142 typename type1, typename type2> \
00143 inline ret_type name(qual1 type1& arg1, qual2 type2& arg2, \
00144 after1 a1, after2 a2) { \
00145 return PPL_FUNCTION_CLASS(name)<Policy1, Policy2, \
00146 type1, type2>::function(arg1, arg2, a1, a2); \
00147 }
00148
00149 #define PPL_DECLARE_FUN3_0_1(name, ret_type, qual1, type1, \
00150 qual2, type2, qual3, type3, after1) \
00151 template <typename Policy1, typename Policy2, typename Policy3, \
00152 typename type1, typename type2, typename type3> \
00153 struct PPL_FUNCTION_CLASS(name); \
00154 template <typename Policy1, typename Policy2, typename Policy3, \
00155 typename type1, typename type2, typename type3> \
00156 inline ret_type name(qual1 type1& arg1, qual2 type2& arg2, \
00157 qual3 type3& arg3, after1 a1) { \
00158 return PPL_FUNCTION_CLASS(name)<Policy1, Policy2, Policy3, \
00159 type1, type2, type3>::function(arg1, arg2, arg3, a1); \
00160 }
00161
00162 #define PPL_DECLARE_FUN5_0_1(name, ret_type, \
00163 qual1, type1, qual2, type2, qual3, type3, \
00164 qual4, type4, qual5, type5, \
00165 after1) \
00166 template <typename Policy1, typename Policy2, typename Policy3, \
00167 typename Policy4,typename Policy5, \
00168 typename type1, typename type2, typename type3, \
00169 typename type4, typename type5> \
00170 struct PPL_FUNCTION_CLASS(name); \
00171 template <typename Policy1, typename Policy2, typename Policy3, \
00172 typename Policy4,typename Policy5, \
00173 typename type1, typename type2, typename type3, \
00174 typename type4, typename type5> \
00175 inline ret_type name(qual1 type1& arg1, qual2 type2& arg2, \
00176 qual3 type3& arg3, qual4 type4& arg4, \
00177 qual5 type5& arg5, after1 a1) { \
00178 return PPL_FUNCTION_CLASS(name)<Policy1, Policy2, Policy3, \
00179 Policy4, Policy5, type1, type2, type3, type4, type5> \
00180 ::function(arg1, arg2, arg3, arg4, arg5, a1); \
00181 }
00182
00183 #define PPL_SPECIALIZE_FUN1_0_0(name, func, ret_type, qual, type) \
00184 template <typename Policy> \
00185 struct PPL_FUNCTION_CLASS(name)<Policy, type> { \
00186 static inline ret_type function(qual type& arg) { \
00187 return func<Policy>(arg); \
00188 } \
00189 };
00190
00191 #define PPL_SPECIALIZE_FUN1_0_1(name, func, ret_type, qual, type, after1) \
00192 template <typename Policy> \
00193 struct PPL_FUNCTION_CLASS(name)<Policy, type> { \
00194 static inline ret_type function(qual type& arg, after1 a1) { \
00195 return func<Policy>(arg, a1); \
00196 } \
00197 };
00198
00199 #define PPL_SPECIALIZE_FUN1_0_2(name, func, ret_type, qual, type, \
00200 after1, after2) \
00201 template <typename Policy> \
00202 struct PPL_FUNCTION_CLASS(name)<Policy, type> { \
00203 static inline ret_type function(qual type& arg, \
00204 after1 a1, after2 a2) { \
00205 return func<Policy>(arg, a1, a2); \
00206 } \
00207 };
00208
00209 #define PPL_SPECIALIZE_FUN1_0_3(name, func, ret_type, qual, type, \
00210 after1, after2, after3) \
00211 template <typename Policy> \
00212 struct PPL_FUNCTION_CLASS(name)<Policy, type> { \
00213 static inline ret_type function(qual type& arg, \
00214 after1 a1, after2 a2, after3 a3) { \
00215 return func<Policy>(arg, a1, a2, a3); \
00216 } \
00217 };
00218
00219 #define PPL_SPECIALIZE_FUN1_1_1(name, func, ret_type, before1, \
00220 qual, type, after1) \
00221 template <typename Policy> \
00222 struct PPL_FUNCTION_CLASS(name)<Policy, type> { \
00223 static inline ret_type function(before1 b1, qual type& arg, \
00224 after1 a1) { \
00225 return func<Policy>(b1, arg, a1); \
00226 } \
00227 };
00228
00229 #define PPL_SPECIALIZE_FUN1_1_2(name, func, ret_type, before1, \
00230 qual, type, after1, after2) \
00231 template <typename Policy> \
00232 struct PPL_FUNCTION_CLASS(name)<Policy, type> { \
00233 static inline ret_type function(before1 b1, qual type& arg, \
00234 after1 a1, after2 a2) { \
00235 return func<Policy>(b1, arg, a1, a2); \
00236 } \
00237 };
00238
00239 #define PPL_SPECIALIZE_FUN1_2_2(name, func, ret_type, before1, before2, \
00240 qual, type, after1, after2) \
00241 template <typename Policy> \
00242 struct PPL_FUNCTION_CLASS(name)<Policy, type> { \
00243 static inline ret_type function(before1 b1, before2 b2, \
00244 qual type& arg, \
00245 after1 a1, after2 a2) { \
00246 return func<Policy>(b1, b2, arg, a1, a2); \
00247 } \
00248 };
00249
00250 #define PPL_SPECIALIZE_FUN2_0_0(name, func, ret_type, qual1, type1, \
00251 qual2, type2) \
00252 template <typename Policy1, typename Policy2> \
00253 struct PPL_FUNCTION_CLASS(name)<Policy1, Policy2, type1, type2> { \
00254 static inline ret_type function(qual1 type1& arg1, \
00255 qual2 type2 &arg2) { \
00256 return func<Policy1, Policy2>(arg1, arg2); \
00257 } \
00258 };
00259
00260 #define PPL_SPECIALIZE_FUN2_0_1(name, func, ret_type, qual1, type1, \
00261 qual2, type2, after1) \
00262 template <typename Policy1, typename Policy2> \
00263 struct PPL_FUNCTION_CLASS(name)<Policy1, Policy2, type1, type2> { \
00264 static inline ret_type function(qual1 type1& arg1, \
00265 qual2 type2 &arg2, after1 a1) { \
00266 return func<Policy1, Policy2>(arg1, arg2, a1); \
00267 } \
00268 };
00269
00270 #define PPL_SPECIALIZE_FUN2_0_2(name, func, ret_type, qual1, type1, \
00271 qual2, type2, after1, after2) \
00272 template <typename Policy1, typename Policy2> \
00273 struct PPL_FUNCTION_CLASS(name)<Policy1, Policy2, type1, type2> { \
00274 static inline ret_type function(qual1 type1& arg1, \
00275 qual2 type2 &arg2, \
00276 after1 a1, after2 a2) { \
00277 return func<Policy1, Policy2>(arg1, arg2, a1, a2); \
00278 } \
00279 };
00280
00281 #define PPL_SPECIALIZE_FUN3_0_1(name, func, ret_type, qual1, type1, \
00282 qual2, type2, qual3, type3, after1) \
00283 template <typename Policy1, typename Policy2, typename Policy3> \
00284 struct PPL_FUNCTION_CLASS(name) <Policy1, Policy2, Policy3, \
00285 type1, type2, type3> { \
00286 static inline Result function(qual1 type1& arg1, qual2 type2 &arg2, \
00287 qual3 type3 &arg3, after1 a1) { \
00288 return func<Policy1, Policy2, Policy3>(arg1, arg2, arg3, a1); \
00289 } \
00290 };
00291
00292 #define PPL_SPECIALIZE_FUN5_0_1(name, func, ret_type, \
00293 qual1, type1, qual2, type2, \
00294 qual3, type3, \
00295 qual4, type4, qual5, type5, after1) \
00296 template <typename Policy1, typename Policy2, typename Policy3, \
00297 typename Policy4, typename Policy5> \
00298 struct PPL_FUNCTION_CLASS(name) <Policy1, Policy2, Policy3, Policy4, \
00299 Policy5, \
00300 type1, type2, type3, type4, type5> { \
00301 static inline Result \
00302 function(qual1 type1& arg1, qual2 type2 &arg2, qual3 type3 &arg3, \
00303 qual4 type4 &arg4, qual5 type5 &arg5, after1 a1) { \
00304 return func<Policy1, Policy2, Policy3, Policy4, Policy5>(arg1, \
00305 arg2, \
00306 arg3, \
00307 arg4, \
00308 arg5, \
00309 a1); \
00310 } \
00311 };
00312
00313
00314 #ifdef nonconst
00315 #define PPL_SAVED_nonconst nonconst
00316 #undef nonconst
00317 #endif
00318 #define nonconst
00319
00320 #define PPL_SPECIALIZE_COPY(func, Type) \
00321 PPL_SPECIALIZE_FUN2_0_0(copy, func, void, nonconst, Type, const, Type)
00322 #define PPL_SPECIALIZE_SGN(func, From) \
00323 PPL_SPECIALIZE_FUN1_0_0(sgn, func, Result_Relation, const, From)
00324 #define PPL_SPECIALIZE_CMP(func, Type1, Type2) \
00325 PPL_SPECIALIZE_FUN2_0_0(cmp, func, Result_Relation, const, Type1, const, Type2)
00326 #define PPL_SPECIALIZE_CLASSIFY(func, Type) \
00327 PPL_SPECIALIZE_FUN1_0_3(classify, func, Result, const, Type, bool, bool, bool)
00328 #define PPL_SPECIALIZE_IS_NAN(func, Type) \
00329 PPL_SPECIALIZE_FUN1_0_0(is_nan, func, bool, const, Type)
00330 #define PPL_SPECIALIZE_IS_MINF(func, Type) \
00331 PPL_SPECIALIZE_FUN1_0_0(is_minf, func, bool, const, Type)
00332 #define PPL_SPECIALIZE_IS_PINF(func, Type) \
00333 PPL_SPECIALIZE_FUN1_0_0(is_pinf, func, bool, const, Type)
00334 #define PPL_SPECIALIZE_IS_INT(func, Type) \
00335 PPL_SPECIALIZE_FUN1_0_0(is_int, func, bool, const, Type)
00336 #define PPL_SPECIALIZE_ASSIGN_SPECIAL(func, Type) \
00337 PPL_SPECIALIZE_FUN1_0_2(assign_special, func, Result, \
00338 nonconst, Type, Result_Class, Rounding_Dir)
00339 #define PPL_SPECIALIZE_CONSTRUCT_SPECIAL(func, Type) \
00340 PPL_SPECIALIZE_FUN1_0_2(construct_special, func, Result, nonconst, \
00341 Type, Result_Class, Rounding_Dir)
00342 #define PPL_SPECIALIZE_CONSTRUCT(func, To, From) \
00343 PPL_SPECIALIZE_FUN2_0_1(construct, func, Result, nonconst, To, \
00344 const, From, Rounding_Dir)
00345 #define PPL_SPECIALIZE_ASSIGN(func, To, From) \
00346 PPL_SPECIALIZE_FUN2_0_1(assign, func, Result, nonconst, To, \
00347 const, From, Rounding_Dir)
00348 #define PPL_SPECIALIZE_FLOOR(func, To, From) \
00349 PPL_SPECIALIZE_FUN2_0_1(floor, func, Result, nonconst, To, \
00350 const, From, Rounding_Dir)
00351 #define PPL_SPECIALIZE_CEIL(func, To, From) \
00352 PPL_SPECIALIZE_FUN2_0_1(ceil, func, Result, nonconst, To, \
00353 const, From, Rounding_Dir)
00354 #define PPL_SPECIALIZE_TRUNC(func, To, From) \
00355 PPL_SPECIALIZE_FUN2_0_1(trunc, func, Result, nonconst, To, \
00356 const, From, Rounding_Dir)
00357 #define PPL_SPECIALIZE_NEG(func, To, From) \
00358 PPL_SPECIALIZE_FUN2_0_1(neg, func, Result, nonconst, To, \
00359 const, From, Rounding_Dir)
00360 #define PPL_SPECIALIZE_ABS(func, To, From) \
00361 PPL_SPECIALIZE_FUN2_0_1(abs, func, Result, nonconst, To, \
00362 const, From, Rounding_Dir)
00363 #define PPL_SPECIALIZE_SQRT(func, To, From) \
00364 PPL_SPECIALIZE_FUN2_0_1(sqrt, func, Result, nonconst, To, \
00365 const, From, Rounding_Dir)
00366 #define PPL_SPECIALIZE_ADD(func, To, From1, From2) \
00367 PPL_SPECIALIZE_FUN3_0_1(add, func, Result, nonconst, To, \
00368 const, From1, const, From2, Rounding_Dir)
00369 #define PPL_SPECIALIZE_SUB(func, To, From1, From2) \
00370 PPL_SPECIALIZE_FUN3_0_1(sub, func, Result, nonconst, To, \
00371 const, From1, const, From2, Rounding_Dir)
00372 #define PPL_SPECIALIZE_MUL(func, To, From1, From2) \
00373 PPL_SPECIALIZE_FUN3_0_1(mul, func, Result, nonconst, To, \
00374 const, From1, const, From2, Rounding_Dir)
00375 #define PPL_SPECIALIZE_DIV(func, To, From1, From2) \
00376 PPL_SPECIALIZE_FUN3_0_1(div, func, Result, nonconst, To, \
00377 const, From1, const, From2, Rounding_Dir)
00378 #define PPL_SPECIALIZE_REM(func, To, From1, From2) \
00379 PPL_SPECIALIZE_FUN3_0_1(rem, func, Result, nonconst, To, \
00380 const, From1, const, From2, Rounding_Dir)
00381 #define PPL_SPECIALIZE_IDIV(func, To, From1, From2) \
00382 PPL_SPECIALIZE_FUN3_0_1(idiv, func, Result, nonconst, To, \
00383 const, From1, const, From2, Rounding_Dir)
00384 #define PPL_SPECIALIZE_ADD_2EXP(func, To, From) \
00385 PPL_SPECIALIZE_FUN2_0_2(add_2exp, func, Result, nonconst, To, \
00386 const, From, unsigned int, Rounding_Dir)
00387 #define PPL_SPECIALIZE_SUB_2EXP(func, To, From) \
00388 PPL_SPECIALIZE_FUN2_0_2(sub_2exp, func, Result, nonconst, To, \
00389 const, From, unsigned int, Rounding_Dir)
00390 #define PPL_SPECIALIZE_MUL_2EXP(func, To, From) \
00391 PPL_SPECIALIZE_FUN2_0_2(mul_2exp, func, Result, nonconst, To, \
00392 const, From, unsigned int, Rounding_Dir)
00393 #define PPL_SPECIALIZE_DIV_2EXP(func, To, From) \
00394 PPL_SPECIALIZE_FUN2_0_2(div_2exp, func, Result, nonconst, To, \
00395 const, From, unsigned int, Rounding_Dir)
00396 #define PPL_SPECIALIZE_SMOD_2EXP(func, To, From) \
00397 PPL_SPECIALIZE_FUN2_0_2(smod_2exp, func, Result, nonconst, To, \
00398 const, From, unsigned int, Rounding_Dir)
00399 #define PPL_SPECIALIZE_UMOD_2EXP(func, To, From) \
00400 PPL_SPECIALIZE_FUN2_0_2(umod_2exp, func, Result, nonconst, To, \
00401 const, From, unsigned int, Rounding_Dir)
00402 #define PPL_SPECIALIZE_ADD_MUL(func, To, From1, From2) \
00403 PPL_SPECIALIZE_FUN3_0_1(add_mul, func, Result, nonconst, To, \
00404 const, From1, const, From2, Rounding_Dir)
00405 #define PPL_SPECIALIZE_SUB_MUL(func, To, From1, From2) \
00406 PPL_SPECIALIZE_FUN3_0_1(sub_mul, func, Result, nonconst, To, \
00407 const, From1, const, From2, Rounding_Dir)
00408 #define PPL_SPECIALIZE_GCD(func, To, From1, From2) \
00409 PPL_SPECIALIZE_FUN3_0_1(gcd, func, Result, nonconst, To, \
00410 const, From1, const, From2, Rounding_Dir)
00411 #define PPL_SPECIALIZE_GCDEXT(func, To1, From1, From2, To2, To3) \
00412 PPL_SPECIALIZE_FUN5_0_1(gcdext, func, Result, nonconst, To1, \
00413 nonconst, To2, nonconst, To3, \
00414 const, From1, const, From2, Rounding_Dir)
00415 #define PPL_SPECIALIZE_LCM(func, To, From1, From2) \
00416 PPL_SPECIALIZE_FUN3_0_1(lcm, func, Result, nonconst, To, \
00417 const, From1, const, From2, Rounding_Dir)
00418 #define PPL_SPECIALIZE_INPUT(func, Type) \
00419 PPL_SPECIALIZE_FUN1_0_2(input, func, Result, nonconst, Type, \
00420 std::istream&, Rounding_Dir)
00421 #define PPL_SPECIALIZE_OUTPUT(func, Type) \
00422 PPL_SPECIALIZE_FUN1_1_2(output, func, Result, std::ostream&, \
00423 const, Type, \
00424 const Numeric_Format&, Rounding_Dir)
00425
00426
00427 PPL_DECLARE_FUN2_0_0(copy,
00428 void, nonconst, Type1, const, Type2)
00429 PPL_DECLARE_FUN1_0_0(sgn,
00430 Result_Relation, const, From)
00431 PPL_DECLARE_FUN2_0_0(cmp,
00432 Result_Relation, const, Type1, const, Type2)
00433 PPL_DECLARE_FUN1_0_3(classify,
00434 Result, const, Type, bool, bool, bool)
00435 PPL_DECLARE_FUN1_0_0(is_nan,
00436 bool, const, Type)
00437 PPL_DECLARE_FUN1_0_0(is_minf,
00438 bool, const, Type)
00439 PPL_DECLARE_FUN1_0_0(is_pinf,
00440 bool, const, Type)
00441 PPL_DECLARE_FUN1_0_0(is_int,
00442 bool, const, Type)
00443 PPL_DECLARE_FUN1_0_2(assign_special,
00444 Result, nonconst, Type, Result_Class, Rounding_Dir)
00445 PPL_DECLARE_FUN1_0_2(construct_special,
00446 Result, nonconst, Type, Result_Class, Rounding_Dir)
00447 PPL_DECLARE_FUN2_0_1(construct,
00448 Result, nonconst, To, const, From, Rounding_Dir)
00449 PPL_DECLARE_FUN2_0_1(assign,
00450 Result, nonconst, To, const, From, Rounding_Dir)
00451 PPL_DECLARE_FUN2_0_1(floor,
00452 Result, nonconst, To, const, From, Rounding_Dir)
00453 PPL_DECLARE_FUN2_0_1(ceil,
00454 Result, nonconst, To, const, From, Rounding_Dir)
00455 PPL_DECLARE_FUN2_0_1(trunc,
00456 Result, nonconst, To, const, From, Rounding_Dir)
00457 PPL_DECLARE_FUN2_0_1(neg,
00458 Result, nonconst, To, const, From, Rounding_Dir)
00459 PPL_DECLARE_FUN2_0_1(abs,
00460 Result, nonconst, To, const, From, Rounding_Dir)
00461 PPL_DECLARE_FUN2_0_1(sqrt,
00462 Result, nonconst, To, const, From, Rounding_Dir)
00463 PPL_DECLARE_FUN3_0_1(add,
00464 Result, nonconst, To,
00465 const, From1, const, From2, Rounding_Dir)
00466 PPL_DECLARE_FUN3_0_1(sub,
00467 Result, nonconst, To,
00468 const, From1, const, From2, Rounding_Dir)
00469 PPL_DECLARE_FUN3_0_1(mul,
00470 Result, nonconst, To,
00471 const, From1, const, From2, Rounding_Dir)
00472 PPL_DECLARE_FUN3_0_1(div,
00473 Result, nonconst, To,
00474 const, From1, const, From2, Rounding_Dir)
00475 PPL_DECLARE_FUN3_0_1(rem,
00476 Result, nonconst, To,
00477 const, From1, const, From2, Rounding_Dir)
00478 PPL_DECLARE_FUN3_0_1(idiv,
00479 Result, nonconst, To,
00480 const, From1, const, From2, Rounding_Dir)
00481 PPL_DECLARE_FUN2_0_2(add_2exp,
00482 Result, nonconst, To,
00483 const, From, unsigned int, Rounding_Dir)
00484 PPL_DECLARE_FUN2_0_2(sub_2exp,
00485 Result, nonconst, To,
00486 const, From, unsigned int, Rounding_Dir)
00487 PPL_DECLARE_FUN2_0_2(mul_2exp,
00488 Result, nonconst, To,
00489 const, From, unsigned int, Rounding_Dir)
00490 PPL_DECLARE_FUN2_0_2(div_2exp,
00491 Result, nonconst, To,
00492 const, From, unsigned int, Rounding_Dir)
00493 PPL_DECLARE_FUN2_0_2(smod_2exp,
00494 Result, nonconst, To,
00495 const, From, unsigned int, Rounding_Dir)
00496 PPL_DECLARE_FUN2_0_2(umod_2exp,
00497 Result, nonconst, To,
00498 const, From, unsigned int, Rounding_Dir)
00499 PPL_DECLARE_FUN3_0_1(add_mul,
00500 Result, nonconst, To,
00501 const, From1, const, From2, Rounding_Dir)
00502 PPL_DECLARE_FUN3_0_1(sub_mul,
00503 Result, nonconst, To,
00504 const, From1, const, From2, Rounding_Dir)
00505 PPL_DECLARE_FUN3_0_1(gcd,
00506 Result, nonconst, To,
00507 const, From1, const, From2, Rounding_Dir)
00508 PPL_DECLARE_FUN5_0_1(gcdext,
00509 Result, nonconst, To1, nonconst, To2, nonconst, To3,
00510 const, From1, const, From2, Rounding_Dir)
00511 PPL_DECLARE_FUN3_0_1(lcm,
00512 Result, nonconst, To,
00513 const, From1, const, From2, Rounding_Dir)
00514 PPL_DECLARE_FUN1_0_2(input,
00515 Result, nonconst, Type, std::istream&, Rounding_Dir)
00516 PPL_DECLARE_FUN1_1_2(output,
00517 Result, std::ostream&, const, Type,
00518 const Numeric_Format&, Rounding_Dir)
00519
00520 #undef PPL_DECLARE_FUN1_0_0
00521 #undef PPL_DECLARE_FUN1_0_1
00522 #undef PPL_DECLARE_FUN1_0_2
00523 #undef PPL_DECLARE_FUN1_0_3
00524 #undef PPL_DECLARE_FUN1_1_1
00525 #undef PPL_DECLARE_FUN1_1_2
00526 #undef PPL_DECLARE_FUN1_2_2
00527 #undef PPL_DECLARE_FUN2_0_0
00528 #undef PPL_DECLARE_FUN2_0_1
00529 #undef PPL_DECLARE_FUN2_0_2
00530 #undef PPL_DECLARE_FUN3_0_1
00531 #undef PPL_DECLARE_FUN5_0_1
00532
00533 template <typename Policy, typename To>
00534 Result round(To& to, Result r, Rounding_Dir dir);
00535
00536 Result input_mpq(mpq_class& to, std::istream& is);
00537
00538 }
00539
00540 struct Minus_Infinity {
00541 static const Result_Class vclass = VC_MINUS_INFINITY;
00542 };
00543 struct Plus_Infinity {
00544 static const Result_Class vclass = VC_PLUS_INFINITY;
00545 };
00546 struct Not_A_Number {
00547 static const Result_Class vclass = VC_NAN;
00548 };
00549
00550 template <typename T>
00551 struct Is_Special : public False { };
00552
00553 template <>
00554 struct Is_Special<Minus_Infinity> : public True {};
00555
00556 template <>
00557 struct Is_Special<Plus_Infinity> : public True {};
00558
00559 template <>
00560 struct Is_Special<Not_A_Number> : public True {};
00561
00562 extern Minus_Infinity MINUS_INFINITY;
00563 extern Plus_Infinity PLUS_INFINITY;
00564 extern Not_A_Number NOT_A_NUMBER;
00565
00566 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00567
00568 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00569 template <typename T>
00570 struct Checked_Number_Transparent_Policy {
00572 const_bool_nodef(check_overflow, false);
00573
00575 const_bool_nodef(check_inf_add_inf, false);
00576
00578 const_bool_nodef(check_inf_sub_inf, false);
00579
00581 const_bool_nodef(check_inf_mul_zero, false);
00582
00584 const_bool_nodef(check_div_zero, false);
00585
00587 const_bool_nodef(check_inf_div_inf, false);
00588
00590 const_bool_nodef(check_inf_mod, false);
00591
00593 const_bool_nodef(check_sqrt_neg, false);
00594
00596 const_bool_nodef(has_nan, std::numeric_limits<T>::has_quiet_NaN);
00597
00599 const_bool_nodef(has_infinity, std::numeric_limits<T>::has_infinity);
00600
00605 const_bool_nodef(convertible, true);
00606
00608 const_bool_nodef(fpu_check_inexact, false);
00609
00611 const_bool_nodef(fpu_check_nan_result, false);
00612
00617 static const Rounding_Dir ROUND_DEFAULT_CONSTRUCTOR = ROUND_NATIVE;
00618
00623 static const Rounding_Dir ROUND_DEFAULT_OPERATOR = ROUND_NATIVE;
00624
00629 static const Rounding_Dir ROUND_DEFAULT_INPUT = ROUND_NATIVE;
00630
00635 static const Rounding_Dir ROUND_DEFAULT_OUTPUT = ROUND_NATIVE;
00636
00641 static const Rounding_Dir ROUND_DEFAULT_FUNCTION = ROUND_NATIVE;
00642
00647 static void handle_result(Result r);
00648 };
00649
00650 }
00651
00652 #define CHECK_P(cond, check) ((cond) ? (check) : (assert(!(check)), false))
00653
00654 #include "checked.inlines.hh"
00655 #include "checked_int.inlines.hh"
00656 #include "checked_float.inlines.hh"
00657 #include "checked_mpz.inlines.hh"
00658 #include "checked_mpq.inlines.hh"
00659 #include "checked_ext.inlines.hh"
00660
00661 #undef nonconst
00662 #ifdef PPL_SAVED_nonconst
00663 #define nonconst PPL_SAVED_nonconst
00664 #undef PPL_SAVED_nonconst
00665 #endif
00666
00667 #undef PPL_FUNCTION_CLASS
00668 #undef PPL_NAN
00669
00670 #endif // !defined(PPL_checked_defs_hh)