Parma_Polyhedra_Library::Checked Namespace Reference
[C++ Language Interface]

Types and functions implementing checked numbers. More...

Classes

struct  Safe_Conversion
struct  Safe_Conversion< T, T >
struct  Safe_Int_Comparison
struct  Safe_Int_Comparison< T1, T2, typename Enable_If<(C_Integer< T1 >::value &&C_Integer< T2 >::value)>::type >
struct  Float_2exp
struct  Extended_Int
struct  Larger< char >
struct  Larger< signed char >
struct  Larger< unsigned char >
struct  Larger< signed short >
struct  Larger< unsigned short >
struct  Larger< signed int >
struct  Larger< unsigned int >
struct  Larger< signed long >
struct  Larger< unsigned long >
struct  Larger< signed long long >
struct  Larger< unsigned long long >
struct  number_struct

Typedefs

typedef int16_t int_fast16_t
typedef int32_t int_fast32_t
typedef int64_t int_fast64_t
typedef uint16_t uint_fast16_t
typedef uint32_t uint_fast32_t
typedef uint64_t uint_fast64_t
typedef int mp_size_field_t
 This is assumed to be the type of the _mp_size field of GMP's __mpz_struct.

Functions

 PPL_DECLARE_FUN2_0_0 (copy, void, nonconst, Type1, const, Type2) PPL_DECLARE_FUN1_0_0(sgn
From PPL_DECLARE_FUN2_0_0 (cmp, Result_Relation, const, Type1, const, Type2) PPL_DECLARE_FUN1_0_3(classify
From bool PPL_DECLARE_FUN1_0_0 (is_nan, bool, const, Type) PPL_DECLARE_FUN1_0_0(is_minf
From bool Type PPL_DECLARE_FUN1_0_0 (is_pinf, bool, const, Type) PPL_DECLARE_FUN1_0_0(is_int
From bool Type Type PPL_DECLARE_FUN1_0_2 (assign_special, Result, nonconst, Type, Result_Class, Rounding_Dir) PPL_DECLARE_FUN1_0_2(construct_special
From bool Type Type Rounding_Dir PPL_DECLARE_FUN2_0_1 (construct, Result, nonconst, To, const, From, Rounding_Dir) PPL_DECLARE_FUN2_0_1(assign
From bool Type Type
Rounding_Dir Rounding_Dir 
PPL_DECLARE_FUN2_0_1 (floor, Result, nonconst, To, const, From, Rounding_Dir) PPL_DECLARE_FUN2_0_1(ceil
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir 
PPL_DECLARE_FUN2_0_1 (trunc, Result, nonconst, To, const, From, Rounding_Dir) PPL_DECLARE_FUN2_0_1(neg
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir 
PPL_DECLARE_FUN2_0_1 (abs, Result, nonconst, To, const, From, Rounding_Dir) PPL_DECLARE_FUN2_0_1(sqrt
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir 
PPL_DECLARE_FUN3_0_1 (add, Result, nonconst, To, const, From1, const, From2, Rounding_Dir) PPL_DECLARE_FUN3_0_1(sub
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir 
PPL_DECLARE_FUN3_0_1 (mul, Result, nonconst, To, const, From1, const, From2, Rounding_Dir) PPL_DECLARE_FUN3_0_1(div
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir 
PPL_DECLARE_FUN3_0_1 (rem, Result, nonconst, To, const, From1, const, From2, Rounding_Dir) PPL_DECLARE_FUN3_0_1(idiv
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir 
PPL_DECLARE_FUN2_0_2 (add_2exp, Result, nonconst, To, const, From, unsigned int, Rounding_Dir) PPL_DECLARE_FUN2_0_2(sub_2exp
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir 
PPL_DECLARE_FUN2_0_2 (mul_2exp, Result, nonconst, To, const, From, unsigned int, Rounding_Dir) PPL_DECLARE_FUN2_0_2(div_2exp
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir 
PPL_DECLARE_FUN2_0_2 (smod_2exp, Result, nonconst, To, const, From, unsigned int, Rounding_Dir) PPL_DECLARE_FUN2_0_2(umod_2exp
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir 
PPL_DECLARE_FUN3_0_1 (add_mul, Result, nonconst, To, const, From1, const, From2, Rounding_Dir) PPL_DECLARE_FUN3_0_1(sub_mul
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir Rounding_Dir 
PPL_DECLARE_FUN3_0_1 (gcd, Result, nonconst, To, const, From1, const, From2, Rounding_Dir) PPL_DECLARE_FUN5_0_1(gcdext
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir Rounding_Dir
Rounding_Dir 
PPL_DECLARE_FUN3_0_1 (lcm, Result, nonconst, To, const, From1, const, From2, Rounding_Dir) PPL_DECLARE_FUN1_0_2(input
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir Rounding_Dir
Rounding_Dir std::istream
Rounding_Dir 
PPL_DECLARE_FUN1_1_2 (output, Result, std::ostream &, const, Type, const Numeric_Format &, Rounding_Dir) template< typename Policy
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir Rounding_Dir
Rounding_Dir std::istream
Rounding_Dir To Result 
round (To &to, Result r, Rounding_Dir dir)
Result input_mpq (mpq_class &to, std::istream &is)
 PPL_SAFE_CONVERSION (signed short, signed char)
 PPL_SAFE_CONVERSION (signed long long, signed char)
 PPL_SAFE_CONVERSION (signed long long, signed short)
 PPL_SAFE_CONVERSION (unsigned short, char)
 PPL_SAFE_CONVERSION (unsigned short, unsigned char)
 PPL_SAFE_CONVERSION (unsigned long, char)
 PPL_SAFE_CONVERSION (unsigned long, unsigned char)
 PPL_SAFE_CONVERSION (unsigned long long, char)
 PPL_SAFE_CONVERSION (unsigned long long, unsigned char)
 PPL_SAFE_CONVERSION (double, float)
 PPL_SAFE_CONVERSION (long double, float)
 PPL_SAFE_CONVERSION (long double, double)
 PPL_SAFE_CONVERSION (mpz_class, char)
 PPL_SAFE_CONVERSION (mpz_class, signed char)
 PPL_SAFE_CONVERSION (mpz_class, unsigned char)
 PPL_SAFE_CONVERSION (mpq_class, char)
 PPL_SAFE_CONVERSION (mpq_class, signed char)
 PPL_SAFE_CONVERSION (mpq_class, unsigned char)
 PPL_SAFE_CONVERSION (mpq_class, float)
 PPL_SAFE_CONVERSION (mpq_class, double)
template<typename Policy , typename Type >
struct PPL_FUNCTION_CLASS (construct)< Policy
template<typename To_Policy , typename From_Policy , typename To , typename From >
struct PPL_FUNCTION_CLASS (construct)
template<typename To_Policy , typename To >
struct PPL_FUNCTION_CLASS (construct_special)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_exact (To &to, const From &from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Enable_If< Is_Same< To_Policy,
From_Policy >::value, void >
::type 
copy_generic (Type &to, const Type &from)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result abs_generic (To &to, const From &from, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename To , typename From >
void gcd_exact_noabs (To &to, const From &x, const From &y)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename To , typename From1 , typename From2 >
Result gcd_exact (To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
template<typename To1_Policy , typename To2_Policy , typename To3_Policy , typename From1_Policy , typename From2_Policy , typename To1 , typename To2 , typename To3 , typename From1 , typename From2 >
Result gcdext_exact (To1 &to, To2 &s, To3 &t, const From1 &x, const From2 &y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename To , typename From1 , typename From2 >
Result lcm_gcd_exact (To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
template<typename Policy , typename Type >
Result_Relation sgn_generic (const Type &x)
template<typename T1 , typename T2 >
Enable_If<(Safe_Int_Comparison
< T1, T2 >::value||Safe_Conversion
< T1, T2 >::value||Safe_Conversion
< T2, T1 >::value), bool >
::type 
lt (const T1 &x, const T2 &y)
template<typename T1 , typename T2 >
Enable_If<(Safe_Int_Comparison
< T1, T2 >::value||Safe_Conversion
< T1, T2 >::value||Safe_Conversion
< T2, T1 >::value), bool >
::type 
le (const T1 &x, const T2 &y)
template<typename T1 , typename T2 >
Enable_If<(Safe_Int_Comparison
< T1, T2 >::value||Safe_Conversion
< T1, T2 >::value||Safe_Conversion
< T2, T1 >::value), bool >
::type 
eq (const T1 &x, const T2 &y)
template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
bool lt_p (const Type1 &x, const Type2 &y)
template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
bool le_p (const Type1 &x, const Type2 &y)
template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
bool eq_p (const Type1 &x, const Type2 &y)
template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
Result_Relation cmp_generic (const Type1 &x, const Type2 &y)
template<typename Policy , typename Type >
Result assign_nan (Type &to, Result r)
template<typename Policy , typename Type >
Result input_generic (Type &to, std::istream &is, Rounding_Dir dir)
float fma (float x, float y, float z)
double fma (double x, double y, double z)
long double fma (long double x, long double y, long double z)
double rint (double x)
long double rint (long double x)
bool fpu_direct_rounding (Rounding_Dir dir)
bool fpu_inverse_rounding (Rounding_Dir dir)
void limit_precision (const float &v)
void limit_precision (const double &v)
void limit_precision (const long double &)
template<typename Policy , typename T >
Result classify_float (const T v, bool nan, bool inf, bool sign)
template<typename Policy , typename T >
bool is_nan_float (const T v)
template<typename Policy , typename T >
int is_inf_float (const T v)
template<typename Policy , typename T >
bool is_minf_float (const T v)
template<typename Policy , typename T >
bool is_pinf_float (const T v)
template<typename Policy , typename T >
bool is_int_float (const T v)
template<typename Policy , typename T >
Result assign_special_float (T &v, Result_Class c, Rounding_Dir)
template<typename T >
void pred_float (T &v)
template<typename T >
void succ_float (T &v)
template<typename Policy , typename To >
Result round_lt_float (To &to, Rounding_Dir dir)
template<typename Policy , typename To >
Result round_gt_float (To &to, Rounding_Dir dir)
template<typename Policy >
void prepare_inexact (Rounding_Dir dir)
template<typename Policy >
Result result_relation (Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_float_float_exact (To &to, const From from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_float_float_inexact (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_float_float (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result floor_float (Type &to, const Type from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result ceil_float (Type &to, const Type from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result trunc_float (Type &to, const Type from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result neg_float (Type &to, const Type from, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result add_float (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result sub_float (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result mul_float (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result div_float (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result idiv_float (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result rem_float (Type &to, const Type x, const Type y, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result add_2exp_float (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result sub_2exp_float (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result mul_2exp_float (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result div_2exp_float (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result smod_2exp_float (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result umod_2exp_float (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result abs_float (Type &to, const Type from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result sqrt_float (Type &to, const Type from, Rounding_Dir dir)
template<typename Policy , typename Type >
Result_Relation sgn_float (const Type x)
template<typename Policy1 , typename Policy2 , typename Type >
Result_Relation cmp_float (const Type x, const Type y)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_float_int_inexact (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_float_int (To &to, const From from, Rounding_Dir dir)
template<typename Policy , typename T >
Result set_neg_overflow_float (T &to, Rounding_Dir dir)
template<typename Policy , typename T >
Result set_pos_overflow_float (T &to, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename T >
Result assign_float_mpz (T &to, const mpz_class &_from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename T >
Result assign_float_mpq (T &to, const mpq_class &from, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result add_mul_float (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result sub_mul_float (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename Policy , typename Type >
Result output_float (std::ostream &os, const Type from, const Numeric_Format &, Rounding_Dir)
template<typename Policy , typename To >
Result set_neg_overflow_int (To &to, Rounding_Dir dir)
template<typename Policy , typename To >
Result set_pos_overflow_int (To &to, Rounding_Dir dir)
template<typename Policy , typename To >
Result round_lt_int_no_overflow (To &to, Rounding_Dir dir)
template<typename Policy , typename To >
Result round_gt_int_no_overflow (To &to, Rounding_Dir dir)
template<typename Policy , typename To >
Result round_lt_int (To &to, Rounding_Dir dir)
template<typename Policy , typename To >
Result round_gt_int (To &to, Rounding_Dir dir)
template<typename Policy , typename Type >
Result classify_int (const Type v, bool nan, bool inf, bool sign)
template<typename Policy , typename Type >
bool is_nan_int (const Type v)
template<typename Policy , typename Type >
bool is_minf_int (const Type v)
template<typename Policy , typename Type >
bool is_pinf_int (const Type v)
template<typename Policy , typename Type >
bool is_int_int (const Type v)
template<typename Policy , typename Type >
Result assign_special_int (Type &v, Result_Class c, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_signed_int_signed_int (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_signed_int_unsigned_int (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_unsigned_int_signed_int (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_unsigned_int_unsigned_int (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To , typename From >
Result assign_int_float (To &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To >
Result assign_signed_int_mpz (To &to, const mpz_class &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To >
Result assign_unsigned_int_mpz (To &to, const mpz_class &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename To >
Result assign_int_mpq (To &to, const mpq_class &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result neg_int_larger (Type &to, const Type x, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result add_int_larger (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result sub_int_larger (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result mul_int_larger (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result neg_signed_int (Type &to, const Type from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result neg_unsigned_int (Type &to, const Type from, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result add_signed_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result add_unsigned_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result sub_signed_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result sub_unsigned_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result mul_signed_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result mul_unsigned_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result div_signed_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result div_unsigned_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result idiv_signed_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result idiv_unsigned_int (Type &to, const Type x, const Type y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result rem_signed_int (Type &to, const Type x, const Type y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result rem_unsigned_int (Type &to, const Type x, const Type y, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result div_2exp_unsigned_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result div_2exp_signed_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result add_2exp_unsigned_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result add_2exp_signed_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result sub_2exp_unsigned_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result sub_2exp_signed_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result mul_2exp_unsigned_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result mul_2exp_signed_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result smod_2exp_unsigned_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result smod_2exp_signed_int (Type &to, const Type x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result umod_2exp_unsigned_int (Type &to, const Type x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result umod_2exp_signed_int (Type &to, const Type x, unsigned int exp, Rounding_Dir dir)
template<typename Type >
void isqrtrem (Type &q, Type &r, const Type from)
template<typename To_Policy , typename From_Policy , typename Type >
Result sqrt_unsigned_int (Type &to, const Type from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename Type >
Result sqrt_signed_int (Type &to, const Type from, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result add_mul_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result sub_mul_int (Type &to, const Type x, const Type y, Rounding_Dir dir)
template<typename Policy , typename Type >
Result output_char (std::ostream &os, Type &from, const Numeric_Format &, Rounding_Dir)
template<typename Policy , typename Type >
Result output_int (std::ostream &os, Type &from, const Numeric_Format &, Rounding_Dir)
template<typename Policy >
Result classify_mpq (const mpq_class &v, bool nan, bool inf, bool sign)
template<typename Policy >
bool is_nan_mpq (const mpq_class &v)
template<typename Policy >
bool is_minf_mpq (const mpq_class &v)
template<typename Policy >
bool is_pinf_mpq (const mpq_class &v)
template<typename Policy >
bool is_int_mpq (const mpq_class &v)
template<typename Policy >
Result assign_special_mpq (mpq_class &v, Result_Class c, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename From >
Result construct_mpq_base (mpq_class &to, const From &from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename From >
Result construct_mpq_float (mpq_class &to, const From &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpq_float (mpq_class &to, const From &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpq_signed_int (mpq_class &to, const From from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpq_unsigned_int (mpq_class &to, const From from, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result floor_mpq (mpq_class &to, const mpq_class &from, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result ceil_mpq (mpq_class &to, const mpq_class &from, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result trunc_mpq (mpq_class &to, const mpq_class &from, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result neg_mpq (mpq_class &to, const mpq_class &from, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result add_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result sub_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result mul_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result div_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result idiv_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result rem_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result add_2exp_mpq (mpq_class &to, const mpq_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result sub_2exp_mpq (mpq_class &to, const mpq_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result mul_2exp_mpq (mpq_class &to, const mpq_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result div_2exp_mpq (mpq_class &to, const mpq_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result smod_2exp_mpq (mpq_class &to, const mpq_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result umod_2exp_mpq (mpq_class &to, const mpq_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result abs_mpq (mpq_class &to, const mpq_class &from, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result add_mul_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result sub_mul_mpq (mpq_class &to, const mpq_class &x, const mpq_class &y, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result sqrt_mpq (mpq_class &to, const mpq_class &from, Rounding_Dir dir)
template<typename Policy >
Result input_mpq (mpq_class &to, std::istream &is, Rounding_Dir dir)
template<typename Policy >
Result output_mpq (std::ostream &os, const mpq_class &from, const Numeric_Format &, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpq_long_double (mpq_class &to, const From &from, Rounding_Dir dir)
template<typename Policy >
Result round_lt_mpz (mpz_class &to, Rounding_Dir dir)
template<typename Policy >
Result round_gt_mpz (mpz_class &to, Rounding_Dir dir)
mp_size_field_t get_mp_size (const mpz_class &v)
void set_mp_size (mpz_class &v, mp_size_field_t size)
template<typename Policy >
Result classify_mpz (const mpz_class &v, bool nan, bool inf, bool sign)
template<typename Policy >
bool is_nan_mpz (const mpz_class &v)
template<typename Policy >
bool is_minf_mpz (const mpz_class &v)
template<typename Policy >
bool is_pinf_mpz (const mpz_class &v)
template<typename Policy >
bool is_int_mpz (const mpz_class &v)
template<typename Policy >
Result assign_special_mpz (mpz_class &v, Result_Class c, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
void copy_mpz (mpz_class &to, const mpz_class &from)
template<typename To_Policy , typename From_Policy , typename From >
Result construct_mpz_base (mpz_class &to, const From from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename From >
Result construct_mpz_float (mpz_class &to, const From &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpz_signed_int (mpz_class &to, const From from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpz_unsigned_int (mpz_class &to, const From from, Rounding_Dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpz_float (mpz_class &to, const From from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy , typename From >
Result assign_mpz_long_double (mpz_class &to, const From &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy >
Result assign_mpz_mpq (mpz_class &to, const mpq_class &from, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy >
Result neg_mpz (mpz_class &to, const mpz_class &from, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result add_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result sub_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result mul_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result div_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result idiv_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result rem_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result add_2exp_mpz (mpz_class &to, const mpz_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result sub_2exp_mpz (mpz_class &to, const mpz_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result mul_2exp_mpz (mpz_class &to, const mpz_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result div_2exp_mpz (mpz_class &to, const mpz_class &x, unsigned int exp, Rounding_Dir dir)
template<typename To_Policy , typename From_Policy >
Result smod_2exp_mpz (mpz_class &to, const mpz_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result umod_2exp_mpz (mpz_class &to, const mpz_class &x, unsigned int exp, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result abs_mpz (mpz_class &to, const mpz_class &from, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result add_mul_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result sub_mul_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result gcd_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result gcdext_mpz (mpz_class &to, mpz_class &s, mpz_class &t, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result lcm_mpz (mpz_class &to, const mpz_class &x, const mpz_class &y, Rounding_Dir)
template<typename To_Policy , typename From_Policy >
Result sqrt_mpz (mpz_class &to, const mpz_class &from, Rounding_Dir dir)
template<typename Policy , typename Type >
Result_Relation sgn_mp (const Type &x)
template<typename Policy1 , typename Policy2 , typename Type >
Result_Relation cmp_mp (const Type &x, const Type &y)
template<typename Policy >
Result output_mpz (std::ostream &os, const mpz_class &from, const Numeric_Format &, Rounding_Dir)
int get_digit (int c, int base=10)
 Returns the integer value associated with the ASCII code c, in the base base positional number system, if there is such an association; returns $-1$ otherwise.
bool sum_sign (bool &a_neg, unsigned long &a_mod, bool b_neg, unsigned long b_mod)
 Adds the number represented (in the modulus-and-sign representation) by b_neg and b_mod to the number represented by a_neg and a_mod, assigning the result to the latter. Returns false is the result cannot be represented; returns true otherwise.
Result parse_number_part (std::istream &is, number_struct &num)
 Helper function for parse_number(): reads the numerator or denominator part of a number from is into num, returning the appropriate Result value.
Result parse_number (std::istream &is, number_struct &num, number_struct &den)

Variables

 Result_Relation
 const
From Result
From Type
From bool
From bool Type Type nonconst
From bool Type Type Result_Class
From bool Type Type Rounding_Dir To
From bool Type Type Rounding_Dir From
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir 
From1
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir 
From2
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned 
int
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir Rounding_Dir 
To1
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir Rounding_Dir 
To2
From bool Type Type
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
Rounding_Dir Rounding_Dir
unsigned Rounding_Dir unsigned
Rounding_Dir unsigned
Rounding_Dir Rounding_Dir 
To3
Enable_If
<(!Safe_Int_Comparison< S, U >
::value &&C_Integer< U >
::value &&C_Integer< S >
::is_signed), bool >::type 
lt (const S &x, const U &y)
Enable_If
<(!Safe_Int_Comparison< S, U >
::value &&C_Integer< U >
::value &&C_Integer< S >
::is_signed), bool >::type 
le (const S &x, const U &y)
Enable_If
<(!Safe_Int_Comparison< S, U >
::value &&C_Integer< U >
::value &&C_Integer< S >
::is_signed), bool >::type 
eq (const S &x, const U &y)
unsigned irrational_precision
 Holds the precision parameter used for irrational calculations.

Detailed Description

Types and functions implementing checked numbers.


Typedef Documentation

Definition at line 48 of file checked_int.inlines.hh.

Definition at line 52 of file checked_int.inlines.hh.

Definition at line 56 of file checked_int.inlines.hh.

This is assumed to be the type of the _mp_size field of GMP's __mpz_struct.

Definition at line 58 of file checked_mpz.inlines.hh.

Definition at line 60 of file checked_int.inlines.hh.

Definition at line 64 of file checked_int.inlines.hh.

Definition at line 68 of file checked_int.inlines.hh.


Function Documentation

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::abs_float ( Type &  to,
const Type  from,
Rounding_Dir   
) [inline]

Definition at line 689 of file checked_float.inlines.hh.

00689                                                    {
00690   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00691     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00692   to = std::abs(from);
00693   return V_EQ;
00694 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::abs_generic ( To &  to,
const From &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 287 of file checked.inlines.hh.

00287                                                         {
00288   if (from < 0)
00289     return neg<To_Policy, From_Policy>(to, from, dir);
00290   else
00291     return assign<To_Policy, From_Policy>(to, from, dir);
00292 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::abs_mpq ( mpq_class &  to,
const mpq_class &  from,
Rounding_Dir   
) [inline]

Definition at line 424 of file checked_mpq.inlines.hh.

00424                                                             {
00425   to = abs(from);
00426   return V_EQ;
00427 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::abs_mpz ( mpz_class &  to,
const mpz_class &  from,
Rounding_Dir   
) [inline]

Definition at line 534 of file checked_mpz.inlines.hh.

00534                                                             {
00535   to = abs(from);
00536   return V_EQ;
00537 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_2exp_float ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 602 of file checked_float.inlines.hh.

References Type.

00602                                                                            {
00603   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(x))
00604     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00605   PPL_ASSERT(exp < sizeof(unsigned long long) * CHAR_BIT);
00606   return
00607     add<To_Policy, From_Policy, Float_2exp>(to,
00608                                             x,
00609                                             Type(1ULL << exp),
00610                                             dir);
00611 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::add_2exp_mpq ( mpq_class &  to,
const mpq_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 343 of file checked_mpq.inlines.hh.

00344                            {
00345   PPL_DIRTY_TEMP(mpz_class, v);
00346   v = 1;
00347   mpz_mul_2exp(v.get_mpz_t(), v.get_mpz_t(), exp);
00348   to = x + v;
00349   return V_EQ;
00350 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::add_2exp_mpz ( mpz_class &  to,
const mpz_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 449 of file checked_mpz.inlines.hh.

00450                            {
00451   PPL_DIRTY_TEMP(mpz_class, v);
00452   v = 1;
00453   mpz_mul_2exp(v.get_mpz_t(), v.get_mpz_t(), exp);
00454   to = x + v;
00455   return V_EQ;
00456 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_2exp_signed_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1250 of file checked_int.inlines.hh.

References Type.

01251                                       {
01252   if (!To_Policy::check_overflow) {
01253     to = x + (Type(1) << exp);
01254     return V_EQ;
01255   }
01256   if (exp >= sizeof(Type) * CHAR_BIT)
01257     return set_pos_overflow_int<To_Policy>(to, dir);
01258   if (exp == sizeof(Type) * CHAR_BIT - 1) {
01259     Type n = -2 * (Type(1) << (exp - 1));
01260     return sub_signed_int<To_Policy, From_Policy, void>(to, x, n, dir);
01261   }
01262   else {
01263     Type n = Type(1) << exp;
01264     return add_signed_int<To_Policy, From_Policy, void>(to, x, n, dir);
01265   }
01266 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_2exp_unsigned_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1236 of file checked_int.inlines.hh.

References Type.

01237                                         {
01238   if (!To_Policy::check_overflow) {
01239     to = x + (Type(1) << exp);
01240     return V_EQ;
01241   }
01242   if (exp >= sizeof(Type) * CHAR_BIT)
01243     return set_pos_overflow_int<To_Policy>(to, dir);
01244   Type n = Type(1) << exp;
01245   return add_unsigned_int<To_Policy, From_Policy, void>(to, x, n, dir);
01246 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 437 of file checked_float.inlines.hh.

References fpu_direct_rounding(), fpu_inverse_rounding(), and limit_precision().

00437                                                                   {
00438   if (To_Policy::check_inf_add_inf
00439       && is_inf_float<From1_Policy>(x) && x == -y) {
00440     return assign_nan<To_Policy>(to, V_INF_ADD_INF);
00441   }
00442   prepare_inexact<To_Policy>(dir);
00443   if (fpu_direct_rounding(dir))
00444     to = x + y;
00445   else if (fpu_inverse_rounding(dir)) {
00446     to = -x - y;
00447     limit_precision(to);
00448     to = -to;
00449   }
00450   else {
00451     fpu_rounding_control_word_type old
00452       = fpu_save_rounding_direction(round_fpu_dir(dir));
00453     limit_precision(x);
00454     limit_precision(y);
00455     to = x + y;
00456     limit_precision(to);
00457     fpu_restore_rounding_direction(old);
00458   }
00459   if (To_Policy::fpu_check_nan_result && is_nan<To_Policy>(to))
00460     return V_NAN;
00461   return result_relation<To_Policy>(dir);
00462 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_int_larger ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 930 of file checked_int.inlines.hh.

00930                                                                        {
00931   typename Larger<Type>::type_for_add l = x;
00932   l += y;
00933   return assign<To_Policy, To_Policy>(to, l, dir);
00934 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::add_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir   
) [inline]

Definition at line 277 of file checked_mpq.inlines.hh.

00277                                                                              {
00278   to = x + y;
00279   return V_EQ;
00280 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::add_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 361 of file checked_mpz.inlines.hh.

00361                                                                              {
00362   to = x + y;
00363   return V_EQ;
00364 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_mul_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 914 of file checked_float.inlines.hh.

References fma(), fpu_direct_rounding(), fpu_inverse_rounding(), and limit_precision().

00914                                                                       {
00915   if (To_Policy::check_inf_mul_zero
00916       && ((x == 0 && is_inf_float<From2_Policy>(y))
00917           ||
00918           (y == 0 && is_inf_float<From1_Policy>(x)))) {
00919     return assign_nan<To_Policy>(to, V_INF_MUL_ZERO);
00920   }
00921   // FIXME: missing check_inf_add_inf
00922   prepare_inexact<To_Policy>(dir);
00923   if (fpu_direct_rounding(dir))
00924     to = fma(x, y, to);
00925   else if (fpu_inverse_rounding(dir)) {
00926     to = fma(-x, y, -to);
00927     limit_precision(to);
00928     to = -to;
00929   }
00930   else {
00931     fpu_rounding_control_word_type old
00932       = fpu_save_rounding_direction(round_fpu_dir(dir));
00933     limit_precision(x);
00934     limit_precision(y);
00935     limit_precision(to);
00936     to = fma(x, y, to);
00937     limit_precision(to);
00938     fpu_restore_rounding_direction(old);
00939   }
00940   if (To_Policy::fpu_check_nan_result && is_nan<To_Policy>(to))
00941     return V_NAN;
00942   return result_relation<To_Policy>(dir);
00943 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_mul_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1458 of file checked_int.inlines.hh.

References Result, and Type.

01458                                                                     {
01459   Type z;
01460   Result r = mul<To_Policy, From1_Policy, From2_Policy>(z, x, y, dir);
01461   switch (result_overflow(r)) {
01462   case 0:
01463     return add<To_Policy, To_Policy, To_Policy>(to, to, z, dir);
01464   case -1:
01465     if (to <= 0)
01466       return set_neg_overflow_int<To_Policy>(to, dir);
01467     return assign_nan<To_Policy>(to, V_UNKNOWN_NEG_OVERFLOW);
01468   case 1:
01469     if (to >= 0)
01470       return set_pos_overflow_int<To_Policy>(to, dir);
01471     return assign_nan<To_Policy>(to, V_UNKNOWN_POS_OVERFLOW);
01472   default:
01473     PPL_ASSERT(false);
01474     return V_NAN;
01475   }
01476 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::add_mul_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir   
) [inline]

Definition at line 433 of file checked_mpq.inlines.hh.

00434                           {
00435   to += x * y;
00436   return V_EQ;
00437 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::add_mul_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 543 of file checked_mpz.inlines.hh.

00544                           {
00545   mpz_addmul(to.get_mpz_t(), x.get_mpz_t(), y.get_mpz_t());
00546   return V_EQ;
00547 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_signed_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 977 of file checked_int.inlines.hh.

00977                                                                        {
00978   if (To_Policy::check_overflow && Larger<Type>::use_for_add)
00979     return add_int_larger<To_Policy, From1_Policy, From2_Policy>(to, x, y, dir);
00980   if (To_Policy::check_overflow) {
00981     if (y >= 0) {
00982       if (x > Extended_Int<To_Policy, Type>::max - y)
00983         return set_pos_overflow_int<To_Policy>(to, dir);
00984     }
00985     else if (x < Extended_Int<To_Policy, Type>::min - y)
00986         return set_neg_overflow_int<To_Policy>(to, dir);
00987   }
00988   to = x + y;
00989   return V_EQ;
00990 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::add_unsigned_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 994 of file checked_int.inlines.hh.

References CHECK_P.

00994                                                                          {
00995   if (To_Policy::check_overflow && Larger<Type>::use_for_add)
00996     return add_int_larger<To_Policy, From1_Policy, From2_Policy>(to, x, y, dir);
00997   if (CHECK_P(To_Policy::check_overflow,
00998               (x > Extended_Int<To_Policy, Type>::max - y)))
00999     return set_pos_overflow_int<To_Policy>(to, dir);
01000   to = x + y;
01001   return V_EQ;
01002 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_exact ( To &  to,
const From &  from,
Rounding_Dir   
) [inline]

Definition at line 274 of file checked.inlines.hh.

00274                                                      {
00275   to = from;
00276   return V_EQ;
00277 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_float_float ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 361 of file checked_float.inlines.hh.

References From, and To.

00361                                                               {
00362   if (sizeof(From) > sizeof(To))
00363     return assign_float_float_inexact<To_Policy, From_Policy>(to, from, dir);
00364   else
00365     return assign_float_float_exact<To_Policy, From_Policy>(to, from, dir);
00366 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_float_float_exact ( To &  to,
const From  from,
Rounding_Dir   
) [inline]

Definition at line 327 of file checked_float.inlines.hh.

00327                                                                 {
00328   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00329     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00330   to = from;
00331   return V_EQ;
00332 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_float_float_inexact ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 336 of file checked_float.inlines.hh.

References fpu_direct_rounding(), fpu_inverse_rounding(), From, and limit_precision().

00336                                                                       {
00337   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00338     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00339   prepare_inexact<To_Policy>(dir);
00340   if (fpu_direct_rounding(dir))
00341     to = from;
00342   else if (fpu_inverse_rounding(dir)) {
00343     From tmp = -from;
00344     to = tmp;
00345     limit_precision(to);
00346     to = -to;
00347   }
00348   else {
00349     fpu_rounding_control_word_type old
00350       = fpu_save_rounding_direction(round_fpu_dir(dir));
00351     limit_precision(from);
00352     to = from;
00353     limit_precision(to);
00354     fpu_restore_rounding_direction(old);
00355   }
00356   return result_relation<To_Policy>(dir);
00357 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_float_int ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 760 of file checked_float.inlines.hh.

References From.

00760                                                             {
00761   if (sizeof(From) * CHAR_BIT > Float<To>::Binary::MANTISSA_BITS)
00762     return assign_float_int_inexact<To_Policy, From_Policy>(to, from, dir);
00763   else
00764     return assign_exact<To_Policy, From_Policy>(to, from, dir);
00765 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_float_int_inexact ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 744 of file checked_float.inlines.hh.

References fpu_direct_rounding(), and limit_precision().

00744                                                                     {
00745   prepare_inexact<To_Policy>(dir);
00746   if (fpu_direct_rounding(dir))
00747     to = from;
00748   else {
00749     fpu_rounding_control_word_type old
00750       = fpu_save_rounding_direction(round_fpu_dir(dir));
00751     to = from;
00752     limit_precision(to);
00753     fpu_restore_rounding_direction(old);
00754   }
00755   return result_relation<To_Policy>(dir);
00756 }

template<typename To_Policy , typename From_Policy , typename T >
Result Parma_Polyhedra_Library::Checked::assign_float_mpq ( T &  to,
const mpq_class &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 843 of file checked_float.inlines.hh.

References Parma_Polyhedra_Library::Bool< false >::value.

00844 {
00845   const mpz_class& _num = from.get_num();
00846   const mpz_class& _den = from.get_den();
00847   if (_den == 1)
00848     return assign_float_mpz<To_Policy, From_Policy>(to, _num, dir);
00849   mpz_srcptr num = _num.get_mpz_t();
00850   mpz_srcptr den = _den.get_mpz_t();
00851   int sign = mpz_sgn(num);
00852   signed long exponent = mpz_sizeinbase(num, 2) - mpz_sizeinbase(den, 2);
00853   if (exponent < Float<T>::Binary::EXPONENT_MIN_DENORM) {
00854     to = 0;
00855   inexact:
00856     if (sign < 0)
00857       return round_lt_float<To_Policy>(to, dir);
00858     else
00859       return round_gt_float<To_Policy>(to, dir);
00860   }
00861   if (exponent > int(Float<T>::Binary::EXPONENT_MAX + 1)) {
00862   overflow:
00863     if (sign < 0)
00864       return set_neg_overflow_float<To_Policy>(to, dir);
00865     else
00866       return set_pos_overflow_float<To_Policy>(to, dir);
00867   }
00868   unsigned int needed_bits = Float<T>::Binary::MANTISSA_BITS + 1;
00869   if (exponent < Float<T>::Binary::EXPONENT_MIN)
00870     needed_bits -= Float<T>::Binary::EXPONENT_MIN - exponent;
00871   mpz_t mantissa;
00872   mpz_init(mantissa);
00873   signed long shift = needed_bits - exponent;
00874   if (shift > 0) {
00875     mpz_mul_2exp(mantissa, num, shift);
00876     num = mantissa;
00877   }
00878   else if (shift < 0) {
00879     mpz_mul_2exp(mantissa, den, -shift);
00880     den = mantissa;
00881   }
00882   mpz_t r;
00883   mpz_init(r);
00884   mpz_tdiv_qr(mantissa, r, num, den);
00885   size_t bits = mpz_sizeinbase(mantissa, 2);
00886   bool inexact = (mpz_sgn(r) != 0);
00887   mpz_clear(r);
00888   if (bits == needed_bits + 1) {
00889     inexact = (inexact || mpz_odd_p(mantissa));
00890     mpz_tdiv_q_2exp(mantissa, mantissa, 1);
00891   }
00892   else
00893     --exponent;
00894   if (exponent > int(Float<T>::Binary::EXPONENT_MAX)) {
00895     mpz_clear(mantissa);
00896     goto overflow;
00897   }
00898   else if (exponent < Float<T>::Binary::EXPONENT_MIN - 1) {
00899     // Denormalized.
00900     exponent = Float<T>::Binary::EXPONENT_MIN - 1;
00901   }
00902   Float<T> f;
00903   f.u.binary.build(sign < 0, mantissa, exponent);
00904   mpz_clear(mantissa);
00905   to = f.value();
00906   if (inexact)
00907     goto inexact;
00908   return V_EQ;
00909 }

template<typename To_Policy , typename From_Policy , typename T >
Result Parma_Polyhedra_Library::Checked::assign_float_mpz ( T &  to,
const mpz_class &  _from,
Rounding_Dir  dir 
) [inline]

Definition at line 803 of file checked_float.inlines.hh.

References Parma_Polyhedra_Library::Bool< false >::value.

00804 {
00805   mpz_srcptr from = _from.get_mpz_t();
00806   int sign = mpz_sgn(from);
00807   if (sign == 0) {
00808     to = 0;
00809     return V_EQ;
00810   }
00811   size_t exponent = mpz_sizeinbase(from, 2) - 1;
00812   if (exponent > size_t(Float<T>::Binary::EXPONENT_MAX)) {
00813     if (sign < 0)
00814       return set_neg_overflow_float<To_Policy>(to, dir);
00815     else
00816       return set_pos_overflow_float<To_Policy>(to, dir);
00817   }
00818   unsigned long zeroes = mpn_scan1(from->_mp_d, 0);
00819   size_t meaningful_bits = exponent - zeroes;
00820   mpz_t mantissa;
00821   mpz_init(mantissa);
00822   if (exponent > Float<T>::Binary::MANTISSA_BITS)
00823     mpz_tdiv_q_2exp(mantissa,
00824                     from,
00825                     exponent - Float<T>::Binary::MANTISSA_BITS);
00826   else
00827     mpz_mul_2exp(mantissa, from, Float<T>::Binary::MANTISSA_BITS - exponent);
00828   Float<T> f;
00829   f.u.binary.build(sign < 0, mantissa, exponent);
00830   mpz_clear(mantissa);
00831   to = f.value();
00832   if (meaningful_bits > Float<T>::Binary::MANTISSA_BITS) {
00833     if (sign < 0)
00834       return round_lt_float<To_Policy>(to, dir);
00835     else
00836       return round_gt_float<To_Policy>(to, dir);
00837   }
00838   return V_EQ;
00839 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_int_float ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 522 of file checked_int.inlines.hh.

References CHECK_P, From, le, lt, and rint().

00522                                                             {
00523   if (is_nan<From_Policy>(from))
00524     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00525   else if (is_minf<From_Policy>(from))
00526     return assign_special<To_Policy>(to, VC_MINUS_INFINITY, dir);
00527   else if (is_pinf<From_Policy>(from))
00528     return assign_special<To_Policy>(to, VC_PLUS_INFINITY, dir);
00529 #if 0
00530   // FIXME: this is correct but it is inefficient and breaks the build
00531   // for the missing definition of static const members (a problem present
00532   // also in other areas of the PPL).
00533   if (CHECK_P(To_Policy::check_overflow, lt(from, Extended_Int<To_Policy, To>::min)))
00534     return set_neg_overflow_int<To_Policy>(to, dir);
00535   if (CHECK_P(To_Policy::check_overflow, !le(from, Extended_Int<To_Policy, To>::max)))
00536     return set_pos_overflow_int<To_Policy>(to, dir);
00537 #else
00538   if (CHECK_P(To_Policy::check_overflow, (from < Extended_Int<To_Policy, To>::min)))
00539     return set_neg_overflow_int<To_Policy>(to, dir);
00540   if (CHECK_P(To_Policy::check_overflow, (from > Extended_Int<To_Policy, To>::max)))
00541     return set_pos_overflow_int<To_Policy>(to, dir);
00542 #endif
00543   if (round_not_requested(dir)) {
00544     to = from;
00545     return V_LGE;
00546   }
00547   From i_from = rint(from);
00548   to = i_from;
00549   if (from == i_from)
00550     return V_EQ;
00551   if (round_direct(ROUND_UP))
00552     return round_lt_int<To_Policy>(to, dir);
00553   if (round_direct(ROUND_DOWN))
00554     return round_gt_int<To_Policy>(to, dir);
00555   if (from < i_from)
00556     return round_lt_int<To_Policy>(to, dir);
00557   if (from > i_from)
00558     return round_gt_int<To_Policy>(to, dir);
00559   PPL_ASSERT(false);
00560   return V_NAN;
00561 }

template<typename To_Policy , typename From_Policy , typename To >
Result Parma_Polyhedra_Library::Checked::assign_int_mpq ( To &  to,
const mpq_class &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 699 of file checked_int.inlines.hh.

References Result.

00699                                                                 {
00700   mpz_srcptr n = from.get_num().get_mpz_t();
00701   mpz_srcptr d = from.get_den().get_mpz_t();
00702   PPL_DIRTY_TEMP0(mpz_class, q);
00703   mpz_ptr _q = q.get_mpz_t();
00704   if (round_not_requested(dir)) {
00705     mpz_tdiv_q(_q, n, d);
00706     Result r = assign<To_Policy, void>(to, q, dir);
00707     if (r != V_EQ)
00708       return r;
00709     return V_LGE;
00710   }
00711   mpz_t rem;
00712   int sign;
00713   mpz_init(rem);
00714   mpz_tdiv_qr(_q, rem, n, d);
00715   sign = mpz_sgn(rem);
00716   mpz_clear(rem);
00717   Result r = assign<To_Policy, void>(to, q, dir);
00718   if (r != V_EQ)
00719     return r;
00720   switch (sign) {
00721   case -1:
00722     return round_lt_int<To_Policy>(to, dir);
00723   case 1:
00724     return round_gt_int<To_Policy>(to, dir);
00725   default:
00726     return V_EQ;
00727   }
00728 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpq_float ( mpq_class &  to,
const From &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 184 of file checked_mpq.inlines.hh.

00184                                                                     {
00185   if (is_nan<From_Policy>(from))
00186     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00187   else if (is_minf<From_Policy>(from))
00188     return assign_special<To_Policy>(to, VC_MINUS_INFINITY, dir);
00189   else if (is_pinf<From_Policy>(from))
00190     return assign_special<To_Policy>(to, VC_PLUS_INFINITY, dir);
00191   to = from;
00192   return V_EQ;
00193 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpq_long_double ( mpq_class &  to,
const From &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 515 of file checked_mpq.inlines.hh.

References input_mpq().

00515                                                                           {
00516   if (is_nan<From_Policy>(from))
00517     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00518   else if (is_minf<From_Policy>(from))
00519     return assign_special<To_Policy>(to, VC_MINUS_INFINITY, dir);
00520   else if (is_pinf<From_Policy>(from))
00521     return assign_special<To_Policy>(to, VC_PLUS_INFINITY, dir);
00522   // FIXME: this is an incredibly inefficient implementation!
00523   std::stringstream ss;
00524   output<From_Policy>(ss, from, Numeric_Format(), dir);
00525   return input_mpq(to, ss);
00526 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpq_signed_int ( mpq_class &  to,
const From  from,
Rounding_Dir   
) [inline]

Definition at line 200 of file checked_mpq.inlines.hh.

References From.

00200                                                                     {
00201   if (sizeof(From) <= sizeof(signed long))
00202     to = static_cast<signed long>(from);
00203   else {
00204     mpz_ptr m = to.get_num().get_mpz_t();
00205     if (from >= 0)
00206       mpz_import(m, 1, 1, sizeof(From), 0, 0, &from);
00207     else {
00208       From n = -from;
00209       mpz_import(m, 1, 1, sizeof(From), 0, 0, &n);
00210       mpz_neg(m, m);
00211     }
00212     to.get_den() = 1;
00213   }
00214   return V_EQ;
00215 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpq_unsigned_int ( mpq_class &  to,
const From  from,
Rounding_Dir   
) [inline]

Definition at line 221 of file checked_mpq.inlines.hh.

References From.

00221                                                                       {
00222   if (sizeof(From) <= sizeof(unsigned long))
00223     to = static_cast<unsigned long>(from);
00224   else {
00225     mpz_import(to.get_num().get_mpz_t(), 1, 1, sizeof(From), 0, 0, &from);
00226     to.get_den() = 1;
00227   }
00228   return V_EQ;
00229 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpz_float ( mpz_class &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 263 of file checked_mpz.inlines.hh.

References From, and rint().

00263                                                                    {
00264   if (is_nan<From_Policy>(from))
00265     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00266   else if (is_minf<From_Policy>(from))
00267     return assign_special<To_Policy>(to, VC_MINUS_INFINITY, dir);
00268   else if (is_pinf<From_Policy>(from))
00269     return assign_special<To_Policy>(to, VC_PLUS_INFINITY, dir);
00270   if (round_not_requested(dir)) {
00271     to = from;
00272     return V_LGE;
00273   }
00274   From i_from = rint(from);
00275   to = i_from;
00276   if (from == i_from)
00277     return V_EQ;
00278   if (round_direct(ROUND_UP))
00279     return round_lt_mpz<To_Policy>(to, dir);
00280   if (round_direct(ROUND_DOWN))
00281     return round_gt_mpz<To_Policy>(to, dir);
00282   if (from < i_from)
00283     return round_lt_mpz<To_Policy>(to, dir);
00284   if (from > i_from)
00285     return round_gt_mpz<To_Policy>(to, dir);
00286   PPL_ASSERT(false);
00287   return V_NAN;
00288 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpz_long_double ( mpz_class &  to,
const From &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 295 of file checked_mpz.inlines.hh.

References input_mpq(), and Result.

00295                                                                           {
00296   if (is_nan<From_Policy>(from))
00297     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00298   else if (is_minf<From_Policy>(from))
00299     return assign_special<To_Policy>(to, VC_MINUS_INFINITY, dir);
00300   else if (is_pinf<From_Policy>(from))
00301     return assign_special<To_Policy>(to, VC_PLUS_INFINITY, dir);
00302   // FIXME: this is an incredibly inefficient implementation!
00303   std::stringstream ss;
00304   output<From_Policy>(ss, from, Numeric_Format(), dir);
00305   PPL_DIRTY_TEMP0(mpq_class, tmp);
00306 #ifndef NDEBUG
00307   Result r =
00308 #endif
00309     input_mpq(tmp, ss);
00310   PPL_ASSERT(r == V_EQ);
00311   return assign<To_Policy, From_Policy>(to, tmp, dir);
00312 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::assign_mpz_mpq ( mpz_class &  to,
const mpq_class &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 318 of file checked_mpz.inlines.hh.

00318                                                                        {
00319   if (round_not_needed(dir)) {
00320     to = from.get_num();
00321     return V_LGE;
00322   }
00323   if (round_ignore(dir)) {
00324     to = from;
00325     return V_LGE;
00326   }
00327   mpz_srcptr n = from.get_num().get_mpz_t();
00328   mpz_srcptr d = from.get_den().get_mpz_t();
00329   if (round_down(dir)) {
00330     mpz_fdiv_q(to.get_mpz_t(), n, d);
00331     if (round_strict_relation(dir))
00332       return mpz_divisible_p(n, d) ? V_EQ : V_GT;
00333     return V_GE;
00334   }
00335   else {
00336     PPL_ASSERT(round_up(dir));
00337     mpz_cdiv_q(to.get_mpz_t(), n, d);
00338     if (round_strict_relation(dir))
00339       return mpz_divisible_p(n, d) ? V_EQ : V_LT;
00340     return V_LE;
00341   }
00342 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpz_signed_int ( mpz_class &  to,
const From  from,
Rounding_Dir   
) [inline]

Definition at line 231 of file checked_mpz.inlines.hh.

References From.

00231                                                                     {
00232   if (sizeof(From) <= sizeof(signed long))
00233     to = static_cast<signed long>(from);
00234   else {
00235     mpz_ptr m = to.get_mpz_t();
00236     if (from >= 0)
00237       mpz_import(m, 1, 1, sizeof(From), 0, 0, &from);
00238     else {
00239       From n = -from;
00240       mpz_import(m, 1, 1, sizeof(From), 0, 0, &n);
00241       mpz_neg(m, m);
00242     }
00243   }
00244   return V_EQ;
00245 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::assign_mpz_unsigned_int ( mpz_class &  to,
const From  from,
Rounding_Dir   
) [inline]

Definition at line 251 of file checked_mpz.inlines.hh.

References From.

00251                                                                       {
00252   if (sizeof(From) <= sizeof(unsigned long))
00253     to = static_cast<unsigned long>(from);
00254   else
00255     mpz_import(to.get_mpz_t(), 1, 1, sizeof(From), 0, 0, &from);
00256   return V_EQ;
00257 }

template<typename Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::assign_nan ( Type &  to,
Result  r 
) [inline]

Definition at line 624 of file checked.inlines.hh.

00624                                {
00625   assign_special<Policy>(to, VC_NAN, ROUND_IGNORE);
00626   return r;
00627 }

template<typename To_Policy , typename From_Policy , typename To >
Result Parma_Polyhedra_Library::Checked::assign_signed_int_mpz ( To &  to,
const mpz_class &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 608 of file checked_int.inlines.hh.

References PPL_GT_SILENT, PPL_LT_SILENT, and To.

00608                                                                        {
00609   if (sizeof(To) <= sizeof(signed long)) {
00610     if (!To_Policy::check_overflow) {
00611       to = from.get_si();
00612       return V_EQ;
00613     }
00614     if (from.fits_slong_p()) {
00615       signed long v = from.get_si();
00616       if (PPL_LT_SILENT(v, (Extended_Int<To_Policy, To>::min)))
00617         return set_neg_overflow_int<To_Policy>(to, dir);
00618       if (PPL_GT_SILENT(v, (Extended_Int<To_Policy, To>::max)))
00619         return set_pos_overflow_int<To_Policy>(to, dir);
00620       to = v;
00621       return V_EQ;
00622     }
00623   }
00624   else {
00625     mpz_srcptr m = from.get_mpz_t();
00626     size_t sz = mpz_size(m);
00627     if (sz <= sizeof(To) / sizeof(mp_limb_t)) {
00628       if (sz == 0) {
00629         to = 0;
00630         return V_EQ;
00631       }
00632       To v;
00633       mpz_export(&v, 0, -1, sizeof(To), 0, 0, m);
00634       if (v >= 0) {
00635         if (::sgn(from) < 0)
00636           return neg<To_Policy, To_Policy>(to, v, dir);
00637         to = v;
00638         return V_EQ;
00639       }
00640     }
00641   }
00642   return ::sgn(from) < 0
00643     ? set_neg_overflow_int<To_Policy>(to, dir)
00644     : set_pos_overflow_int<To_Policy>(to, dir);
00645 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_signed_int_signed_int ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 352 of file checked_int.inlines.hh.

References CHECK_P, From, PPL_GT_SILENT, PPL_LT_SILENT, and To.

00352                                                                         {
00353   if (sizeof(To) < sizeof(From)
00354       || (sizeof(To) == sizeof(From)
00355           && (Extended_Int<To_Policy, To>::min > Extended_Int<From_Policy, From>::min
00356               || Extended_Int<To_Policy, To>::max < Extended_Int<From_Policy, From>::max))) {
00357     if (CHECK_P(To_Policy::check_overflow,
00358                 PPL_LT_SILENT(from, From(Extended_Int<To_Policy, To>::min))))
00359       return set_neg_overflow_int<To_Policy>(to, dir);
00360     if (CHECK_P(To_Policy::check_overflow,
00361                 PPL_GT_SILENT(from, From(Extended_Int<To_Policy, To>::max))))
00362       return set_pos_overflow_int<To_Policy>(to, dir);
00363   }
00364   to = To(from);
00365   return V_EQ;
00366 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_signed_int_unsigned_int ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 370 of file checked_int.inlines.hh.

References CHECK_P, From, and To.

00370                                                                           {
00371   if (sizeof(To) <= sizeof(From)) {
00372     if (CHECK_P(To_Policy::check_overflow,
00373                 from > From(Extended_Int<To_Policy, To>::max)))
00374       return set_pos_overflow_int<To_Policy>(to, dir);
00375   }
00376   to = To(from);
00377   return V_EQ;
00378 }

template<typename Policy , typename T >
Result Parma_Polyhedra_Library::Checked::assign_special_float ( T &  v,
Result_Class  c,
Rounding_Dir   
) [inline]

Definition at line 206 of file checked_float.inlines.hh.

References PPL_NAN.

00206                                                          {
00207   switch (c) {
00208   case VC_MINUS_INFINITY:
00209     v = -HUGE_VAL;
00210     return V_EQ_MINUS_INFINITY;
00211   case VC_PLUS_INFINITY:
00212     v = HUGE_VAL;
00213     return V_EQ_PLUS_INFINITY;
00214   case VC_NAN:
00215     v = PPL_NAN;
00216     return V_NAN;
00217   default:
00218     PPL_ASSERT(false);
00219     return V_NAN | V_UNREPRESENTABLE;
00220   }
00221 }

template<typename Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::assign_special_int ( Type &  v,
Result_Class  c,
Rounding_Dir  dir 
) [inline]

Definition at line 304 of file checked_int.inlines.hh.

00304                                                               {
00305   switch (c) {
00306   case VC_NAN:
00307     if (Policy::has_nan) {
00308       v = Extended_Int<Policy, Type>::not_a_number;
00309       return V_NAN;
00310     }
00311     return V_NAN | V_UNREPRESENTABLE;
00312   case VC_MINUS_INFINITY:
00313     if (Policy::has_infinity) {
00314       v = Extended_Int<Policy, Type>::minus_infinity;
00315       return V_EQ_MINUS_INFINITY;
00316     }
00317     if (round_up(dir)) {
00318       v = Extended_Int<Policy, Type>::min;
00319       return V_LT_INF;
00320     }
00321     return V_EQ_MINUS_INFINITY | V_UNREPRESENTABLE;
00322   case VC_PLUS_INFINITY:
00323     if (Policy::has_infinity) {
00324       v = Extended_Int<Policy, Type>::plus_infinity;
00325       return V_EQ_PLUS_INFINITY;
00326     }
00327     if (round_down(dir)) {
00328       v = Extended_Int<Policy, Type>::max;
00329       return V_GT_SUP;
00330     }
00331     return V_EQ_PLUS_INFINITY | V_UNREPRESENTABLE;
00332   default:
00333     PPL_ASSERT(0);
00334     return V_NAN | V_UNREPRESENTABLE;
00335   }
00336 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::assign_special_mpq ( mpq_class &  v,
Result_Class  c,
Rounding_Dir   
) [inline]

Definition at line 103 of file checked_mpq.inlines.hh.

00103                                                                {
00104   switch (c) {
00105   case VC_NAN:
00106     if (Policy::has_nan) {
00107       v.get_num() = 0;
00108       v.get_den() = 0;
00109       return V_NAN | V_UNREPRESENTABLE;
00110     }
00111     return V_NAN;
00112   case VC_MINUS_INFINITY:
00113     if (Policy::has_infinity) {
00114       v.get_num() = -1;
00115       v.get_den() = 0;
00116       return V_EQ_MINUS_INFINITY;
00117     }
00118     return V_EQ_MINUS_INFINITY | V_UNREPRESENTABLE;
00119   case VC_PLUS_INFINITY:
00120     if (Policy::has_infinity) {
00121       v.get_num() = 1;
00122       v.get_den() = 0;
00123       return V_EQ_PLUS_INFINITY;
00124     }
00125     return V_EQ_PLUS_INFINITY | V_UNREPRESENTABLE;
00126   default:
00127     PPL_ASSERT(false);
00128     return V_NAN | V_UNREPRESENTABLE;
00129   }
00130 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::assign_special_mpz ( mpz_class &  v,
Result_Class  c,
Rounding_Dir   
) [inline]

Definition at line 133 of file checked_mpz.inlines.hh.

References set_mp_size().

00133                                                                {
00134   switch (c) {
00135   case VC_NAN:
00136     if (Policy::has_nan)
00137       set_mp_size(v, C_Integer<mp_size_field_t>::min + 1);
00138     return V_NAN;
00139   case VC_MINUS_INFINITY:
00140     if (Policy::has_infinity) {
00141       set_mp_size(v, C_Integer<mp_size_field_t>::min);
00142       return V_EQ_MINUS_INFINITY;
00143     }
00144     return V_EQ_MINUS_INFINITY | V_UNREPRESENTABLE;
00145   case VC_PLUS_INFINITY:
00146     if (Policy::has_infinity) {
00147       set_mp_size(v, C_Integer<mp_size_field_t>::max);
00148       return V_EQ_PLUS_INFINITY;
00149     }
00150     return V_EQ_PLUS_INFINITY | V_UNREPRESENTABLE;
00151   default:
00152     PPL_ASSERT(false);
00153     return V_NAN;
00154   }
00155 }

template<typename To_Policy , typename From_Policy , typename To >
Result Parma_Polyhedra_Library::Checked::assign_unsigned_int_mpz ( To &  to,
const mpz_class &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 658 of file checked_int.inlines.hh.

References CHECK_P, PPL_GT_SILENT, and To.

00658                                                                          {
00659   if (CHECK_P(To_Policy::check_overflow, ::sgn(from) < 0))
00660     return set_neg_overflow_int<To_Policy>(to, dir);
00661   if (sizeof(To) <= sizeof(unsigned long)) {
00662     if (!To_Policy::check_overflow) {
00663       to = from.get_ui();
00664       return V_EQ;
00665     }
00666     if (from.fits_ulong_p()) {
00667       unsigned long v = from.get_ui();
00668       if (PPL_GT_SILENT(v, (Extended_Int<To_Policy, To>::max)))
00669         return set_pos_overflow_int<To_Policy>(to, dir);
00670       to = v;
00671       return V_EQ;
00672     }
00673   }
00674   else {
00675     mpz_srcptr m = from.get_mpz_t();
00676     size_t sz = mpz_size(m);
00677     if (sz <= sizeof(To) / sizeof(mp_limb_t)) {
00678       if (sz == 0)
00679         to = 0;
00680       else
00681         mpz_export(&to, 0, -1, sizeof(To), 0, 0, m);
00682       return V_EQ;
00683     }
00684   }
00685   return set_pos_overflow_int<To_Policy>(to, dir);
00686 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_unsigned_int_signed_int ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 382 of file checked_int.inlines.hh.

References CHECK_P, From, and To.

00382                                                                           {
00383   if (CHECK_P(To_Policy::check_overflow, from < 0))
00384     return set_neg_overflow_int<To_Policy>(to, dir);
00385   if (sizeof(To) < sizeof(From)) {
00386     if (CHECK_P(To_Policy::check_overflow,
00387                 from > From(Extended_Int<To_Policy, To>::max)))
00388       return set_pos_overflow_int<To_Policy>(to, dir);
00389   }
00390   to = To(from);
00391   return V_EQ;
00392 }

template<typename To_Policy , typename From_Policy , typename To , typename From >
Result Parma_Polyhedra_Library::Checked::assign_unsigned_int_unsigned_int ( To &  to,
const From  from,
Rounding_Dir  dir 
) [inline]

Definition at line 396 of file checked_int.inlines.hh.

References CHECK_P, From, PPL_GT_SILENT, and To.

00396                                                                             {
00397   if (sizeof(To) < sizeof(From)
00398       || (sizeof(To) == sizeof(From)
00399           && Extended_Int<To_Policy, To>::max < Extended_Int<From_Policy, From>::max)) {
00400     if (CHECK_P(To_Policy::check_overflow,
00401                 PPL_GT_SILENT(from, From(Extended_Int<To_Policy, To>::max))))
00402       return set_pos_overflow_int<To_Policy>(to, dir);
00403   }
00404   to = To(from);
00405   return V_EQ;
00406 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::ceil_float ( Type &  to,
const Type  from,
Rounding_Dir   
) [inline]

Definition at line 393 of file checked_float.inlines.hh.

References fpu_direct_rounding(), fpu_inverse_rounding(), limit_precision(), and rint().

00393                                                     {
00394   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00395     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00396   if (fpu_direct_rounding(ROUND_UP))
00397     to = rint(from);
00398   else if (fpu_inverse_rounding(ROUND_UP)) {
00399     to = rint(-from);
00400     limit_precision(to);
00401     to = -to;
00402   }
00403   else {
00404     fpu_rounding_control_word_type old
00405       = fpu_save_rounding_direction(round_fpu_dir(ROUND_UP));
00406     limit_precision(from);
00407     to = rint(from);
00408     limit_precision(to);
00409     fpu_restore_rounding_direction(old);
00410   }
00411   return V_EQ;
00412 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::ceil_mpq ( mpq_class &  to,
const mpq_class &  from,
Rounding_Dir   
) [inline]

Definition at line 246 of file checked_mpq.inlines.hh.

00246                                                              {
00247   mpz_cdiv_q(to.get_num().get_mpz_t(),
00248              from.get_num().get_mpz_t(), from.get_den().get_mpz_t());
00249   to.get_den() = 1;
00250   return V_EQ;
00251 }

template<typename Policy , typename T >
Result Parma_Polyhedra_Library::Checked::classify_float ( const T  v,
bool  nan,
bool  inf,
bool  sign 
) [inline]

Definition at line 151 of file checked_float.inlines.hh.

References CHECK_P.

00151                                                          {
00152   Float<T> f(v);
00153   if ((nan || sign) && CHECK_P(Policy::has_nan, f.u.binary.is_nan()))
00154     return V_NAN;
00155   if (inf) {
00156     int i = CHECK_P(Policy::has_infinity, f.u.binary.is_inf());
00157     if (i < 0)
00158       return V_EQ_MINUS_INFINITY;
00159     if (i > 0)
00160       return V_EQ_PLUS_INFINITY;
00161   }
00162   if (sign) {
00163     if (v < 0)
00164       return V_LT;
00165     if (v > 0)
00166       return V_GT;
00167     return V_EQ;
00168   }
00169   return V_LGE;
00170 }

template<typename Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::classify_int ( const Type  v,
bool  nan,
bool  inf,
bool  sign 
) [inline]

Definition at line 193 of file checked_int.inlines.hh.

00193                                                           {
00194   if (Policy::has_nan
00195       && (nan || sign)
00196       && v == Extended_Int<Policy, Type>::not_a_number)
00197     return V_NAN;
00198   if (!inf && !sign)
00199     return V_LGE;
00200   if (Policy::has_infinity) {
00201     if (v == Extended_Int<Policy, Type>::minus_infinity)
00202       return inf ? V_EQ_MINUS_INFINITY : V_LT;
00203     if (v == Extended_Int<Policy, Type>::plus_infinity)
00204       return inf ? V_EQ_PLUS_INFINITY : V_GT;
00205   }
00206   if (sign) {
00207     if (v < 0)
00208       return V_LT;
00209     if (v > 0)
00210       return V_GT;
00211     return V_EQ;
00212   }
00213   return V_LGE;
00214 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::classify_mpq ( const mpq_class &  v,
bool  nan,
bool  inf,
bool  sign 
) [inline]

Definition at line 37 of file checked_mpq.inlines.hh.

References Result.

00037                                                                 {
00038   if ((Policy::has_nan || Policy::has_infinity)
00039       && ::sgn(v.get_den()) == 0) {
00040     int s = ::sgn(v.get_num());
00041     if (Policy::has_nan && (nan || sign) && s == 0)
00042       return V_NAN;
00043     if (!inf && !sign)
00044       return V_LGE;
00045     if (Policy::has_infinity) {
00046       if (s < 0)
00047         return inf ? V_EQ_MINUS_INFINITY : V_LT;
00048       if (s > 0)
00049         return inf ? V_EQ_PLUS_INFINITY : V_GT;
00050     }
00051   }
00052   if (sign)
00053     return (Result) sgn<Policy>(v);
00054   return V_LGE;
00055 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::classify_mpz ( const mpz_class &  v,
bool  nan,
bool  inf,
bool  sign 
) [inline]

Definition at line 73 of file checked_mpz.inlines.hh.

References get_mp_size(), and Result.

00073                                                                 {
00074   if (Policy::has_nan || Policy::has_infinity) {
00075     mp_size_field_t s = get_mp_size(v);
00076     if (Policy::has_nan
00077         && (nan || sign)
00078         && s == C_Integer<mp_size_field_t>::min + 1)
00079       return V_NAN;
00080     if (!inf && !sign)
00081       return V_LGE;
00082     if (Policy::has_infinity) {
00083       if (s == C_Integer<mp_size_field_t>::min)
00084         return inf ? V_EQ_MINUS_INFINITY : V_LT;
00085       if (s == C_Integer<mp_size_field_t>::max)
00086         return inf ? V_EQ_PLUS_INFINITY : V_GT;
00087     }
00088   }
00089   if (sign)
00090     return (Result) sgn<Policy>(v);
00091   return V_LGE;
00092 }

template<typename Policy1 , typename Policy2 , typename Type >
Result_Relation Parma_Polyhedra_Library::Checked::cmp_float ( const Type  x,
const Type  y 
) [inline]

Definition at line 732 of file checked_float.inlines.hh.

00732                                       {
00733   if (x > y)
00734     return VR_GT;
00735   if (x < y)
00736     return VR_LT;
00737   if (x == y)
00738     return VR_EQ;
00739   return VR_EMPTY;
00740 }

template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
Result_Relation Parma_Polyhedra_Library::Checked::cmp_generic ( const Type1 &  x,
const Type2 &  y 
) [inline]

Definition at line 614 of file checked.inlines.hh.

00614                                             {
00615   if (lt(y, x))
00616     return VR_GT;
00617   if (lt(x, y))
00618     return VR_LT;
00619   return VR_EQ;
00620 }

template<typename Policy1 , typename Policy2 , typename Type >
Result_Relation Parma_Polyhedra_Library::Checked::cmp_mp ( const Type &  x,
const Type &  y 
) [inline]

Definition at line 622 of file checked_mpz.inlines.hh.

References Parma_Polyhedra_Library::cmp().

00622                                      {
00623   int i = ::cmp(x, y);
00624   return i > 0 ? VR_GT : i < 0 ? VR_LT : VR_EQ;
00625 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::construct_mpq_base ( mpq_class &  to,
const From &  from,
Rounding_Dir   
) [inline]

Definition at line 138 of file checked_mpq.inlines.hh.

00138                                                                   {
00139   new (&to) mpq_class(from);
00140   return V_EQ;
00141 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::construct_mpq_float ( mpq_class &  to,
const From &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 156 of file checked_mpq.inlines.hh.

00156                                                                        {
00157   if (is_nan<From_Policy>(from))
00158     return construct_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00159   else if (is_minf<From_Policy>(from))
00160     return construct_special<To_Policy>(to, VC_MINUS_INFINITY, dir);
00161   else if (is_pinf<From_Policy>(from))
00162     return construct_special<To_Policy>(to, VC_PLUS_INFINITY, dir);
00163   new (&to) mpq_class(from);
00164   return V_EQ;
00165 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::construct_mpz_base ( mpz_class &  to,
const From  from,
Rounding_Dir   
) [inline]

Definition at line 177 of file checked_mpz.inlines.hh.

00177                                                                  {
00178     new (&to) mpz_class(from);
00179     return V_EQ;
00180 }

template<typename To_Policy , typename From_Policy , typename From >
Result Parma_Polyhedra_Library::Checked::construct_mpz_float ( mpz_class &  to,
const From &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 194 of file checked_mpz.inlines.hh.

References From, and rint().

00194                                                                        {
00195   if (is_nan<From_Policy>(from))
00196     return construct_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00197   else if (is_minf<From_Policy>(from))
00198     return construct_special<To_Policy>(to, VC_MINUS_INFINITY, dir);
00199   else if (is_pinf<From_Policy>(from))
00200     return construct_special<To_Policy>(to, VC_PLUS_INFINITY, dir);
00201   if (round_not_requested(dir)) {
00202     new (&to) mpz_class(from);
00203     return V_LGE;
00204   }
00205   From n = rint(from);
00206   new (&to) mpz_class(n);
00207   if (from == n)
00208     return V_EQ;
00209   if (from < 0)
00210     return round_lt_mpz<To_Policy>(to, dir);
00211   else
00212     return round_gt_mpz<To_Policy>(to, dir);
00213 }

template<typename To_Policy , typename From_Policy , typename Type >
Enable_If<Is_Same<To_Policy, From_Policy>::value, void>::type Parma_Polyhedra_Library::Checked::copy_generic ( Type &  to,
const Type &  from 
) [inline]

Definition at line 281 of file checked.inlines.hh.

00281                                          {
00282   to = from;
00283 }

template<typename To_Policy , typename From_Policy >
void Parma_Polyhedra_Library::Checked::copy_mpz ( mpz_class &  to,
const mpz_class &  from 
) [inline]

Definition at line 161 of file checked_mpz.inlines.hh.

References get_mp_size(), and set_mp_size().

00161                                                {
00162   if (is_nan_mpz<From_Policy>(from))
00163     PPL_ASSERT(To_Policy::has_nan);
00164   else if (is_minf_mpz<From_Policy>(from) || is_pinf_mpz<From_Policy>(from))
00165     PPL_ASSERT(To_Policy::has_infinity);
00166   else {
00167     to = from;
00168     return;
00169   }
00170   set_mp_size(to, get_mp_size(from));
00171 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::div_2exp_float ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 641 of file checked_float.inlines.hh.

References Type.

00641                                                                            {
00642   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(x))
00643     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00644   PPL_ASSERT(exp < sizeof(unsigned long long) * CHAR_BIT);
00645   return
00646     div<To_Policy, From_Policy, Float_2exp>(to,
00647                                             x,
00648                                             Type(1ULL << exp),
00649                                             dir);
00650 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::div_2exp_mpq ( mpq_class &  to,
const mpq_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 381 of file checked_mpq.inlines.hh.

00382                            {
00383   to.get_num() = x.get_num();
00384   mpz_mul_2exp(to.get_den().get_mpz_t(), x.get_den().get_mpz_t(), exp);
00385   to.canonicalize();
00386   return V_EQ;
00387 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::div_2exp_mpz ( mpz_class &  to,
const mpz_class &  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 485 of file checked_mpz.inlines.hh.

00486                                {
00487   mpz_srcptr n = x.get_mpz_t();
00488   if (round_not_requested(dir)) {
00489     mpz_tdiv_q_2exp(to.get_mpz_t(), x.get_mpz_t(), exp);
00490     return V_LGE;
00491   }
00492   if (round_down(dir)) {
00493     mpz_fdiv_q_2exp(to.get_mpz_t(), n, exp);
00494     if (round_strict_relation(dir))
00495       return mpz_divisible_2exp_p(n, exp) ? V_EQ : V_GT;
00496     return V_GE;
00497   }
00498   else {
00499     PPL_ASSERT(round_up(dir));
00500     mpz_cdiv_q_2exp(to.get_mpz_t(), n, exp);
00501     if (round_strict_relation(dir))
00502       return mpz_divisible_2exp_p(n, exp) ? V_EQ : V_LT;
00503     return V_LE;
00504   }
00505 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::div_2exp_signed_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1191 of file checked_int.inlines.hh.

References Type.

01192                                       {
01193   if (exp > sizeof(Type) * CHAR_BIT - 1) {
01194   zero:
01195     to = 0;
01196     if (round_not_requested(dir))
01197       return V_LGE;
01198     if (x < 0)
01199       return round_lt_int_no_overflow<To_Policy>(to, dir);
01200     else if (x > 0)
01201       return round_gt_int_no_overflow<To_Policy>(to, dir);
01202     else
01203       return V_EQ;
01204   }
01205   if (exp == sizeof(Type) * CHAR_BIT - 1) {
01206     if (x == C_Integer<Type>::min) {
01207       to = -1;
01208       return V_EQ;
01209     }
01210     goto zero;
01211   }
01212 #if 0
01213   to = x / (Type(1) << exp);
01214   if (round_not_requested(dir))
01215     return V_GE;
01216   Type r = x % (Type(1) << exp);
01217   if (r < 0)
01218     return round_lt_int_no_overflow<To_Policy>(to, dir);
01219   else if (r > 0)
01220     return round_gt_int_no_overflow<To_Policy>(to, dir);
01221   else
01222     return V_EQ;
01223 #else
01224   // Faster but compiler implementation dependent (see C++98 5.8.3)
01225   to = x >> exp;
01226   if (round_not_requested(dir))
01227     return V_GE;
01228   if (x & ((Type(1) << exp) - 1))
01229     return round_gt_int_no_overflow<To_Policy>(to, dir);
01230   return V_EQ;
01231 #endif
01232 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::div_2exp_unsigned_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1170 of file checked_int.inlines.hh.

References Type.

01171                                         {
01172   if (exp >= sizeof(Type) * CHAR_BIT) {
01173     to = 0;
01174     if (round_not_requested(dir))
01175       return V_GE;
01176     if (x == 0)
01177       return V_EQ;
01178     return round_gt_int_no_overflow<To_Policy>(to, dir);
01179   }
01180   to = x >> exp;
01181   if (round_not_requested(dir))
01182     return V_GE;
01183   if (x & ((Type(1) << exp) - 1))
01184     return round_gt_int_no_overflow<To_Policy>(to, dir);
01185   else
01186     return V_EQ;
01187 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::div_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 529 of file checked_float.inlines.hh.

References fpu_direct_rounding(), fpu_inverse_rounding(), and limit_precision().

00529                                                                   {
00530   if (To_Policy::check_inf_div_inf
00531       && is_inf_float<From1_Policy>(x) && is_inf_float<From2_Policy>(y)) {
00532     return assign_nan<To_Policy>(to, V_INF_DIV_INF);
00533   }
00534   if (To_Policy::check_div_zero && y == 0) {
00535     return assign_nan<To_Policy>(to, V_DIV_ZERO);
00536   }
00537   prepare_inexact<To_Policy>(dir);
00538   if (fpu_direct_rounding(dir))
00539     to = x / y;
00540   else if (fpu_inverse_rounding(dir)) {
00541     to = x / -y;
00542     limit_precision(to);
00543     to = -to;
00544   }
00545   else {
00546     fpu_rounding_control_word_type old
00547       = fpu_save_rounding_direction(round_fpu_dir(dir));
00548     limit_precision(x);
00549     limit_precision(y);
00550     to = x / y;
00551     limit_precision(to);
00552     fpu_restore_rounding_direction(old);
00553   }
00554   if (To_Policy::fpu_check_nan_result && is_nan<To_Policy>(to))
00555     return V_NAN;
00556   return result_relation<To_Policy>(dir);
00557 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::div_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir   
) [inline]

Definition at line 304 of file checked_mpq.inlines.hh.

References CHECK_P.

00304                                                                              {
00305   if (CHECK_P(To_Policy::check_div_zero, sgn(y) == 0)) {
00306     return assign_nan<To_Policy>(to, V_DIV_ZERO);
00307   }
00308   to = x / y;
00309   return V_EQ;
00310 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::div_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir  dir 
) [inline]

Definition at line 388 of file checked_mpz.inlines.hh.

References CHECK_P.

00389                           {
00390   if (CHECK_P(To_Policy::check_div_zero, ::sgn(y) == 0)) {
00391     return assign_nan<To_Policy>(to, V_DIV_ZERO);
00392   }
00393   mpz_srcptr n = x.get_mpz_t();
00394   mpz_srcptr d = y.get_mpz_t();
00395   if (round_not_needed(dir)) {
00396     mpz_divexact(to.get_mpz_t(), n, d);
00397     return V_LGE;
00398   }
00399   if (round_ignore(dir)) {
00400     mpz_cdiv_q(to.get_mpz_t(), n, d);
00401     return V_LE;
00402   }
00403   if (round_down(dir)) {
00404     mpz_fdiv_q(to.get_mpz_t(), n, d);
00405     if (round_strict_relation(dir))
00406       return mpz_divisible_p(n, d) ? V_EQ : V_GT;
00407     return V_GE;
00408   }
00409   else {
00410     PPL_ASSERT(round_up(dir));
00411     mpz_cdiv_q(to.get_mpz_t(), n, d);
00412     if (round_strict_relation(dir))
00413       return mpz_divisible_p(n, d) ? V_EQ : V_LT;
00414     return V_LE;
00415   }
00416 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::div_signed_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1093 of file checked_int.inlines.hh.

References CHECK_P, and Type.

01093                                                                        {
01094   if (CHECK_P(To_Policy::check_div_zero, y == 0)) {
01095     return assign_nan<To_Policy>(to, V_DIV_ZERO);
01096   }
01097   if (To_Policy::check_overflow && y == -1)
01098     return neg_signed_int<To_Policy, From1_Policy>(to, x, dir);
01099   to = x / y;
01100   if (round_not_requested(dir))
01101     return V_LGE;
01102   Type m = x % y;
01103   if (m < 0)
01104     return round_lt_int_no_overflow<To_Policy>(to, dir);
01105   else if (m > 0)
01106     return round_gt_int_no_overflow<To_Policy>(to, dir);
01107   else
01108     return V_EQ;
01109 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::div_unsigned_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1113 of file checked_int.inlines.hh.

References CHECK_P, and Type.

01113                                                                          {
01114   if (CHECK_P(To_Policy::check_div_zero, y == 0)) {
01115     return assign_nan<To_Policy>(to, V_DIV_ZERO);
01116   }
01117   to = x / y;
01118   if (round_not_requested(dir))
01119     return V_GE;
01120   Type m = x % y;
01121   if (m == 0)
01122     return V_EQ;
01123   return round_gt_int<To_Policy>(to, dir);
01124 }

template<typename T1 , typename T2 >
Enable_If<(Safe_Int_Comparison<T1, T2>::value || Safe_Conversion<T1, T2>::value || Safe_Conversion<T2, T1>::value), bool>::type Parma_Polyhedra_Library::Checked::eq ( const T1 &  x,
const T2 &  y 
) [inline]

Definition at line 476 of file checked.inlines.hh.

00476                              {
00477   return x == y;
00478 }

template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
bool Parma_Polyhedra_Library::Checked::eq_p ( const Type1 &  x,
const Type2 &  y 
) [inline]

Definition at line 607 of file checked.inlines.hh.

00607                                      {
00608   return eq(x, y);
00609 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::floor_float ( Type &  to,
const Type  from,
Rounding_Dir   
) [inline]

Definition at line 370 of file checked_float.inlines.hh.

References fpu_direct_rounding(), fpu_inverse_rounding(), limit_precision(), and rint().

00370                                                      {
00371   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00372     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00373   if (fpu_direct_rounding(ROUND_DOWN))
00374     to = rint(from);
00375   else if (fpu_inverse_rounding(ROUND_DOWN)) {
00376     to = rint(-from);
00377     limit_precision(to);
00378     to = -to;
00379   }
00380   else {
00381     fpu_rounding_control_word_type old
00382       = fpu_save_rounding_direction(round_fpu_dir(ROUND_DOWN));
00383     limit_precision(from);
00384     to = rint(from);
00385     limit_precision(to);
00386     fpu_restore_rounding_direction(old);
00387   }
00388   return V_EQ;
00389 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::floor_mpq ( mpq_class &  to,
const mpq_class &  from,
Rounding_Dir   
) [inline]

Definition at line 235 of file checked_mpq.inlines.hh.

00235                                                               {
00236   mpz_fdiv_q(to.get_num().get_mpz_t(),
00237              from.get_num().get_mpz_t(), from.get_den().get_mpz_t());
00238   to.get_den() = 1;
00239   return V_EQ;
00240 }

long double Parma_Polyhedra_Library::Checked::fma ( long double  x,
long double  y,
long double  z 
) [inline]

Definition at line 57 of file checked_float.inlines.hh.

00057                                                  {
00058 #if PPL_HAVE_DECL_FMAL && defined(FP_FAST_FMAL) \
00059   && !defined(__alpha) && !defined(__FreeBSD__)
00060   return ::fmal(x, y, z);
00061 #else
00062   return x*y + z;
00063 #endif
00064 }

double Parma_Polyhedra_Library::Checked::fma ( double  x,
double  y,
double  z 
) [inline]

Definition at line 47 of file checked_float.inlines.hh.

References fma().

00047                                   {
00048 #if PPL_HAVE_DECL_FMA && defined(FP_FAST_FMA) \
00049   && !defined(__alpha) && !defined(__FreeBSD__)
00050   return ::fma(x, y, z);
00051 #else
00052   return x*y + z;
00053 #endif
00054 }

float Parma_Polyhedra_Library::Checked::fma ( float  x,
float  y,
float  z 
) [inline]

Definition at line 37 of file checked_float.inlines.hh.

Referenced by add_mul_float(), fma(), and sub_mul_float().

00037                                {
00038 #if PPL_HAVE_DECL_FMAF && defined(FP_FAST_FMAF) \
00039   && !defined(__alpha) && !defined(__FreeBSD__)
00040   return ::fmaf(x, y, z);
00041 #else
00042   return x*y + z;
00043 #endif
00044 }

bool Parma_Polyhedra_Library::Checked::fpu_direct_rounding ( Rounding_Dir  dir  )  [inline]

Definition at line 102 of file checked_float.inlines.hh.

Referenced by add_float(), add_mul_float(), assign_float_float_inexact(), assign_float_int_inexact(), ceil_float(), div_float(), floor_float(), mul_float(), sqrt_float(), sub_float(), and sub_mul_float().

00102                                       {
00103   return round_direct(dir) || round_not_requested(dir);
00104 }

bool Parma_Polyhedra_Library::Checked::fpu_inverse_rounding ( Rounding_Dir  dir  )  [inline]

Definition at line 107 of file checked_float.inlines.hh.

Referenced by add_float(), add_mul_float(), assign_float_float_inexact(), ceil_float(), div_float(), floor_float(), mul_float(), sub_float(), and sub_mul_float().

00107                                        {
00108   return round_inverse(dir);
00109 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename To , typename From1 , typename From2 >
Result Parma_Polyhedra_Library::Checked::gcd_exact ( To &  to,
const From1 &  x,
const From2 &  y,
Rounding_Dir  dir 
) [inline]

Definition at line 315 of file checked.inlines.hh.

00315                                                                     {
00316   gcd_exact_noabs<To_Policy, From1_Policy, From2_Policy>(to, x, y);
00317   return abs<To_Policy, To_Policy>(to, to, dir);
00318 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename To , typename From >
void Parma_Polyhedra_Library::Checked::gcd_exact_noabs ( To &  to,
const From &  x,
const From &  y 
) [inline]

Definition at line 297 of file checked.inlines.hh.

References To.

00297                                                       {
00298   To nx = x;
00299   To ny = y;
00300   To rm;
00301   while (ny != 0) {
00302     // The following is derived from the assumption that x % y
00303     // is always representable. This is true for both native integers
00304     // and IEC 559 floating point numbers.
00305     rem<To_Policy, From1_Policy, From2_Policy>(rm, nx, ny, ROUND_NOT_NEEDED);
00306     nx = ny;
00307     ny = rm;
00308   }
00309   to = nx;
00310 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::gcd_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 563 of file checked_mpz.inlines.hh.

00563                                                                              {
00564   mpz_gcd(to.get_mpz_t(), x.get_mpz_t(), y.get_mpz_t());
00565   return V_EQ;
00566 }

template<typename To1_Policy , typename To2_Policy , typename To3_Policy , typename From1_Policy , typename From2_Policy , typename To1 , typename To2 , typename To3 , typename From1 , typename From2 >
Result Parma_Polyhedra_Library::Checked::gcdext_exact ( To1 &  to,
To2 &  s,
To3 &  t,
const From1 &  x,
const From2 &  y,
Rounding_Dir  dir 
) [inline]

Definition at line 325 of file checked.inlines.hh.

References From2, Result, To1, To2, and To3.

00326                                {
00327   // In case this becomes a bottleneck, we may consider using the
00328   // Stehle'-Zimmermann algorithm (see R. Crandall and C. Pomerance,
00329   // Prime Numbers - A Computational Perspective, Second Edition,
00330   // Springer, 2005).
00331   if (y == 0) {
00332     if (x == 0) {
00333       s = 0;
00334       t = 1;
00335       return V_EQ;
00336     }
00337     else {
00338       if (x < 0)
00339         s = -1;
00340       else
00341         s = 1;
00342       t = 0;
00343       return abs<To1_Policy, From1_Policy>(to, x, dir);
00344     }
00345   }
00346 
00347   s = 1;
00348   t = 0;
00349   bool negative_x = x < 0;
00350   bool negative_y = y < 0;
00351 
00352   Result r;
00353   r = abs<To1_Policy, From1_Policy>(to, x, dir);
00354   if (r != V_EQ)
00355     return r;
00356 
00357   From2 ay;
00358   r = abs<To1_Policy, From2_Policy>(ay, y, dir);
00359   if (r != V_EQ)
00360     return r;
00361 
00362   // If PPL_MATCH_GMP_GCDEXT is defined then s is favored when the absolute
00363   // values of the given numbers are equal.  For instance if x and y
00364   // are both 5 then s will be 1 and t will be 0, instead of the other
00365   // way round.  This is to match the behavior of GMP.
00366 #define PPL_MATCH_GMP_GCDEXT 1
00367 #ifdef PPL_MATCH_GMP_GCDEXT
00368   if (to == ay)
00369     goto sign_check;
00370 #endif
00371 
00372   {
00373     To2 v1 = 0;
00374     To3 v2 = 1;
00375     To1 v3 = static_cast<To1>(ay);
00376     while (true) {
00377       To1 q = to / v3;
00378       // Remainder, next candidate GCD.
00379       To1 t3 = to - q*v3;
00380       To2 t1 = s - static_cast<To2>(q)*v1;
00381       To3 t2 = t - static_cast<To3>(q)*v2;
00382       s = v1;
00383       t = v2;
00384       to = v3;
00385       if (t3 == 0)
00386         break;
00387       v1 = t1;
00388       v2 = t2;
00389       v3 = t3;
00390     }
00391   }
00392 
00393 #ifdef PPL_MATCH_GMP_GCDEXT
00394  sign_check:
00395 #endif
00396   if (negative_x) {
00397     r = neg<To2_Policy, To2_Policy>(s, s, dir);
00398     if (r != V_EQ)
00399       return r;
00400   }
00401   if (negative_y)
00402     return neg<To3_Policy, To3_Policy>(t, t, dir);
00403   return V_EQ;
00404 #undef PPL_MATCH_GMP_GCDEXT
00405 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::gcdext_mpz ( mpz_class &  to,
mpz_class &  s,
mpz_class &  t,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 572 of file checked_mpz.inlines.hh.

00574                          {
00575   mpz_gcdext(to.get_mpz_t(), s.get_mpz_t(), t.get_mpz_t(),
00576              x.get_mpz_t(), y.get_mpz_t());
00577   return V_EQ;
00578 }

int Parma_Polyhedra_Library::Checked::get_digit ( int  c,
int  base = 10 
) [inline]

Returns the integer value associated with the ASCII code c, in the base base positional number system, if there is such an association; returns $-1$ otherwise.

Definition at line 54 of file checked.cc.

Referenced by parse_number_part().

00054                                 {
00055   if (c >= '0' && c < '0' + (base > 10 ? 10 : base))
00056     return c - '0';
00057   if (base > 10) {
00058     base -= 10;
00059     if (c >= 'A' && c < 'A' + base)
00060       return c - 'A' + 10;
00061     if (c >= 'a' && c < 'a' + base)
00062       return c - 'a' + 10;
00063   }
00064   return -1;
00065 }

mp_size_field_t Parma_Polyhedra_Library::Checked::get_mp_size ( const mpz_class &  v  )  [inline]

Definition at line 62 of file checked_mpz.inlines.hh.

Referenced by classify_mpz(), copy_mpz(), is_minf_mpz(), is_nan_mpz(), and is_pinf_mpz().

00062                                 {
00063   return v.get_mpz_t()->_mp_size;
00064 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::idiv_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 562 of file checked_float.inlines.hh.

References Result, and Type.

00562                                                                    {
00563   Type temp;
00564   // The inexact check is useless
00565   dir = round_dir(dir);
00566   Result r = div<To_Policy, From1_Policy, From2_Policy>(temp, x, y, dir);
00567   if (result_class(r) != VC_NORMAL) {
00568     to = temp;
00569     return r;
00570   }
00571   Result r1 = trunc<To_Policy, To_Policy>(to, temp, ROUND_NOT_NEEDED);
00572   PPL_ASSERT(r1 == V_EQ);
00573   if (r == V_EQ || to != temp)
00574     return r1;
00575   // FIXME: Prove that it's impossibile to return a strict relation
00576   return dir == ROUND_UP ? V_LE : V_GE;
00577 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::idiv_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir  dir 
) [inline]

Definition at line 316 of file checked_mpq.inlines.hh.

References CHECK_P.

00316                                                                                   {
00317   if (CHECK_P(To_Policy::check_div_zero, sgn(y) == 0)) {
00318     return assign_nan<To_Policy>(to, V_DIV_ZERO);
00319   }
00320   to = x / y;
00321   return trunc<To_Policy, To_Policy>(to, to, dir);
00322 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::idiv_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 422 of file checked_mpz.inlines.hh.

References CHECK_P.

00423                       {
00424   if (CHECK_P(To_Policy::check_div_zero, ::sgn(y) == 0)) {
00425     return assign_nan<To_Policy>(to, V_DIV_ZERO);
00426   }
00427   mpz_srcptr n = x.get_mpz_t();
00428   mpz_srcptr d = y.get_mpz_t();
00429   mpz_tdiv_q(to.get_mpz_t(), n, d);
00430   return V_EQ;
00431 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::idiv_signed_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1128 of file checked_int.inlines.hh.

References CHECK_P.

01128                                                                         {
01129   if (CHECK_P(To_Policy::check_div_zero, y == 0)) {
01130     return assign_nan<To_Policy>(to, V_DIV_ZERO);
01131   }
01132   if (To_Policy::check_overflow && y == -1)
01133     return neg_signed_int<To_Policy, From1_Policy>(to, x, dir);
01134   to = x / y;
01135   return V_EQ;
01136 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::idiv_unsigned_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir   
) [inline]

Definition at line 1140 of file checked_int.inlines.hh.

References CHECK_P.

01140                                                                       {
01141   if (CHECK_P(To_Policy::check_div_zero, y == 0)) {
01142     return assign_nan<To_Policy>(to, V_DIV_ZERO);
01143   }
01144   to = x / y;
01145   return V_EQ;
01146 }

template<typename Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::input_generic ( Type &  to,
std::istream &  is,
Rounding_Dir  dir 
) [inline]

Definition at line 631 of file checked.inlines.hh.

00631                                                           {
00632   PPL_DIRTY_TEMP0(mpq_class, q);
00633   Result r = input_mpq(q, is);
00634   Result_Class c = result_class(r);
00635   switch (c) {
00636   case VC_MINUS_INFINITY:
00637   case VC_PLUS_INFINITY:
00638     return assign_special<Policy>(to, c, dir);
00639   case VC_NAN:
00640     return assign_nan<Policy>(to, r);
00641   default:
00642     break;
00643   }
00644   PPL_ASSERT(r == V_EQ);
00645   return assign<Policy, void>(to, q, dir);
00646 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::input_mpq ( mpq_class &  to,
std::istream &  is,
Rounding_Dir  dir 
) [inline]

Definition at line 485 of file checked_mpq.inlines.hh.

References input_mpq(), Result, and Result_Class.

00485                                                            {
00486   Result r = input_mpq(to, is);
00487   Result_Class c = result_class(r);
00488   switch (c) {
00489   case VC_MINUS_INFINITY:
00490   case VC_PLUS_INFINITY:
00491     return assign_special<Policy>(to, c, dir);
00492   case VC_NAN:
00493     return assign_nan<Policy>(to, r);
00494   default:
00495     return r;
00496   }
00497 }

Result Parma_Polyhedra_Library::Checked::input_mpq ( mpq_class &  to,
std::istream &  is 
)

Definition at line 336 of file checked.cc.

References Parma_Polyhedra_Library::Checked::number_struct::base, Parma_Polyhedra_Library::Checked::number_struct::base_for_exponent, Parma_Polyhedra_Library::Checked::number_struct::exponent, Parma_Polyhedra_Library::Checked::number_struct::mantissa, Parma_Polyhedra_Library::Checked::number_struct::neg_exponent, Parma_Polyhedra_Library::Checked::number_struct::neg_mantissa, parse_number(), and Result.

Referenced by assign_mpq_long_double(), assign_mpz_long_double(), and input_mpq().

00336                                          {
00337   number_struct num_struct;
00338   number_struct den_struct;
00339   Result r = parse_number(is, num_struct, den_struct);
00340   if (r == V_CVT_STR_UNK) {
00341     is.setstate(is.failbit);
00342     return r;
00343   }
00344   is.clear(is.rdstate() & ~is.failbit);
00345   if (r != V_EQ)
00346     return r;
00347   if (den_struct.base && den_struct.mantissa.empty())
00348       return V_NAN;
00349   if (num_struct.mantissa.empty()) {
00350     to = 0;
00351     return V_EQ;
00352   }
00353   mpz_ptr num = to.get_num().get_mpz_t();
00354   mpz_ptr den = to.get_den().get_mpz_t();
00355   mpz_set_str(num, num_struct.mantissa.c_str(), num_struct.base);
00356   if (den_struct.base) {
00357     if (num_struct.neg_mantissa ^ den_struct.neg_mantissa)
00358       mpz_neg(num, num);
00359     mpz_set_str(den, den_struct.mantissa.c_str(), den_struct.base);
00360     if (num_struct.exponent || den_struct.exponent) {
00361       // Multiply the exponents into the numerator and denominator.
00362       mpz_t z;
00363       mpz_init(z);
00364       if (num_struct.exponent) {
00365         mpz_ui_pow_ui(z, num_struct.base_for_exponent, num_struct.exponent);
00366         if (num_struct.neg_exponent)
00367           mpz_mul(den, den, z);
00368         else
00369           mpz_mul(num, num, z);
00370       }
00371       if (den_struct.exponent) {
00372         mpz_ui_pow_ui(z, den_struct.base_for_exponent, den_struct.exponent);
00373         if (den_struct.neg_exponent)
00374           mpz_mul(num, num, z);
00375         else
00376           mpz_mul(den, den, z);
00377       }
00378       mpz_clear(z);
00379     }
00380   }
00381   else {
00382     if (num_struct.neg_mantissa)
00383       mpz_neg(num, num);
00384     if (num_struct.exponent) {
00385       if (num_struct.neg_exponent) {
00386         // Add the negative exponent as a denominator.
00387         mpz_ui_pow_ui(den, num_struct.base_for_exponent, num_struct.exponent);
00388         goto end;
00389       }
00390       // Multiply the exponent into the numerator.
00391       mpz_t z;
00392       mpz_init(z);
00393       mpz_ui_pow_ui(z, num_struct.base_for_exponent, num_struct.exponent);
00394       mpz_mul(num, num, z);
00395       mpz_clear(z);
00396     }
00397     mpz_set_ui(den, 1);
00398     return V_EQ;
00399   }
00400  end:
00401   // GMP operators require rationals in canonical form.
00402   to.canonicalize();
00403   return V_EQ;
00404 }

template<typename Policy , typename T >
int Parma_Polyhedra_Library::Checked::is_inf_float ( const T  v  )  [inline]

Definition at line 181 of file checked_float.inlines.hh.

References CHECK_P.

00181                         {
00182   Float<T> f(v);
00183   return CHECK_P(Policy::has_infinity, f.u.binary.is_inf());
00184 }

template<typename Policy , typename T >
bool Parma_Polyhedra_Library::Checked::is_int_float ( const T  v  )  [inline]

Definition at line 200 of file checked_float.inlines.hh.

References rint().

00200                         {
00201   return rint(v) == v;
00202 }

template<typename Policy , typename Type >
bool Parma_Polyhedra_Library::Checked::is_int_int ( const Type  v  )  [inline]

Definition at line 286 of file checked_int.inlines.hh.

00286                          {
00287   return !is_nan<Policy>(v);
00288 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_int_mpq ( const mpq_class &  v  )  [inline]

Definition at line 91 of file checked_mpq.inlines.hh.

00091                                {
00092   if ((Policy::has_infinity || Policy::has_nan)
00093       && ::sgn(v.get_den()) == 0)
00094     return !(Policy::has_nan && ::sgn(v.get_num()) == 0);
00095   else
00096     return v.get_den() == 1;
00097 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_int_mpz ( const mpz_class &  v  )  [inline]

Definition at line 125 of file checked_mpz.inlines.hh.

00125                                {
00126   return !is_nan<Policy>(v);
00127 }

template<typename Policy , typename T >
bool Parma_Polyhedra_Library::Checked::is_minf_float ( const T  v  )  [inline]

Definition at line 187 of file checked_float.inlines.hh.

00187                          {
00188   return is_inf_float<Policy>(v) < 0;
00189 }

template<typename Policy , typename Type >
bool Parma_Polyhedra_Library::Checked::is_minf_int ( const Type  v  )  [inline]

Definition at line 248 of file checked_int.inlines.hh.

00248                           {
00249   return Policy::has_infinity
00250     && v == Extended_Int<Policy, Type>::minus_infinity;
00251 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_minf_mpq ( const mpq_class &  v  )  [inline]

Definition at line 71 of file checked_mpq.inlines.hh.

00071                                 {
00072   return Policy::has_infinity
00073     && ::sgn(v.get_den()) == 0
00074     && ::sgn(v.get_num()) < 0;
00075 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_minf_mpz ( const mpz_class &  v  )  [inline]

Definition at line 107 of file checked_mpz.inlines.hh.

References get_mp_size().

00107                                 {
00108   return Policy::has_infinity
00109     && get_mp_size(v) == C_Integer<mp_size_field_t>::min;
00110 }

template<typename Policy , typename T >
bool Parma_Polyhedra_Library::Checked::is_nan_float ( const T  v  )  [inline]

Definition at line 174 of file checked_float.inlines.hh.

References CHECK_P.

00174                         {
00175   Float<T> f(v);
00176   return CHECK_P(Policy::has_nan, f.u.binary.is_nan());
00177 }

template<typename Policy , typename Type >
bool Parma_Polyhedra_Library::Checked::is_nan_int ( const Type  v  )  [inline]

Definition at line 230 of file checked_int.inlines.hh.

00230                          {
00231   return Policy::has_nan && v == Extended_Int<Policy, Type>::not_a_number;
00232 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_nan_mpq ( const mpq_class &  v  )  [inline]

Definition at line 61 of file checked_mpq.inlines.hh.

00061                                {
00062   return Policy::has_nan
00063     && ::sgn(v.get_den()) == 0
00064     && ::sgn(v.get_num()) == 0;
00065 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_nan_mpz ( const mpz_class &  v  )  [inline]

Definition at line 98 of file checked_mpz.inlines.hh.

References get_mp_size().

00098                                {
00099   return Policy::has_nan
00100     && get_mp_size(v) == C_Integer<mp_size_field_t>::min + 1;
00101 }

template<typename Policy , typename T >
bool Parma_Polyhedra_Library::Checked::is_pinf_float ( const T  v  )  [inline]

Definition at line 193 of file checked_float.inlines.hh.

00193                          {
00194   return is_inf_float<Policy>(v) > 0;
00195 }

template<typename Policy , typename Type >
bool Parma_Polyhedra_Library::Checked::is_pinf_int ( const Type  v  )  [inline]

Definition at line 267 of file checked_int.inlines.hh.

00267                           {
00268   return Policy::has_infinity
00269     && v == Extended_Int<Policy, Type>::plus_infinity;
00270 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_pinf_mpq ( const mpq_class &  v  )  [inline]

Definition at line 81 of file checked_mpq.inlines.hh.

00081                                 {
00082   return Policy::has_infinity
00083     && ::sgn(v.get_den()) == 0
00084     && ::sgn(v.get_num()) > 0;
00085 }

template<typename Policy >
bool Parma_Polyhedra_Library::Checked::is_pinf_mpz ( const mpz_class &  v  )  [inline]

Definition at line 116 of file checked_mpz.inlines.hh.

References get_mp_size().

00116                                 {
00117   return Policy::has_infinity
00118     && get_mp_size(v) == C_Integer<mp_size_field_t>::max;
00119 }

template<typename Type >
void Parma_Polyhedra_Library::Checked::isqrtrem ( Type &  q,
Type &  r,
const Type  from 
) [inline]

Definition at line 1421 of file checked_int.inlines.hh.

References Type.

Referenced by sqrt_unsigned_int().

01421                                             {
01422   q = 0;
01423   r = from;
01424   Type t(1);
01425   for (t <<= CHAR_BIT * sizeof(Type) - 2; t != 0; t >>= 2) {
01426     Type s = q + t;
01427     if (s <= r) {
01428       r -= s;
01429       q = s + t;
01430     }
01431     q >>= 1;
01432   }
01433 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename To , typename From1 , typename From2 >
Result Parma_Polyhedra_Library::Checked::lcm_gcd_exact ( To &  to,
const From1 &  x,
const From2 &  y,
Rounding_Dir  dir 
) [inline]

Definition at line 410 of file checked.inlines.hh.

References Result, and To.

00410                                                                         {
00411   if (x == 0 || y == 0) {
00412     to = 0;
00413     return V_EQ;
00414   }
00415   To nx, ny;
00416   Result r;
00417   r = abs<From1_Policy, From1_Policy>(nx, x, dir);
00418   if (r != V_EQ)
00419     return r;
00420   r = abs<From2_Policy, From2_Policy>(ny, y, dir);
00421   if (r != V_EQ)
00422     return r;
00423   To gcd;
00424   gcd_exact_noabs<To_Policy, From1_Policy, From2_Policy>(gcd, nx, ny);
00425   // The following is derived from the assumption that x / gcd(x, y)
00426   // is always representable. This is true for both native integers
00427   // and IEC 559 floating point numbers.
00428   div<To_Policy, From1_Policy, To_Policy>(to, nx, gcd, ROUND_NOT_NEEDED);
00429   return mul<To_Policy, To_Policy, From2_Policy>(to, to, ny, dir);
00430 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::lcm_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 584 of file checked_mpz.inlines.hh.

00584                                                                              {
00585   mpz_lcm(to.get_mpz_t(), x.get_mpz_t(), y.get_mpz_t());
00586   return V_EQ;
00587 }

template<typename T1 , typename T2 >
Enable_If<(Safe_Int_Comparison<T1, T2>::value || Safe_Conversion<T1, T2>::value || Safe_Conversion<T2, T1>::value), bool>::type Parma_Polyhedra_Library::Checked::le ( const T1 &  x,
const T2 &  y 
) [inline]

Definition at line 469 of file checked.inlines.hh.

00469                              {
00470   return x <= y;
00471 }

template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
bool Parma_Polyhedra_Library::Checked::le_p ( const Type1 &  x,
const Type2 &  y 
) [inline]

Definition at line 600 of file checked.inlines.hh.

00600                                      {
00601   return le(x, y);
00602 }

void Parma_Polyhedra_Library::Checked::limit_precision ( const long double &   )  [inline]

Definition at line 146 of file checked_float.inlines.hh.

00146                                     {
00147 }

void Parma_Polyhedra_Library::Checked::limit_precision ( const double &  v  )  [inline]

Definition at line 141 of file checked_float.inlines.hh.

00141                                  {
00142   cc_flush(v);
00143 }

void Parma_Polyhedra_Library::Checked::limit_precision ( const float &  v  )  [inline]
template<typename T1 , typename T2 >
Enable_If<(Safe_Int_Comparison<T1, T2>::value || Safe_Conversion<T1, T2>::value || Safe_Conversion<T2, T1>::value), bool>::type Parma_Polyhedra_Library::Checked::lt ( const T1 &  x,
const T2 &  y 
) [inline]

Definition at line 462 of file checked.inlines.hh.

00462                              {
00463   return x < y;
00464 }

template<typename Policy1 , typename Policy2 , typename Type1 , typename Type2 >
bool Parma_Polyhedra_Library::Checked::lt_p ( const Type1 &  x,
const Type2 &  y 
) [inline]

Definition at line 593 of file checked.inlines.hh.

00593                                      {
00594   return lt(x, y);
00595 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::mul_2exp_float ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 628 of file checked_float.inlines.hh.

References Type.

00628                                                                            {
00629   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(x))
00630     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00631   PPL_ASSERT(exp < sizeof(unsigned long long) * CHAR_BIT);
00632   return
00633     mul<To_Policy, From_Policy, Float_2exp>(to,
00634                                             x,
00635                                             Type(1ULL << exp),
00636                                             dir);
00637 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::mul_2exp_mpq ( mpq_class &  to,
const mpq_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 369 of file checked_mpq.inlines.hh.

00370                            {
00371   mpz_mul_2exp(to.get_num().get_mpz_t(), x.get_num().get_mpz_t(), exp);
00372   to.get_den() = x.get_den();
00373   to.canonicalize();
00374   return V_EQ;
00375 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::mul_2exp_mpz ( mpz_class &  to,
const mpz_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 475 of file checked_mpz.inlines.hh.

00476                            {
00477   mpz_mul_2exp(to.get_mpz_t(), x.get_mpz_t(), exp);
00478   return V_EQ;
00479 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::mul_2exp_signed_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1328 of file checked_int.inlines.hh.

References PPL_GT_SILENT, PPL_LT_SILENT, and Type.

01329                                       {
01330   if (!To_Policy::check_overflow) {
01331     to = x << exp;
01332     return V_EQ;
01333   }
01334   if (exp >= sizeof(Type) * CHAR_BIT - 1) {
01335     if (x < 0)
01336       return set_neg_overflow_int<To_Policy>(to, dir);
01337     else if (x > 0)
01338       return set_pos_overflow_int<To_Policy>(to, dir);
01339     else {
01340       to = 0;
01341       return V_EQ;
01342     }
01343   }
01344   Type mask = ((Type(1) << exp) - 1)
01345     << (sizeof(Type) * CHAR_BIT - 1 - exp);
01346   Type n;
01347   if (x < 0) {
01348     if ((x & mask) != mask)
01349       return set_neg_overflow_int<To_Policy>(to, dir);
01350     n = x << exp;
01351     if (PPL_LT_SILENT(n, (Extended_Int<To_Policy, Type>::min)))
01352       return set_neg_overflow_int<To_Policy>(to, dir);
01353   }
01354   else {
01355     if (x & mask)
01356       return set_pos_overflow_int<To_Policy>(to, dir);
01357     n = x << exp;
01358     if (PPL_GT_SILENT(n, (Extended_Int<To_Policy, Type>::max)))
01359       return set_pos_overflow_int<To_Policy>(to, dir);
01360   }
01361   to = n;
01362   return V_EQ;
01363 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::mul_2exp_unsigned_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1304 of file checked_int.inlines.hh.

References PPL_GT_SILENT, and Type.

01305                                         {
01306   if (!To_Policy::check_overflow) {
01307     to = x << exp;
01308     return V_EQ;
01309   }
01310   if (exp >= sizeof(Type) * CHAR_BIT) {
01311     if (x == 0) {
01312       to = 0;
01313       return V_EQ;
01314     }
01315     return set_pos_overflow_int<To_Policy>(to, dir);
01316   }
01317   if (x & (((Type(1) << exp) - 1) << (sizeof(Type) * CHAR_BIT - exp)))
01318     return set_pos_overflow_int<To_Policy>(to, dir);
01319   Type n = x << exp;
01320   if (PPL_GT_SILENT(n, (Extended_Int<To_Policy, Type>::max)))
01321     return set_pos_overflow_int<To_Policy>(to, dir);
01322   to = n;
01323   return V_EQ;
01324 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::mul_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 497 of file checked_float.inlines.hh.

References fpu_direct_rounding(), fpu_inverse_rounding(), and limit_precision().

00497                                                                   {
00498   if (To_Policy::check_inf_mul_zero
00499       && ((x == 0 && is_inf_float<From2_Policy>(y))
00500           ||
00501           (y == 0 && is_inf_float<From1_Policy>(x)))) {
00502     return assign_nan<To_Policy>(to, V_INF_MUL_ZERO);
00503   }
00504   prepare_inexact<To_Policy>(dir);
00505   if (fpu_direct_rounding(dir))
00506     to = x * y;
00507   else if (fpu_inverse_rounding(dir)) {
00508     to = x * -y;
00509     limit_precision(to);
00510     to = -to;
00511   }
00512   else {
00513     fpu_rounding_control_word_type old
00514       = fpu_save_rounding_direction(round_fpu_dir(dir));
00515     limit_precision(x);
00516     limit_precision(y);
00517     to = x * y;
00518     limit_precision(to);
00519     fpu_restore_rounding_direction(old);
00520   }
00521   if (To_Policy::fpu_check_nan_result && is_nan<To_Policy>(to))
00522     return V_NAN;
00523   return result_relation<To_Policy>(dir);
00524 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::mul_int_larger ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 946 of file checked_int.inlines.hh.

00946                                                                        {
00947   typename Larger<Type>::type_for_mul l = x;
00948   l *= y;
00949   return assign<To_Policy, To_Policy>(to, l, dir);
00950 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::mul_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir   
) [inline]

Definition at line 295 of file checked_mpq.inlines.hh.

00295                                                                              {
00296   to = x * y;
00297   return V_EQ;
00298 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::mul_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 379 of file checked_mpz.inlines.hh.

00379                                                                              {
00380   to = x * y;
00381   return V_EQ;
00382 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::mul_signed_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1035 of file checked_int.inlines.hh.

01035                                                                        {
01036   if (To_Policy::check_overflow && Larger<Type>::use_for_mul)
01037     return mul_int_larger<To_Policy, From1_Policy, From2_Policy>(to, x, y, dir);
01038   if (!To_Policy::check_overflow) {
01039     to = x * y;
01040     return V_EQ;
01041   }
01042   if (y == 0) {
01043     to = 0;
01044     return V_EQ;
01045   }
01046   if (y == -1)
01047     return neg_signed_int<To_Policy, From1_Policy>(to, x, dir);
01048   if (x >= 0) {
01049     if (y > 0) {
01050       if (x > Extended_Int<To_Policy, Type>::max / y)
01051         return set_pos_overflow_int<To_Policy>(to, dir);
01052     }
01053     else {
01054       if (x > Extended_Int<To_Policy, Type>::min / y)
01055         return set_neg_overflow_int<To_Policy>(to, dir);
01056     }
01057   }
01058   else {
01059     if (y < 0) {
01060       if (x < Extended_Int<To_Policy, Type>::max / y)
01061         return set_pos_overflow_int<To_Policy>(to, dir);
01062     }
01063     else {
01064       if (x < Extended_Int<To_Policy, Type>::min / y)
01065         return set_neg_overflow_int<To_Policy>(to, dir);
01066     }
01067   }
01068   to = x * y;
01069   return V_EQ;
01070 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::mul_unsigned_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1074 of file checked_int.inlines.hh.

01074                                                                          {
01075   if (To_Policy::check_overflow && Larger<Type>::use_for_mul)
01076     return mul_int_larger<To_Policy, From1_Policy, From2_Policy>(to, x, y, dir);
01077   if (!To_Policy::check_overflow) {
01078     to = x * y;
01079     return V_EQ;
01080   }
01081   if (y == 0) {
01082     to = 0;
01083     return V_EQ;
01084   }
01085   if (x > Extended_Int<To_Policy, Type>::max / y)
01086     return set_pos_overflow_int<To_Policy>(to, dir);
01087   to = x * y;
01088   return V_EQ;
01089 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::neg_float ( Type &  to,
const Type  from,
Rounding_Dir   
) [inline]

Definition at line 427 of file checked_float.inlines.hh.

00427                                                    {
00428   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00429     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00430   to = -from;
00431   return V_EQ;
00432 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::neg_int_larger ( Type &  to,
const Type  x,
Rounding_Dir  dir 
) [inline]

Definition at line 922 of file checked_int.inlines.hh.

00922                                                          {
00923   typename Larger<Type>::type_for_neg l = x;
00924   l = -l;
00925   return assign<To_Policy, To_Policy>(to, l, dir);
00926 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::neg_mpq ( mpq_class &  to,
const mpq_class &  from,
Rounding_Dir   
) [inline]

Definition at line 268 of file checked_mpq.inlines.hh.

00268                                                             {
00269   mpq_neg(to.get_mpq_t(), from.get_mpq_t());
00270   return V_EQ;
00271 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::neg_mpz ( mpz_class &  to,
const mpz_class &  from,
Rounding_Dir   
) [inline]

Definition at line 352 of file checked_mpz.inlines.hh.

00352                                                             {
00353   mpz_neg(to.get_mpz_t(), from.get_mpz_t());
00354   return V_EQ;
00355 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::neg_signed_int ( Type &  to,
const Type  from,
Rounding_Dir  dir 
) [inline]

Definition at line 954 of file checked_int.inlines.hh.

References CHECK_P.

00954                                                             {
00955   if (To_Policy::check_overflow && Larger<Type>::use_for_neg)
00956     return neg_int_larger<To_Policy, From_Policy>(to, from, dir);
00957   if (CHECK_P(To_Policy::check_overflow,
00958               (from < -Extended_Int<To_Policy, Type>::max)))
00959     return set_pos_overflow_int<To_Policy>(to, dir);
00960   to = -from;
00961   return V_EQ;
00962 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::neg_unsigned_int ( Type &  to,
const Type  from,
Rounding_Dir  dir 
) [inline]

Definition at line 966 of file checked_int.inlines.hh.

References CHECK_P.

00966                                                               {
00967   if (To_Policy::check_overflow && Larger<Type>::use_for_neg)
00968     return neg_int_larger<To_Policy, From_Policy>(to, from, dir);
00969   if (CHECK_P(To_Policy::check_overflow, from != 0))
00970     return set_neg_overflow_int<To_Policy>(to, dir);
00971   to = from;
00972   return V_EQ;
00973 }

template<typename Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::output_char ( std::ostream &  os,
Type &  from,
const Numeric_Format &  ,
Rounding_Dir   
) [inline]

Definition at line 1502 of file checked_int.inlines.hh.

References int.

01503                                                  {
01504   os << int(from);
01505   return V_EQ;
01506 }

template<typename Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::output_float ( std::ostream &  os,
const Type  from,
const Numeric_Format &  ,
Rounding_Dir   
) [inline]

Definition at line 980 of file checked_float.inlines.hh.

00981                            {
00982   if (from == 0)
00983     os << "0";
00984   else if (is_minf<Policy>(from))
00985     os << "-inf";
00986   else if (is_pinf<Policy>(from))
00987     os << "+inf";
00988   else if (is_nan<Policy>(from))
00989     os << "nan";
00990   else {
00991     int old_precision = os.precision(10000);
00992     // FIXME: here correctness depends on the behavior of the standard
00993     // output operator which, in turn, may depend on the behavior
00994     // of printf().  The C99 standard, 7.19.16.1#13, does not give
00995     // enough guarantees.  We could not find something similar
00996     // in the C++ standard, so there is a concrete danger here.
00997     os << from;
00998     os.precision(old_precision);
00999   }
01000   return V_EQ;
01001 }

template<typename Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::output_int ( std::ostream &  os,
Type &  from,
const Numeric_Format &  ,
Rounding_Dir   
) [inline]

Definition at line 1510 of file checked_int.inlines.hh.

01510                                                                             {
01511   os << from;
01512   return V_EQ;
01513 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::output_mpq ( std::ostream &  os,
const mpq_class &  from,
const Numeric_Format &  ,
Rounding_Dir   
) [inline]

Definition at line 503 of file checked_mpq.inlines.hh.

00506                          {
00507   os << from;
00508   return V_EQ;
00509 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::output_mpz ( std::ostream &  os,
const mpz_class &  from,
const Numeric_Format &  ,
Rounding_Dir   
) [inline]

Definition at line 632 of file checked_mpz.inlines.hh.

00633                          {
00634   os << from;
00635   return V_EQ;
00636 }

Result Parma_Polyhedra_Library::Checked::parse_number ( std::istream &  is,
number_struct &  num,
number_struct &  den 
)

Definition at line 304 of file checked.cc.

References Parma_Polyhedra_Library::Checked::number_struct::base, Parma_Polyhedra_Library::Checked::number_struct::base_for_exponent, Parma_Polyhedra_Library::Checked::number_struct::exponent, Parma_Polyhedra_Library::Checked::number_struct::neg_exponent, parse_number_part(), Result, and sum_sign().

Referenced by input_mpq().

00304                                                                      {
00305   // Read the numerator.
00306   Result r = parse_number_part(is, num);
00307   if (r != V_EQ)
00308     return r;
00309   if (is.get() != '/') {
00310     is.unget();
00311     den.base = 0;
00312     return r;
00313   }
00314   // Read the denominator.
00315   r = parse_number_part(is, den);
00316   if (r != V_EQ)
00317     return V_CVT_STR_UNK;
00318   if (num.base == den.base
00319       && num.base_for_exponent == den.base_for_exponent) {
00320     if (sum_sign(num.neg_exponent, num.exponent,
00321                  !den.neg_exponent, den.exponent)) {
00322       if (num.neg_exponent) {
00323         den.neg_exponent = false;
00324         den.exponent = num.exponent;
00325         num.exponent = 0;
00326       }
00327       else
00328         den.exponent = 0;
00329     }
00330   }
00331   return V_EQ;
00332 }

Result Parma_Polyhedra_Library::Checked::parse_number_part ( std::istream &  is,
number_struct &  num 
)

Helper function for parse_number(): reads the numerator or denominator part of a number from is into num, returning the appropriate Result value.

Definition at line 98 of file checked.cc.

References Parma_Polyhedra_Library::Checked::number_struct::base, Parma_Polyhedra_Library::Checked::number_struct::base_for_exponent, Parma_Polyhedra_Library::Checked::number_struct::exponent, get_digit(), Parma_Polyhedra_Library::Checked::number_struct::mantissa, Parma_Polyhedra_Library::Checked::number_struct::neg_exponent, Parma_Polyhedra_Library::Checked::number_struct::neg_mantissa, and sum_sign().

Referenced by parse_number().

00098                                                       {
00099   enum anonymous_enum { BASE, INTEGER, FRACTIONAL, EXPONENT } state = BASE;
00100   PPL_UNINITIALIZED(unsigned long, max_exp_div);
00101   PPL_UNINITIALIZED(int, max_exp_rem);
00102   bool empty_exponent = true;
00103   bool empty_mantissa = true;
00104   long exponent_offset = 0;
00105   long exponent_offset_scale = 1;
00106   num.base = 10;
00107   num.base_for_exponent = 10;
00108   num.neg_mantissa = false;
00109   num.neg_exponent = false;
00110   num.mantissa.erase();
00111   num.exponent = 0;
00112   int c;
00113   do {
00114     c = is.get();
00115   } while (isspace(c));
00116   switch (c) {
00117   case '-':
00118     num.neg_mantissa = true;
00119     // Fall through.
00120   case '+':
00121     c = is.get();
00122     if (c == 'i' || c == 'I')
00123       goto inf;
00124     if (c != '.')
00125       break;
00126     // Fall through.
00127   case '.':
00128     state = FRACTIONAL;
00129     c = is.get();
00130     break;
00131   case 'n':
00132   case 'N':
00133     c = is.get();
00134     if (c != 'a' && c != 'A')
00135       goto error;
00136     c = is.get();
00137     if (c != 'n' && c != 'N')
00138       goto error;
00139     return V_NAN;
00140   inf:
00141   case 'i':
00142   case 'I':
00143     c = is.get();
00144     if (c != 'n' && c != 'n')
00145       goto error;
00146     c = is.get();
00147     if (c != 'f' && c != 'F')
00148       goto error;
00149     return num.neg_mantissa ? V_EQ_MINUS_INFINITY : V_EQ_PLUS_INFINITY;
00150   }
00151   if (state != FRACTIONAL) {
00152     if (get_digit(c, 10) < 0)
00153       goto error;
00154     if (c == '0') {
00155       int d = is.get();
00156       if (d == 'x' || d == 'X') {
00157         num.base = 16;
00158         num.base_for_exponent = 16;
00159         state = INTEGER;
00160         c = is.get();
00161       }
00162       else {
00163         c = d;
00164         empty_mantissa = false;
00165       }
00166     }
00167     else {
00168       num.mantissa += (char) c;
00169       empty_mantissa = false;
00170       c = is.get();
00171     }
00172   }
00173   while (true) {
00174     switch (state) {
00175     case BASE:
00176       if (get_digit(c, 10) >= 0) {
00177         if (c != '0' || !num.mantissa.empty())
00178           num.mantissa += (char) c;
00179         empty_mantissa = false;
00180         break;
00181       }
00182       if (c == '^') {
00183         c = is.get();
00184         if (c != '^')
00185           goto error;
00186         std::string::const_iterator i;
00187         num.base = 0;
00188         for (i = num.mantissa.begin(); i != num.mantissa.end(); i++) {
00189           num.base = num.base * 10 + (*i - '0');
00190           if (num.base > 36)
00191             goto error;
00192         }
00193         if (num.base < 2)
00194           goto error;
00195         num.base_for_exponent = num.base;
00196         num.mantissa.erase();
00197         empty_mantissa = true;
00198         state = INTEGER;
00199         break;
00200       }
00201       goto integer;
00202     case INTEGER:
00203       if (get_digit(c, num.base) >= 0) {
00204         if (c != '0' || !num.mantissa.empty())
00205           num.mantissa += (char) c;
00206         empty_mantissa = false;
00207         break;
00208       }
00209     integer:
00210       if (c == '.') {
00211         state = FRACTIONAL;
00212         break;
00213       }
00214       goto fractional;
00215     case FRACTIONAL:
00216       if (get_digit(c, num.base) >= 0) {
00217         --exponent_offset;
00218         if (c != '0' || !num.mantissa.empty())
00219           num.mantissa += (char) c;
00220         empty_mantissa = false;
00221         break;
00222       }
00223     fractional:
00224       if (empty_mantissa)
00225         goto error;
00226       if (c == 'e' || c == 'E')
00227         goto exp;
00228       if (c == 'p' || c == 'P') {
00229         if (num.base == 16) {
00230           num.base_for_exponent = 2;
00231           exponent_offset_scale = 4;
00232           goto exp;
00233         }
00234         else
00235           goto error;
00236       }
00237       if (c == '*') {
00238         c = is.get();
00239         if (c != '^')
00240           goto error;
00241       exp:
00242         state = EXPONENT;
00243         max_exp_div = LONG_MAX / num.base;
00244         max_exp_rem = LONG_MAX % num.base;
00245         c = is.get();
00246         if (c == '-') {
00247           num.neg_exponent = true;
00248           break;
00249         }
00250         if (c == '+')
00251           break;
00252         continue;
00253       }
00254       goto ok;
00255     case EXPONENT:
00256       int d = get_digit(c, 10);
00257       if (d >= 0) {
00258         empty_exponent = false;
00259         if (num.exponent > max_exp_div
00260             || (num.exponent == max_exp_div && d > max_exp_rem))
00261           return V_CVT_STR_UNK;
00262         num.exponent = num.exponent * 10 + d;
00263         break;
00264       }
00265       if (empty_exponent)
00266         goto error;
00267       goto ok;
00268     }
00269     c = is.get();
00270   }
00271 
00272   {
00273   ok:
00274     is.unget();
00275     unsigned int n = num.mantissa.size();
00276     while (n > 0 && num.mantissa[n - 1] == '0') {
00277       --n;
00278       ++exponent_offset;
00279     }
00280     num.mantissa.erase(n);
00281     bool neg;
00282     if (exponent_offset < 0) {
00283       neg = true;
00284       exponent_offset = -exponent_offset;
00285     }
00286     else
00287       neg = false;
00288     sum_sign(num.neg_exponent, num.exponent,
00289              neg, exponent_offset * exponent_offset_scale);
00290     return V_EQ;
00291   }
00292 
00293  error:
00294   is.unget();
00295   return V_CVT_STR_UNK;
00296 }

From bool Type Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN1_0_0 ( is_pinf  ,
bool  ,
const  ,
Type   
)
Type Constraints
From bool Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN1_0_0 ( is_nan  ,
bool  ,
const  ,
Type   
)
Type Constraints
From bool Type Type Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN1_0_2 ( assign_special  ,
Result  ,
nonconst  ,
Type  ,
Result_Class  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Rounding_Dir std::istream Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN1_1_2 ( output  ,
Result  ,
std::ostream &  ,
const  ,
Type  ,
const Numeric_Format &  ,
Rounding_Dir   
)
Type Constraints
From Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_0 ( cmp  ,
Result_Relation  ,
const  ,
Type1  ,
const  ,
Type2   
)
Type Constraints
Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_0 ( copy  ,
void  ,
nonconst  ,
Type1  ,
const  ,
Type2   
)
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_1 ( abs  ,
Result  ,
nonconst  ,
To  ,
const  ,
From  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_1 ( trunc  ,
Result  ,
nonconst  ,
To  ,
const  ,
From  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_1 ( floor  ,
Result  ,
nonconst  ,
To  ,
const  ,
From  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_1 ( construct  ,
Result  ,
nonconst  ,
To  ,
const  ,
From  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_2 ( smod_2exp  ,
Result  ,
nonconst  ,
To  ,
const  ,
From  ,
unsigned  int,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_2 ( mul_2exp  ,
Result  ,
nonconst  ,
To  ,
const  ,
From  ,
unsigned  int,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN2_0_2 ( add_2exp  ,
Result  ,
nonconst  ,
To  ,
const  ,
From  ,
unsigned  int,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN3_0_1 ( lcm  ,
Result  ,
nonconst  ,
To  ,
const  ,
From1  ,
const  ,
From2  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN3_0_1 ( gcd  ,
Result  ,
nonconst  ,
To  ,
const  ,
From1  ,
const  ,
From2  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN3_0_1 ( add_mul  ,
Result  ,
nonconst  ,
To  ,
const  ,
From1  ,
const  ,
From2  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN3_0_1 ( rem  ,
Result  ,
nonconst  ,
To  ,
const  ,
From1  ,
const  ,
From2  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN3_0_1 ( mul  ,
Result  ,
nonconst  ,
To  ,
const  ,
From1  ,
const  ,
From2  ,
Rounding_Dir   
)
Type Constraints
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::PPL_DECLARE_FUN3_0_1 ( add  ,
Result  ,
nonconst  ,
To  ,
const  ,
From1  ,
const  ,
From2  ,
Rounding_Dir   
)
Type Constraints
template<typename To_Policy , typename To >
struct Parma_Polyhedra_Library::Checked::PPL_FUNCTION_CLASS ( construct_special   )  [read]

Definition at line 265 of file checked.inlines.hh.

References Result, Result_Class, and To.

00265                                              {
00266   static inline Result function(To& to, Result_Class r, Rounding_Dir dir) {
00267     new (&to) To();
00268     return assign_special<To_Policy>(to, r, dir);
00269   }
00270 };

template<typename To_Policy , typename From_Policy , typename To , typename From >
struct Parma_Polyhedra_Library::Checked::PPL_FUNCTION_CLASS ( construct   )  [read]
Type Constraints

Definition at line 257 of file checked.inlines.hh.

References From, Result, and To.

00257                                      {
00258   static inline Result function(To& to, const From& from, Rounding_Dir dir) {
00259     new (&to) To();
00260     return assign<To_Policy, From_Policy>(to, from, dir);
00261   }
00262 };

template<typename Policy , typename Type >
struct Parma_Polyhedra_Library::Checked::PPL_FUNCTION_CLASS ( construct   )  [read]
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpq_class  ,
double   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpq_class  ,
float   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpq_class  ,
unsigned  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpq_class  ,
signed  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpq_class  ,
char   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpz_class  ,
unsigned  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpz_class  ,
signed  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( mpz_class  ,
char   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( long  double,
double   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( long  double,
float   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( double  ,
float   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( unsigned long  long,
unsigned  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( unsigned long  long,
char   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( unsigned  long,
unsigned  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( unsigned  long,
char   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( unsigned  short,
unsigned  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( unsigned  short,
char   
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( signed long  long,
signed  short 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( signed long  long,
signed  char 
)
Parma_Polyhedra_Library::Checked::PPL_SAFE_CONVERSION ( signed  short,
signed  char 
)
template<typename T >
void Parma_Polyhedra_Library::Checked::pred_float ( T &  v  )  [inline]

Definition at line 225 of file checked_float.inlines.hh.

References Parma_Polyhedra_Library::Bool< false >::value.

Referenced by round_lt_float().

00225                  {
00226   Float<T> f(v);
00227   PPL_ASSERT(!f.u.binary.is_nan());
00228   PPL_ASSERT(f.u.binary.is_inf() >= 0);
00229   if (f.u.binary.is_zero() > 0) {
00230     f.u.binary.negate();
00231     f.u.binary.inc();
00232   }
00233   else if (f.u.binary.sign_bit()) {
00234     f.u.binary.inc();
00235   }
00236   else {
00237     f.u.binary.dec();
00238   }
00239   v = f.value();
00240 }

template<typename Policy >
void Parma_Polyhedra_Library::Checked::prepare_inexact ( Rounding_Dir  dir  )  [inline]

Definition at line 284 of file checked_float.inlines.hh.

00284                                   {
00285   if (Policy::fpu_check_inexact
00286       && !round_not_needed(dir) && round_strict_relation(dir))
00287     fpu_reset_inexact();
00288 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::rem_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir   
) [inline]

Definition at line 582 of file checked_float.inlines.hh.

00582                                                               {
00583   if (To_Policy::check_inf_mod && is_inf_float<From1_Policy>(x)) {
00584     return assign_nan<To_Policy>(to, V_INF_MOD);
00585   }
00586   if (To_Policy::check_div_zero && y == 0) {
00587     return assign_nan<To_Policy>(to, V_MOD_ZERO);
00588   }
00589   to = std::fmod(x, y);
00590   if (To_Policy::fpu_check_nan_result && is_nan<To_Policy>(to))
00591     return V_NAN;
00592   return V_EQ;
00593 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::rem_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir   
) [inline]

Definition at line 328 of file checked_mpq.inlines.hh.

References CHECK_P.

00328                                                                              {
00329   if (CHECK_P(To_Policy::check_div_zero, sgn(y) == 0)) {
00330     return assign_nan<To_Policy>(to, V_MOD_ZERO);
00331   }
00332   PPL_DIRTY_TEMP(mpq_class, tmp);
00333   tmp = x / y;
00334   tmp.get_num() %= tmp.get_den();
00335   to = tmp * y;
00336   return V_EQ;
00337 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::rem_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 437 of file checked_mpz.inlines.hh.

References CHECK_P.

00437                                                                              {
00438   if (CHECK_P(To_Policy::check_div_zero, ::sgn(y) == 0)) {
00439     return assign_nan<To_Policy>(to, V_MOD_ZERO);
00440   }
00441   to = x % y;
00442   return V_EQ;
00443 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::rem_signed_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir   
) [inline]

Definition at line 1150 of file checked_int.inlines.hh.

References CHECK_P.

01150                                                                    {
01151   if (CHECK_P(To_Policy::check_div_zero, y == 0)) {
01152     return assign_nan<To_Policy>(to, V_MOD_ZERO);
01153   }
01154   to = x % y;
01155   return V_EQ;
01156 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::rem_unsigned_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir   
) [inline]

Definition at line 1160 of file checked_int.inlines.hh.

References CHECK_P.

01160                                                                      {
01161   if (CHECK_P(To_Policy::check_div_zero, y == 0)) {
01162     return assign_nan<To_Policy>(to, V_MOD_ZERO);
01163   }
01164   to = x % y;
01165   return V_EQ;
01166 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::result_relation ( Rounding_Dir  dir  )  [inline]

Definition at line 292 of file checked_float.inlines.hh.

Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::ascii_load(), Parma_Polyhedra_Library::DB_Matrix< T >::ascii_load(), and Parma_Polyhedra_Library::check_result().

00292                                   {
00293   if (Policy::fpu_check_inexact
00294       && !round_not_needed(dir) && round_strict_relation(dir)) {
00295     switch (fpu_check_inexact()) {
00296     case 0:
00297       return V_EQ;
00298     case -1:
00299       goto unknown;
00300     case 1:
00301       break;
00302     }
00303     switch (round_dir(dir)) {
00304     case ROUND_DOWN:
00305       return V_GT;
00306     case ROUND_UP:
00307       return V_LT;
00308     default:
00309       return V_NE;
00310     }
00311   }
00312   else {
00313   unknown:
00314     switch (round_dir(dir)) {
00315     case ROUND_DOWN:
00316       return V_GE;
00317     case ROUND_UP:
00318       return V_LE;
00319     default:
00320       return V_LGE;
00321     }
00322   }
00323 }

long double Parma_Polyhedra_Library::Checked::rint ( long double  x  )  [inline]

Definition at line 87 of file checked_float.inlines.hh.

References rint().

00087                     {
00088   return ::rint(x);
00089 }

double Parma_Polyhedra_Library::Checked::rint ( double  x  )  [inline]
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Rounding_Dir std::istream Rounding_Dir To Result Parma_Polyhedra_Library::Checked::round ( To &  to,
Result  r,
Rounding_Dir  dir 
)
template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::round_gt_float ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 273 of file checked_float.inlines.hh.

References succ_float().

00273                                          {
00274   if (round_up(dir)) {
00275     succ_float(to);
00276     return V_LT;
00277   }
00278   return V_GT;
00279 }

template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::round_gt_int ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 162 of file checked_int.inlines.hh.

00162                                        {
00163   if (round_up(dir)) {
00164     if (to == Extended_Int<Policy, To>::max) {
00165       if (Policy::has_infinity) {
00166         to = Extended_Int<Policy, To>::plus_infinity;
00167         return V_LT_PLUS_INFINITY;
00168       }
00169       return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE;
00170     }
00171     else {
00172       ++to;
00173       return V_LT;
00174     }
00175   }
00176   return V_GT;
00177 }

template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::round_gt_int_no_overflow ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 133 of file checked_int.inlines.hh.

00133                                                    {
00134   if (round_up(dir)) {
00135     ++to;
00136     return V_LT;
00137   }
00138   return V_GT;
00139 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::round_gt_mpz ( mpz_class &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 45 of file checked_mpz.inlines.hh.

00045                                               {
00046   if (round_up(dir)) {
00047     ++to;
00048     return V_LT;
00049   }
00050   return V_GT;
00051 }

template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::round_lt_float ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 263 of file checked_float.inlines.hh.

References pred_float().

00263                                          {
00264   if (round_down(dir)) {
00265     pred_float(to);
00266     return V_GT;
00267   }
00268   return V_LT;
00269 }

template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::round_lt_int ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 143 of file checked_int.inlines.hh.

00143                                        {
00144   if (round_down(dir)) {
00145     if (to == Extended_Int<Policy, To>::min) {
00146       if (Policy::has_infinity) {
00147         to = Extended_Int<Policy, To>::minus_infinity;
00148         return V_GT_MINUS_INFINITY;
00149       }
00150       return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE;
00151     }
00152     else {
00153       --to;
00154       return V_GT;
00155     }
00156   }
00157   return V_LT;
00158 }

template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::round_lt_int_no_overflow ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 123 of file checked_int.inlines.hh.

00123                                                    {
00124   if (round_down(dir)) {
00125     --to;
00126     return V_GT;
00127   }
00128   return V_LT;
00129 }

template<typename Policy >
Result Parma_Polyhedra_Library::Checked::round_lt_mpz ( mpz_class &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 35 of file checked_mpz.inlines.hh.

00035                                               {
00036   if (round_down(dir)) {
00037     --to;
00038     return V_GT;
00039   }
00040   return V_LT;
00041 }

void Parma_Polyhedra_Library::Checked::set_mp_size ( mpz_class &  v,
mp_size_field_t  size 
) [inline]

Definition at line 67 of file checked_mpz.inlines.hh.

Referenced by assign_special_mpz(), and copy_mpz().

00067                                                 {
00068   v.get_mpz_t()->_mp_size = size;
00069 }

template<typename Policy , typename T >
Result Parma_Polyhedra_Library::Checked::set_neg_overflow_float ( T &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 769 of file checked_float.inlines.hh.

References Parma_Polyhedra_Library::Bool< false >::value.

00769                                                 {
00770   switch (round_dir(dir)) {
00771   case ROUND_UP:
00772     {
00773       Float<T> f;
00774       f.u.binary.set_max(true);
00775       to = f.value();
00776       return V_LT_INF;
00777     }
00778   default:
00779     to = -HUGE_VAL;
00780     return V_GT_MINUS_INFINITY;
00781   }
00782 }

template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::set_neg_overflow_int ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 91 of file checked_int.inlines.hh.

00091                                                {
00092   if (round_up(dir)) {
00093     to = Extended_Int<Policy, To>::min;
00094     return V_LT_INF;
00095   }
00096   else {
00097     if (Policy::has_infinity) {
00098       to = Extended_Int<Policy, To>::minus_infinity;
00099       return V_GT_MINUS_INFINITY;
00100     }
00101     return V_GT_MINUS_INFINITY | V_UNREPRESENTABLE;
00102   }
00103 }

template<typename Policy , typename T >
Result Parma_Polyhedra_Library::Checked::set_pos_overflow_float ( T &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 786 of file checked_float.inlines.hh.

References Parma_Polyhedra_Library::Bool< false >::value.

00786                                                 {
00787   switch (round_dir(dir)) {
00788   case ROUND_DOWN:
00789     {
00790       Float<T> f;
00791       f.u.binary.set_max(false);
00792       to = f.value();
00793       return V_GT_SUP;
00794     }
00795   default:
00796     to = HUGE_VAL;
00797     return V_LT_PLUS_INFINITY;
00798   }
00799 }

template<typename Policy , typename To >
Result Parma_Polyhedra_Library::Checked::set_pos_overflow_int ( To &  to,
Rounding_Dir  dir 
) [inline]

Definition at line 107 of file checked_int.inlines.hh.

00107                                                {
00108   if (round_down(dir)) {
00109     to = Extended_Int<Policy, To>::max;
00110     return V_GT_SUP;
00111   }
00112   else {
00113     if (Policy::has_infinity) {
00114       to = Extended_Int<Policy, To>::plus_infinity;
00115       return V_LT_PLUS_INFINITY;
00116     }
00117     return V_LT_PLUS_INFINITY | V_UNREPRESENTABLE;
00118   }
00119 }

template<typename Policy , typename Type >
Result_Relation Parma_Polyhedra_Library::Checked::sgn_float ( const Type  x  )  [inline]

Definition at line 720 of file checked_float.inlines.hh.

00720                         {
00721   if (x > 0)
00722     return VR_GT;
00723   if (x < 0)
00724     return VR_LT;
00725   if (x == 0)
00726     return VR_EQ;
00727   return VR_EMPTY;
00728 }

template<typename Policy , typename Type >
Result_Relation Parma_Polyhedra_Library::Checked::sgn_generic ( const Type &  x  )  [inline]

Definition at line 434 of file checked.inlines.hh.

00434                            {
00435   if (x > 0)
00436     return VR_GT;
00437   if (x == 0)
00438     return VR_EQ;
00439   return VR_LT;
00440 }

template<typename Policy , typename Type >
Result_Relation Parma_Polyhedra_Library::Checked::sgn_mp ( const Type &  x  )  [inline]

Definition at line 612 of file checked_mpz.inlines.hh.

00612                       {
00613   int i = ::sgn(x);
00614   return i > 0 ? VR_GT : i < 0 ? VR_LT : VR_EQ;
00615 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::smod_2exp_float ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 654 of file checked_float.inlines.hh.

References Type.

00654                                                                             {
00655   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(x))
00656     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00657   if (To_Policy::check_inf_mod && is_inf_float<From_Policy>(x)) {
00658     return assign_nan<To_Policy>(to, V_INF_MOD);
00659   }
00660   PPL_ASSERT(exp < sizeof(unsigned long long) * CHAR_BIT);
00661   Type m = 1ULL << exp;
00662   rem_float<To_Policy, From_Policy, Float_2exp>(to, x, m, ROUND_IGNORE);
00663   Type m2 = m / 2;
00664   if (to < -m2)
00665     return add_float<To_Policy, From_Policy, Float_2exp>(to, to, m, dir);
00666   else if (to >= m2)
00667     return sub_float<To_Policy, From_Policy, Float_2exp>(to, to, m, dir);
00668   return V_EQ;
00669 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::smod_2exp_mpq ( mpq_class &  to,
const mpq_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 393 of file checked_mpq.inlines.hh.

00394                             {
00395   mpz_mul_2exp(to.get_den().get_mpz_t(), x.get_den().get_mpz_t(), exp);
00396   mpz_fdiv_r(to.get_num().get_mpz_t(), x.get_num().get_mpz_t(), to.get_den().get_mpz_t());
00397   mpz_fdiv_q_2exp(to.get_den().get_mpz_t(), to.get_den().get_mpz_t(), 1);
00398   bool neg = to.get_num() >= to.get_den();
00399   mpz_mul_2exp(to.get_den().get_mpz_t(), to.get_den().get_mpz_t(), 1);
00400   if (neg)
00401     to.get_num() -= to.get_den();
00402   mpz_mul_2exp(to.get_num().get_mpz_t(), to.get_num().get_mpz_t(), exp);
00403   to.canonicalize();
00404   return V_EQ;
00405 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::smod_2exp_mpz ( mpz_class &  to,
const mpz_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 511 of file checked_mpz.inlines.hh.

00512                             {
00513   if (mpz_tstbit(x.get_mpz_t(), exp - 1))
00514     mpz_cdiv_r_2exp(to.get_mpz_t(), x.get_mpz_t(), exp);
00515   else
00516     mpz_fdiv_r_2exp(to.get_mpz_t(), x.get_mpz_t(), exp);
00517   return V_EQ;
00518 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::smod_2exp_signed_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 1383 of file checked_int.inlines.hh.

References Type.

01384                                    {
01385   if (exp >= sizeof(Type) * CHAR_BIT)
01386     to = x;
01387   else {
01388     Type m = Type(1) << (exp - 1);
01389     to = (x & (m - 1)) - (x & m);
01390   }
01391   return V_EQ;
01392 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::smod_2exp_unsigned_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1367 of file checked_int.inlines.hh.

References Type.

01368                                          {
01369   if (exp > sizeof(Type) * CHAR_BIT)
01370     to = x;
01371   else {
01372     Type v = exp == sizeof(Type) * CHAR_BIT ? x : (x & ((Type(1) << exp) - 1));
01373     if (v >= Type(1) << (exp - 1))
01374       return set_neg_overflow_int<To_Policy>(to, dir);
01375     else
01376       to = v;
01377   }
01378   return V_EQ;
01379 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sqrt_float ( Type &  to,
const Type  from,
Rounding_Dir  dir 
) [inline]

Definition at line 698 of file checked_float.inlines.hh.

References fpu_direct_rounding(), and limit_precision().

00698                                                         {
00699   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00700     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00701   if (To_Policy::check_sqrt_neg && from < 0) {
00702     return assign_nan<To_Policy>(to, V_SQRT_NEG);
00703   }
00704   prepare_inexact<To_Policy>(dir);
00705   if (fpu_direct_rounding(dir))
00706     to = std::sqrt(from);
00707   else {
00708     fpu_rounding_control_word_type old
00709       = fpu_save_rounding_direction(round_fpu_dir(dir));
00710     limit_precision(from);
00711     to = std::sqrt(from);
00712     limit_precision(to);
00713     fpu_restore_rounding_direction(old);
00714   }
00715   return result_relation<To_Policy>(dir);
00716 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::sqrt_mpq ( mpq_class &  to,
const mpq_class &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 455 of file checked_mpq.inlines.hh.

References CHECK_P, and Result.

00455                                                                  {
00456   if (CHECK_P(To_Policy::check_sqrt_neg, from < 0)) {
00457     return assign_nan<To_Policy>(to, V_SQRT_NEG);
00458   }
00459   if (from == 0) {
00460     to = 0;
00461     return V_EQ;
00462   }
00463   bool gt1 = from.get_num() > from.get_den();
00464   const mpz_class& from_a = gt1 ? from.get_num() : from.get_den();
00465   const mpz_class& from_b = gt1 ? from.get_den() : from.get_num();
00466   mpz_class& to_a = gt1 ? to.get_num() : to.get_den();
00467   mpz_class& to_b = gt1 ? to.get_den() : to.get_num();
00468   Rounding_Dir rdir = gt1 ? dir : inverse(dir);
00469   mul_2exp<To_Policy, From_Policy>(to_a, from_a,
00470                                    2*irrational_precision, ROUND_IGNORE);
00471   Result rdiv
00472     = div<To_Policy, To_Policy, To_Policy>(to_a, to_a, from_b, rdir);
00473   Result rsqrt = sqrt<To_Policy, To_Policy>(to_a, to_a, rdir);
00474   to_b = 1;
00475   mul_2exp<To_Policy, To_Policy>(to_b, to_b,
00476                                  irrational_precision, ROUND_IGNORE);
00477   to.canonicalize();
00478   return rdiv != V_EQ ? rdiv : rsqrt;
00479 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::sqrt_mpz ( mpz_class &  to,
const mpz_class &  from,
Rounding_Dir  dir 
) [inline]

Definition at line 593 of file checked_mpz.inlines.hh.

References CHECK_P.

00593                                                                  {
00594   if (CHECK_P(To_Policy::check_sqrt_neg, from < 0)) {
00595     return assign_nan<To_Policy>(to, V_SQRT_NEG);
00596   }
00597   if (round_not_requested(dir)) {
00598     to = sqrt(from);
00599     return V_GE;
00600   }
00601   PPL_DIRTY_TEMP0(mpz_class, r);
00602   mpz_sqrtrem(to.get_mpz_t(), r.get_mpz_t(), from.get_mpz_t());
00603   if (r == 0)
00604     return V_EQ;
00605   return round_gt_mpz<To_Policy>(to, dir);
00606 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sqrt_signed_int ( Type &  to,
const Type  from,
Rounding_Dir  dir 
) [inline]

Definition at line 1449 of file checked_int.inlines.hh.

References CHECK_P.

01449                                                              {
01450   if (CHECK_P(To_Policy::check_sqrt_neg, from < 0)) {
01451     return assign_nan<To_Policy>(to, V_SQRT_NEG);
01452   }
01453   return sqrt_unsigned_int<To_Policy, From_Policy>(to, from, dir);
01454 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sqrt_unsigned_int ( Type &  to,
const Type  from,
Rounding_Dir  dir 
) [inline]

Definition at line 1437 of file checked_int.inlines.hh.

References isqrtrem(), and Type.

01437                                                                {
01438   Type rem;
01439   isqrtrem(to, rem, from);
01440   if (round_not_requested(dir))
01441     return V_GE;
01442   if (rem == 0)
01443     return V_EQ;
01444   return round_gt_int<To_Policy>(to, dir);
01445 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_2exp_float ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 615 of file checked_float.inlines.hh.

References Type.

00615                                                                            {
00616   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(x))
00617     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00618   PPL_ASSERT(exp < sizeof(unsigned long long) * CHAR_BIT);
00619   return
00620     sub<To_Policy, From_Policy, Float_2exp>(to,
00621                                             x,
00622                                             Type(1ULL << exp),
00623                                             dir);
00624 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::sub_2exp_mpq ( mpq_class &  to,
const mpq_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 356 of file checked_mpq.inlines.hh.

00357                            {
00358   PPL_DIRTY_TEMP(mpz_class, v);
00359   v = 1;
00360   mpz_mul_2exp(v.get_mpz_t(), v.get_mpz_t(), exp);
00361   to = x - v;
00362   return V_EQ;
00363 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::sub_2exp_mpz ( mpz_class &  to,
const mpz_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 462 of file checked_mpz.inlines.hh.

00463                            {
00464   PPL_DIRTY_TEMP(mpz_class, v);
00465   v = 1;
00466   mpz_mul_2exp(v.get_mpz_t(), v.get_mpz_t(), exp);
00467   to = x - v;
00468   return V_EQ;
00469 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_2exp_signed_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1284 of file checked_int.inlines.hh.

References Type.

01285                                       {
01286   if (!To_Policy::check_overflow) {
01287     to = x - (Type(1) << exp);
01288     return V_EQ;
01289   }
01290   if (exp >= sizeof(Type) * CHAR_BIT)
01291     return set_neg_overflow_int<To_Policy>(to, dir);
01292   if (exp == sizeof(Type) * CHAR_BIT - 1) {
01293     Type n = -2 * (Type(1) << (exp - 1));
01294     return add_signed_int<To_Policy, From_Policy, void>(to, x, n, dir);
01295   }
01296   else {
01297     Type n = Type(1) << exp;
01298     return sub_signed_int<To_Policy, From_Policy, void>(to, x, n, dir);
01299   }
01300 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_2exp_unsigned_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1270 of file checked_int.inlines.hh.

References Type.

01271                                         {
01272   if (!To_Policy::check_overflow) {
01273     to = x - (Type(1) << exp);
01274     return V_EQ;
01275   }
01276   if (exp >= sizeof(Type) * CHAR_BIT)
01277     return set_neg_overflow_int<To_Policy>(to, dir);
01278   Type n = Type(1) << exp;
01279   return sub_unsigned_int<To_Policy, From_Policy, void>(to, x, n, dir);
01280 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 467 of file checked_float.inlines.hh.

References fpu_direct_rounding(), fpu_inverse_rounding(), and limit_precision().

00467                                                                   {
00468   if (To_Policy::check_inf_sub_inf
00469       && is_inf_float<From1_Policy>(x) && x == y) {
00470     return assign_nan<To_Policy>(to, V_INF_SUB_INF);
00471   }
00472   prepare_inexact<To_Policy>(dir);
00473   if (fpu_direct_rounding(dir))
00474     to = x - y;
00475   else if (fpu_inverse_rounding(dir)) {
00476     to = y - x;
00477     limit_precision(to);
00478     to = -to;
00479   }
00480   else {
00481     fpu_rounding_control_word_type old
00482       = fpu_save_rounding_direction(round_fpu_dir(dir));
00483     limit_precision(x);
00484     limit_precision(y);
00485     to = x - y;
00486     limit_precision(to);
00487     fpu_restore_rounding_direction(old);
00488   }
00489   if (To_Policy::fpu_check_nan_result && is_nan<To_Policy>(to))
00490     return V_NAN;
00491   return result_relation<To_Policy>(dir);
00492 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_int_larger ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 938 of file checked_int.inlines.hh.

00938                                                                        {
00939   typename Larger<Type>::type_for_sub l = x;
00940   l -= y;
00941   return assign<To_Policy, To_Policy>(to, l, dir);
00942 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::sub_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir   
) [inline]

Definition at line 286 of file checked_mpq.inlines.hh.

00286                                                                              {
00287   to = x - y;
00288   return V_EQ;
00289 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::sub_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 370 of file checked_mpz.inlines.hh.

00370                                                                              {
00371   to = x - y;
00372   return V_EQ;
00373 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_mul_float ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 947 of file checked_float.inlines.hh.

References fma(), fpu_direct_rounding(), fpu_inverse_rounding(), and limit_precision().

00947                                                                       {
00948   if (To_Policy::check_inf_mul_zero
00949       && ((x == 0 && is_inf_float<From2_Policy>(y))
00950           ||
00951           (y == 0 && is_inf_float<From1_Policy>(x)))) {
00952     return assign_nan<To_Policy>(to, V_INF_MUL_ZERO);
00953   }
00954   // FIXME: missing check_inf_add_inf
00955   prepare_inexact<To_Policy>(dir);
00956   if (fpu_direct_rounding(dir))
00957     to = fma(x, -y, to);
00958   else if (fpu_inverse_rounding(dir)) {
00959     to = fma(x, y, -to);
00960     limit_precision(to);
00961     to = -to;
00962   }
00963   else {
00964     fpu_rounding_control_word_type old
00965       = fpu_save_rounding_direction(round_fpu_dir(dir));
00966     limit_precision(x);
00967     limit_precision(y);
00968     limit_precision(to);
00969     to = fma(x, -y, to);
00970     limit_precision(to);
00971     fpu_restore_rounding_direction(old);
00972   }
00973   if (To_Policy::fpu_check_nan_result && is_nan<To_Policy>(to))
00974     return V_NAN;
00975   return result_relation<To_Policy>(dir);
00976 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_mul_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1480 of file checked_int.inlines.hh.

References Result, and Type.

01480                                                                     {
01481   Type z;
01482   Result r = mul<To_Policy, From1_Policy, From2_Policy>(z, x, y, dir);
01483   switch (result_overflow(r)) {
01484   case 0:
01485     return sub<To_Policy, To_Policy, To_Policy>(to, to, z, dir);
01486   case -1:
01487     if (to >= 0)
01488       return set_pos_overflow_int<To_Policy>(to, dir);
01489     return assign_nan<To_Policy>(to, V_UNKNOWN_NEG_OVERFLOW);
01490   case 1:
01491     if (to <= 0)
01492       return set_neg_overflow_int<To_Policy>(to, dir);
01493     return assign_nan<To_Policy>(to, V_UNKNOWN_POS_OVERFLOW);
01494   default:
01495     PPL_ASSERT(false);
01496     return V_NAN;
01497   }
01498 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::sub_mul_mpq ( mpq_class &  to,
const mpq_class &  x,
const mpq_class &  y,
Rounding_Dir   
) [inline]

Definition at line 443 of file checked_mpq.inlines.hh.

00444                           {
00445   to -= x * y;
00446   return V_EQ;
00447 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy >
Result Parma_Polyhedra_Library::Checked::sub_mul_mpz ( mpz_class &  to,
const mpz_class &  x,
const mpz_class &  y,
Rounding_Dir   
) [inline]

Definition at line 553 of file checked_mpz.inlines.hh.

00554                           {
00555   mpz_submul(to.get_mpz_t(), x.get_mpz_t(), y.get_mpz_t());
00556   return V_EQ;
00557 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_signed_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1006 of file checked_int.inlines.hh.

01006                                                                        {
01007   if (To_Policy::check_overflow && Larger<Type>::use_for_sub)
01008     return sub_int_larger<To_Policy, From1_Policy, From2_Policy>(to, x, y, dir);
01009   if (To_Policy::check_overflow) {
01010     if (y >= 0) {
01011       if (x < Extended_Int<To_Policy, Type>::min + y)
01012         return set_neg_overflow_int<To_Policy>(to, dir);
01013     }
01014     else if (x > Extended_Int<To_Policy, Type>::max + y)
01015         return set_pos_overflow_int<To_Policy>(to, dir);
01016   }
01017   to = x - y;
01018   return V_EQ;
01019 }

template<typename To_Policy , typename From1_Policy , typename From2_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::sub_unsigned_int ( Type &  to,
const Type  x,
const Type  y,
Rounding_Dir  dir 
) [inline]

Definition at line 1023 of file checked_int.inlines.hh.

References CHECK_P.

01023                                                                          {
01024   if (To_Policy::check_overflow && Larger<Type>::use_for_sub)
01025     return sub_int_larger<To_Policy, From1_Policy, From2_Policy>(to, x, y, dir);
01026   if (CHECK_P(To_Policy::check_overflow,
01027               (x < Extended_Int<To_Policy, Type>::min + y)))
01028     return set_neg_overflow_int<To_Policy>(to, dir);
01029   to = x - y;
01030   return V_EQ;
01031 }

template<typename T >
void Parma_Polyhedra_Library::Checked::succ_float ( T &  v  )  [inline]

Definition at line 244 of file checked_float.inlines.hh.

References Parma_Polyhedra_Library::Bool< false >::value.

Referenced by round_gt_float().

00244                  {
00245   Float<T> f(v);
00246   PPL_ASSERT(!f.u.binary.is_nan());
00247   PPL_ASSERT(f.u.binary.is_inf() <= 0);
00248   if (f.u.binary.is_zero() < 0) {
00249     f.u.binary.negate();
00250     f.u.binary.inc();
00251   }
00252   else if (!f.u.binary.sign_bit()) {
00253     f.u.binary.inc();
00254   }
00255   else {
00256     f.u.binary.dec();
00257   }
00258   v = f.value();
00259 }

bool Parma_Polyhedra_Library::Checked::sum_sign ( bool &  a_neg,
unsigned long &  a_mod,
bool  b_neg,
unsigned long  b_mod 
) [inline]

Adds the number represented (in the modulus-and-sign representation) by b_neg and b_mod to the number represented by a_neg and a_mod, assigning the result to the latter. Returns false is the result cannot be represented; returns true otherwise.

Definition at line 75 of file checked.cc.

Referenced by parse_number(), and parse_number_part().

00076                                           {
00077   if (a_neg == b_neg) {
00078     if (a_mod > ULONG_MAX - b_mod)
00079       return false;
00080     a_mod += b_mod;
00081   }
00082   else if (a_mod >= b_mod)
00083     a_mod -= b_mod;
00084   else {
00085     a_neg = !a_neg;
00086     a_mod = b_mod - a_mod;
00087   }
00088   return true;
00089 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::trunc_float ( Type &  to,
const Type  from,
Rounding_Dir  dir 
) [inline]

Definition at line 416 of file checked_float.inlines.hh.

00416                                                          {
00417   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(from))
00418     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00419   if (from >= 0)
00420     return floor<To_Policy, From_Policy>(to, from, dir);
00421   else
00422     return ceil<To_Policy, From_Policy>(to, from, dir);
00423 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::trunc_mpq ( mpq_class &  to,
const mpq_class &  from,
Rounding_Dir   
) [inline]

Definition at line 257 of file checked_mpq.inlines.hh.

00257                                                               {
00258   mpz_tdiv_q(to.get_num().get_mpz_t(),
00259              from.get_num().get_mpz_t(), from.get_den().get_mpz_t());
00260   to.get_den() = 1;
00261   return V_EQ;
00262 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::umod_2exp_float ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 673 of file checked_float.inlines.hh.

References Type.

00673                                                                             {
00674   if (To_Policy::fpu_check_nan_result && is_nan<From_Policy>(x))
00675     return assign_special<To_Policy>(to, VC_NAN, ROUND_IGNORE);
00676   if (To_Policy::check_inf_mod && is_inf_float<From_Policy>(x)) {
00677     return assign_nan<To_Policy>(to, V_INF_MOD);
00678   }
00679   PPL_ASSERT(exp < sizeof(unsigned long long) * CHAR_BIT);
00680   Type m = 1ULL << exp;
00681   rem_float<To_Policy, From_Policy, Float_2exp>(to, x, m, ROUND_IGNORE);
00682   if (to < 0)
00683     return add_float<To_Policy, From_Policy, Float_2exp>(to, to, m, dir);
00684   return V_EQ;
00685 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::umod_2exp_mpq ( mpq_class &  to,
const mpq_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 411 of file checked_mpq.inlines.hh.

00412                             {
00413   mpz_mul_2exp(to.get_den().get_mpz_t(), x.get_den().get_mpz_t(), exp);
00414   mpz_fdiv_r(to.get_num().get_mpz_t(), x.get_num().get_mpz_t(), to.get_den().get_mpz_t());
00415   mpz_mul_2exp(to.get_num().get_mpz_t(), to.get_num().get_mpz_t(), exp);
00416   to.canonicalize();
00417   return V_EQ;
00418 }

template<typename To_Policy , typename From_Policy >
Result Parma_Polyhedra_Library::Checked::umod_2exp_mpz ( mpz_class &  to,
const mpz_class &  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 524 of file checked_mpz.inlines.hh.

00525                             {
00526   mpz_fdiv_r_2exp(to.get_mpz_t(), x.get_mpz_t(), exp);
00527   return V_EQ;
00528 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::umod_2exp_signed_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir  dir 
) [inline]

Definition at line 1407 of file checked_int.inlines.hh.

References Type.

01408                                        {
01409   if (exp >= sizeof(Type) * CHAR_BIT) {
01410     if (x < 0)
01411       return set_pos_overflow_int<To_Policy>(to, dir);
01412     to = x;
01413   }
01414   else
01415     to = x & ((Type(1) << exp) - 1);
01416   return V_EQ;
01417 }

template<typename To_Policy , typename From_Policy , typename Type >
Result Parma_Polyhedra_Library::Checked::umod_2exp_unsigned_int ( Type &  to,
const Type  x,
unsigned int  exp,
Rounding_Dir   
) [inline]

Definition at line 1396 of file checked_int.inlines.hh.

References Type.

01397                                      {
01398   if (exp >= sizeof(Type) * CHAR_BIT)
01399     to = x;
01400   else
01401     to = x & ((Type(1) << exp) - 1);
01402   return V_EQ;
01403 }


Variable Documentation

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::const

Definition at line 430 of file checked.defs.hh.

Enable_If<(!Safe_Conversion< T1, T2 >::value &&!Safe_Conversion< T2, T1 >::value &&(!C_Integer< T1 >::value||!C_Integer< T2 >::value)), bool >::type Parma_Polyhedra_Library::Checked::eq [inline]
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Parma_Polyhedra_Library::Checked::From
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::From1

Definition at line 467 of file checked.defs.hh.

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::From2

Definition at line 467 of file checked.defs.hh.

Referenced by gcdext_exact().

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Parma_Polyhedra_Library::Checked::int

Definition at line 485 of file checked.defs.hh.

Referenced by output_char().

Holds the precision parameter used for irrational calculations.

Definition at line 37 of file checked.cc.

Referenced by Parma_Polyhedra_Library::irrational_precision(), and Parma_Polyhedra_Library::set_irrational_precision().

Enable_If<(!Safe_Conversion< T1, T2 >::value &&!Safe_Conversion< T2, T1 >::value &&(!C_Integer< T1 >::value||!C_Integer< T2 >::value)), bool >::type Parma_Polyhedra_Library::Checked::le [inline]

Definition at line 500 of file checked.inlines.hh.

Referenced by Parma_Polyhedra_Library::Polyhedron::add_congruence(), Parma_Polyhedra_Library::Polyhedron::add_congruences(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition_aux(), assign_int_float(), Parma_Polyhedra_Library::Interval< Boundary, Info >::contains(), Parma_Polyhedra_Library::Polyhedron::contains_integer_point(), Parma_Polyhedra_Library::Interval< Boundary, Info >::difference_assign(), Parma_Polyhedra_Library::Octagonal_Shape< T >::frequency(), Parma_Polyhedra_Library::Box< ITV >::frequency(), Parma_Polyhedra_Library::BD_Shape< T >::frequency(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition_aux(), Parma_Polyhedra_Library::Shape_Preserving_Reduction< D1, D2 >::product_reduce(), Parma_Polyhedra_Library::Interval< Boundary, Info >::refine_existential(), Parma_Polyhedra_Library::Interval< Boundary, Info >::refine_universal(), Parma_Polyhedra_Library::Polyhedron::refine_with_congruence(), Parma_Polyhedra_Library::Polyhedron::refine_with_congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign(), Parma_Polyhedra_Library::Grid::simplify_using_context_assign(), Parma_Polyhedra_Library::Interval< Boundary, Info >::strictly_contains(), and Parma_Polyhedra_Library::Interval< Boundary, Info >::wrap_assign().

00500                            {
00501   return x < 0 || static_cast<typename C_Integer<S>::other_type>(x) <= y;
00502 }

Enable_If<(!Safe_Conversion< T1, T2 >::value &&!Safe_Conversion< T2, T1 >::value &&(!C_Integer< T1 >::value||!C_Integer< T2 >::value)), bool >::type Parma_Polyhedra_Library::Checked::lt [inline]
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::nonconst

Definition at line 446 of file checked.defs.hh.

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::Result

Definition at line 434 of file checked.defs.hh.

Referenced by Parma_Polyhedra_Library::Interval< Boundary, Info >::add_assign(), add_mul_int(), Parma_Polyhedra_Library::add_restriction(), Parma_Polyhedra_Library::addmod(), Parma_Polyhedra_Library::OR_Matrix< T >::ascii_load(), Parma_Polyhedra_Library::DB_Matrix< T >::ascii_load(), Parma_Polyhedra_Library::Interval< Boundary, Info >::assign(), assign_int_mpq(), assign_mpz_long_double(), Parma_Polyhedra_Library::assign_rem(), classify_mpq(), classify_mpz(), Parma_Polyhedra_Library::contains_restriction(), Parma_Polyhedra_Library::Interval< Boundary, Info >::difference_assign(), Parma_Polyhedra_Library::Interval< Boundary, Info >::div_assign(), Parma_Polyhedra_Library::Octagonal_Shape< T >::drop_some_non_integer_points_helper(), Parma_Polyhedra_Library::BD_Shape< T >::drop_some_non_integer_points_helper(), gcdext_exact(), idiv_float(), input_mpq(), Parma_Polyhedra_Library::Interval< Boundary, Info >::intersect_assign(), Parma_Polyhedra_Library::intersect_restriction(), Parma_Polyhedra_Library::Interval< Boundary, Info >::join_assign(), Parma_Polyhedra_Library::join_restriction(), lcm_gcd_exact(), Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_normalize(), Parma_Polyhedra_Library::Interval< Boundary, Info >::mul_assign(), Parma_Polyhedra_Library::mul_restriction(), Parma_Polyhedra_Library::mulmod(), Parma_Polyhedra_Library::Interval< Boundary, Info >::neg_assign(), Parma_Polyhedra_Library::Interval< Boundary, Info >::normalize(), Parma_Polyhedra_Library::Checked_Number< T, Policy >::operator>>(), parse_number(), PPL_FUNCTION_CLASS(), Parma_Polyhedra_Library::Box< ITV >::propagate_constraint_no_check(), Parma_Polyhedra_Library::Interval< Boundary, Info >::refine_universal(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::restrict(), Parma_Polyhedra_Library::Interval< Boundary, Info >::set_infinities(), sqrt_mpq(), Parma_Polyhedra_Library::Interval< Boundary, Info >::sub_assign(), sub_mul_int(), Parma_Polyhedra_Library::sub_restriction(), Parma_Polyhedra_Library::submod(), Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_normalize(), and Parma_Polyhedra_Library::Interval< Boundary, Info >::wrap_assign().

Definition at line 446 of file checked.defs.hh.

Referenced by input_mpq(), and PPL_FUNCTION_CLASS().

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Parma_Polyhedra_Library::Checked::To
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::To1

Definition at line 509 of file checked.defs.hh.

Referenced by gcdext_exact().

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::To2

Definition at line 509 of file checked.defs.hh.

Referenced by gcdext_exact().

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::To3

Definition at line 509 of file checked.defs.hh.

Referenced by gcdext_exact().

From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir unsigned Rounding_Dir Rounding_Dir Rounding_Dir Parma_Polyhedra_Library::Checked::Type
Generated on Sun Feb 27 16:20:33 2011 for PPL by  doxygen 1.6.3