24 #ifndef PPL_Checked_Number_inlines_hh
25 #define PPL_Checked_Number_inlines_hh 1
34 #define DEBUG_ROUND_NOT_NEEDED
40 #ifdef DEBUG_ROUND_NOT_NEEDED
50 #ifdef DEBUG_ROUND_NOT_NEEDED
71 template <
typename T,
typename Policy>
77 template <
typename T,
typename Policy>
81 Checked::copy<Policy, Policy>(v, y.
raw_value());
84 template <
typename T,
typename Policy>
85 template <
typename From,
typename From_Policy>
91 Policy::handle_result(
check_result(Checked::assign_ext<Policy, From_Policy>
99 template <
typename T,
typename Policy>
100 template <
typename From,
typename From_Policy>
106 Policy::handle_result(
check_result(Checked::assign_ext<Policy, From_Policy>
114 #define PPL_DEFINE_CTOR(type) \
115 template <typename T, typename Policy> \
117 Checked_Number<T, Policy>::Checked_Number(const type y, Rounding_Dir dir) { \
118 Policy::handle_result(check_result(Checked::assign_ext<Policy, \
119 Checked_Number_Transparent_Policy<PPL_U(type)> > \
120 (v, y, rounding_dir(dir)), \
123 template <typename T, typename Policy> \
125 Checked_Number<T, Policy>::Checked_Number(const type y) { \
126 Rounding_Dir dir = Policy::ROUND_DEFAULT_CONSTRUCTOR; \
127 Policy::handle_result(check_result(Checked::assign_ext<Policy, \
128 Checked_Number_Transparent_Policy<PPL_U(type)> > \
129 (v, y, rounding_dir(dir)), \
144 #if PPL_SUPPORTED_FLOAT
147 #if PPL_SUPPORTED_DOUBLE
150 #if PPL_SUPPORTED_LONG_DOUBLE
156 #undef PPL_DEFINE_CTOR
159 template <
typename T,
typename Policy>
162 std::istringstream s(y);
163 Policy::handle_result(
check_result(Checked::input<Policy>(v,
169 template <
typename T,
typename Policy>
172 std::istringstream s(y);
174 Policy::handle_result(
check_result(Checked::input<Policy>(v,
180 template <
typename T,
typename Policy>
181 template <
typename From>
187 Policy::handle_result(
check_result(Checked::assign_special<Policy>(v,
193 template <
typename T,
typename Policy>
194 template <
typename From>
198 Policy::handle_result(
check_result(Checked::assign_special<Policy>(v,
204 template <
typename To,
typename From>
215 template <
typename To,
typename From>
225 template <
typename T>
228 return Checked::is_minf<typename Native_Checked_From_Wrapper<T>
232 template <
typename T>
235 return Checked::is_pinf<typename Native_Checked_From_Wrapper<T>
239 template <
typename T>
245 template <
typename T>
248 return Checked::is_nan<typename Native_Checked_From_Wrapper<T>
252 template <
typename T>
255 return Checked::is_int<typename Native_Checked_From_Wrapper<T>
259 template <
typename T,
typename Policy>
262 if (Policy::convertible) {
267 template <
typename T,
typename Policy>
273 template <
typename T,
typename Policy>
280 template <
typename T,
typename Policy>
287 template <
typename T,
typename Policy>
293 template <
typename T,
typename Policy>
299 template <
typename T,
typename Policy>
302 return Checked::classify<Policy>(v, nan, inf, sign);
305 template <
typename T,
typename Policy>
308 return Checked::is_nan<Policy>(x.
raw_value());
311 template <
typename T,
typename Policy>
314 return Checked::is_minf<Policy>(x.
raw_value());
317 template <
typename T,
typename Policy>
320 return Checked::is_pinf<Policy>(x.
raw_value());
324 template <
typename T,
typename Policy>
331 template <
typename T,
typename Policy>
339 template <
typename To>
342 std::istringstream s(x);
350 #define PPL_DEFINE_FUNC1_A(name, func) \
351 template <typename To, typename From> \
352 inline typename Enable_If<Is_Native_Or_Checked<To>::value \
353 && Is_Native_Or_Checked<From>::value, \
355 PPL_U(name)(To& to, const From& x, Rounding_Dir dir) { \
357 check_result(Checked::func<typename Native_Checked_To_Wrapper<To> \
359 typename Native_Checked_From_Wrapper<From> \
360 ::Policy>(Native_Checked_To_Wrapper<To>::raw_value(to), \
361 Native_Checked_From_Wrapper<From>::raw_value(x), \
362 rounding_dir(dir)), dir); \
374 #undef PPL_DEFINE_FUNC1_A
376 #define PPL_DEFINE_FUNC1_B(name, func) \
377 template <typename To, typename From> \
378 inline typename Enable_If<Is_Native_Or_Checked<To>::value \
379 && Is_Native_Or_Checked<From>::value, \
381 PPL_U(name)(To& to, const From& x, unsigned int exp, Rounding_Dir dir) { \
383 check_result(Checked::func<typename Native_Checked_To_Wrapper<To> \
385 typename Native_Checked_From_Wrapper<From> \
386 ::Policy>(Native_Checked_To_Wrapper<To>::raw_value(to), \
387 Native_Checked_From_Wrapper<From>::raw_value(x), \
389 rounding_dir(dir)), \
400 #undef PPL_DEFINE_FUNC1_B
402 #define PPL_DEFINE_FUNC2(name, func) \
403 template <typename To, typename From1, typename From2> \
404 inline typename Enable_If<Is_Native_Or_Checked<To>::value \
405 && Is_Native_Or_Checked<From1>::value \
406 && Is_Native_Or_Checked<From2>::value, \
408 PPL_U(name)(To& to, const From1& x, const From2& y, Rounding_Dir dir) { \
410 check_result(Checked::func<typename Native_Checked_To_Wrapper<To> \
412 typename Native_Checked_From_Wrapper<From1> \
414 typename Native_Checked_From_Wrapper<From2> \
415 ::Policy>(Native_Checked_To_Wrapper<To>::raw_value(to), \
416 Native_Checked_From_Wrapper<From1>::raw_value(x), \
417 Native_Checked_From_Wrapper<From2>::raw_value(y), \
418 rounding_dir(dir)), \
433 #undef PPL_DEFINE_FUNC2
435 #define PPL_DEFINE_FUNC4(name, func) \
436 template <typename To1, \
441 inline typename Enable_If<Is_Native_Or_Checked<To1>::value \
442 && Is_Native_Or_Checked<To2>::value \
443 && Is_Native_Or_Checked<To3>::value \
444 && Is_Native_Or_Checked<From1>::value \
445 && Is_Native_Or_Checked<From2>::value, \
447 PPL_U(name)(To1& to, To2& s, To3& t, const From1& x, const From2& y, \
448 Rounding_Dir dir) { \
450 check_result(Checked::func<typename Native_Checked_To_Wrapper<To1>::Policy, \
451 typename Native_Checked_To_Wrapper<To2>::Policy, \
452 typename Native_Checked_To_Wrapper<To3>::Policy, \
453 typename Native_Checked_From_Wrapper<From1>::Policy, \
454 typename Native_Checked_From_Wrapper<From2>::Policy> \
455 (Native_Checked_To_Wrapper<To1>::raw_value(to), \
456 Native_Checked_To_Wrapper<To2>::raw_value(s), \
457 Native_Checked_To_Wrapper<To3>::raw_value(t), \
458 Native_Checked_From_Wrapper<From1>::raw_value(x), \
459 Native_Checked_From_Wrapper<From2>::raw_value(y), \
460 rounding_dir(dir)), \
466 #undef PPL_DEFINE_PPL_DEFINE_FUNC4
468 #define PPL_DEFINE_INCREMENT(f, fun) \
469 template <typename T, typename Policy> \
470 inline Checked_Number<T, Policy>& \
471 Checked_Number<T, Policy>::f() { \
472 Policy::handle_result((fun)(*this, *this, T(1), \
473 Policy::ROUND_DEFAULT_OPERATOR)); \
476 template <typename T, typename Policy> \
477 inline Checked_Number<T, Policy> \
478 Checked_Number<T, Policy>::f(int) {\
480 Policy::handle_result((fun)(*this, *this, T(1), \
481 Policy::ROUND_DEFAULT_OPERATOR)); \
488 #undef PPL_DEFINE_INCREMENT
490 template <
typename T,
typename Policy>
491 inline Checked_Number<T, Policy>&
493 Checked::copy<Policy, Policy>(v, y.
raw_value());
496 template <
typename T,
typename Policy>
497 template <
typename From>
500 Policy::handle_result(
assign_r(*
this, y, Policy::ROUND_DEFAULT_OPERATOR));
504 #define PPL_DEFINE_BINARY_OP_ASSIGN(f, fun) \
505 template <typename T, typename Policy> \
506 template <typename From_Policy> \
507 inline Checked_Number<T, Policy>& \
508 Checked_Number<T, Policy>::f(const Checked_Number<T, From_Policy>& y) { \
509 Policy::handle_result((fun)(*this, *this, y, \
510 Policy::ROUND_DEFAULT_OPERATOR)); \
513 template <typename T, typename Policy> \
514 inline Checked_Number<T, Policy>& \
515 Checked_Number<T, Policy>::f(const T& y) { \
516 Policy::handle_result((fun)(*this, *this, y, \
517 Policy::ROUND_DEFAULT_OPERATOR)); \
520 template <typename T, typename Policy> \
521 template <typename From> \
522 inline typename Enable_If<Is_Native_Or_Checked<From>::value, \
523 Checked_Number<T, Policy>& >::type \
524 Checked_Number<T, Policy>::f(const From& y) { \
525 Checked_Number<T, Policy> cy(y); \
526 Policy::handle_result((fun)(*this, *this, cy, \
527 Policy::ROUND_DEFAULT_OPERATOR)); \
537 #undef PPL_DEFINE_BINARY_OP_ASSIGN
539 #define PPL_DEFINE_BINARY_OP(f, fun) \
540 template <typename T, typename Policy> \
541 inline Checked_Number<T, Policy> \
542 PPL_U(f)(const Checked_Number<T, Policy>& x, \
543 const Checked_Number<T, Policy>& y) { \
544 Checked_Number<T, Policy> r; \
545 Policy::handle_result((fun)(r, x, y, Policy::ROUND_DEFAULT_OPERATOR)); \
548 template <typename Type, typename T, typename Policy> \
550 typename Enable_If<Is_Native<Type>::value, Checked_Number<T, Policy> >::type \
551 PPL_U(f)(const Type& x, const Checked_Number<T, Policy>& y) { \
552 Checked_Number<T, Policy> r(x); \
553 Policy::handle_result((fun)(r, r, y, Policy::ROUND_DEFAULT_OPERATOR)); \
556 template <typename T, typename Policy, typename Type> \
558 typename Enable_If<Is_Native<Type>::value, Checked_Number<T, Policy> >::type \
559 PPL_U(f)(const Checked_Number<T, Policy>& x, const Type& y) { \
560 Checked_Number<T, Policy> r(y); \
561 Policy::handle_result((fun)(r, x, r, Policy::ROUND_DEFAULT_OPERATOR)); \
571 #undef PPL_DEFINE_BINARY_OP
573 #define PPL_DEFINE_COMPARE_OP(f, fun) \
574 template <typename T1, typename T2> \
576 typename Enable_If<Is_Native_Or_Checked<T1>::value \
577 && Is_Native_Or_Checked<T2>::value \
578 && (Is_Checked<T1>::value || Is_Checked<T2>::value), \
580 PPL_U(f)(const T1& x, const T2& y) { \
581 return Checked::fun<typename Native_Checked_From_Wrapper<T1>::Policy, \
582 typename Native_Checked_From_Wrapper<T2>::Policy> \
583 (Native_Checked_From_Wrapper<T1>::raw_value(x), \
584 Native_Checked_From_Wrapper<T2>::raw_value(y)); \
594 #undef PPL_DEFINE_COMPARE_OP
596 #define PPL_DEFINE_COMPARE(f, fun) \
597 template <typename T1, typename T2> \
598 inline typename Enable_If<Is_Native_Or_Checked<T1>::value \
599 && Is_Native_Or_Checked<T2>::value, \
601 PPL_U(f)(const T1& x, const T2& y) { \
602 return Checked::fun<typename Native_Checked_From_Wrapper<T1>::Policy, \
603 typename Native_Checked_From_Wrapper<T2>::Policy> \
604 (Native_Checked_From_Wrapper<T1>::raw_value(x), \
605 Native_Checked_From_Wrapper<T2>::raw_value(y)); \
615 #undef PPL_DEFINE_COMPARE
618 template <
typename T,
typename Policy>
619 inline Checked_Number<T, Policy>
625 template <
typename T,
typename Policy>
629 Policy::handle_result(neg_assign_r(r, x, Policy::ROUND_DEFAULT_OPERATOR));
633 #define PPL_DEFINE_ASSIGN_FUN2_1(f, fun) \
634 template <typename T, typename Policy> \
636 PPL_U(f)(Checked_Number<T, Policy>& x) { \
637 Policy::handle_result((fun)(x, x, Policy::ROUND_DEFAULT_FUNCTION)); \
640 #define PPL_DEFINE_ASSIGN_FUN2_2(f, fun) \
641 template <typename T, typename Policy> \
643 PPL_U(f)(Checked_Number<T, Policy>& x, const Checked_Number<T, Policy>& y) { \
644 Policy::handle_result((fun)(x, y, Policy::ROUND_DEFAULT_FUNCTION)); \
647 #define PPL_DEFINE_ASSIGN_FUN3_3(f, fun) \
648 template <typename T, typename Policy> \
650 PPL_U(f)(Checked_Number<T, Policy>& x, const Checked_Number<T, Policy>& y, \
651 const Checked_Number<T, Policy>& z) { \
652 Policy::handle_result((fun)(x, y, z, Policy::ROUND_DEFAULT_FUNCTION)); \
655 #define PPL_DEFINE_ASSIGN_FUN5_5(f, fun) \
656 template <typename T, typename Policy> \
658 PPL_U(f)(Checked_Number<T, Policy>& x, \
659 Checked_Number<T, Policy>& s, Checked_Number<T, Policy>& t, \
660 const Checked_Number<T, Policy>& y, \
661 const Checked_Number<T, Policy>& z) { \
662 Policy::handle_result((fun)(x, s, t, y, z, Policy::ROUND_DEFAULT_FUNCTION)); \
694 #undef PPL_DEFINE_ASSIGN_FUN2_1
695 #undef PPL_DEFINE_ASSIGN_FUN2_2
696 #undef PPL_DEFINE_ASSIGN_FUN3_2
697 #undef PPL_DEFINE_ASSIGN_FUN3_3
698 #undef PPL_DEFINE_ASSIGN_FUN5_5
700 #define PPL_DEFINE_ASSIGN_2EXP(f, fun) \
701 template <typename T, typename Policy> \
703 PPL_U(f)(Checked_Number<T, Policy>& x, \
704 const Checked_Number<T, Policy>& y, unsigned int exp) { \
705 Policy::handle_result((fun)(x, y, exp, Policy::ROUND_DEFAULT_FUNCTION)); \
711 template <typename T, typename Policy>
720 template <
typename From>
724 = Checked::sgn_ext<typename Native_Checked_From_Wrapper<From>::Policy>
739 template <
typename From1,
typename From2>
745 = Checked::cmp_ext<typename Native_Checked_From_Wrapper<From1>::Policy,
762 template <
typename T>
775 template <
typename T,
typename Policy>
777 operator<<(std::ostream& os, const Checked_Number<T, Policy>& x) {
783 template <
typename T>
794 template <
typename T,
typename Policy>
797 Result r = input(x, is, Policy::ROUND_DEFAULT_INPUT);
799 is.setstate(std::ios::failbit);
802 Policy::handle_result(r);
807 template <
typename T>
813 template <
typename T>
819 template <
typename T>
826 template <
typename T,
typename Policy>
833 template <
typename T>
841 template <
typename T>
854 #endif // !defined(PPL_Checked_Number_inlines_hh)
Result gcd_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
#define PPL_DEFINE_FUNC1_B(name, func)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_minus_infinity(const T &x)
void swap(CO_Tree &x, CO_Tree &y)
Result sub_mul_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
Result lcm_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
Result sqrt_ext(To &to, const From &x, Rounding_Dir dir)
void throw_result_exception(Result r)
bool OK() const
Checks if all the invariants are satisfied.
std::istream & operator>>(std::istream &is, Checked_Number< T, Policy > &x)
Result sub_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
Enable_If< Is_Native_Or_Checked< T >::value, Result >::type input(T &x, std::istream &is, Rounding_Dir dir)
Result mul_2exp_ext(To &to, const From &x, unsigned int exp, Rounding_Dir dir)
Checked_Number< T, Policy > operator+(const Checked_Number< T, Policy > &x)
Rounding_Dir
Rounding directions for arithmetic computations.
T & raw_value(Checked_Number< T, Policy > &x)
Result construct_ext(To &to, const From &x, Rounding_Dir dir)
Not_A_Number NOT_A_NUMBER
void add_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_integer(const T &x)
#define PPL_DEFINE_COMPARE_OP(f, fun)
Result add_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
void abs_assign(GMP_Integer &x)
Result
Possible outcomes of a checked arithmetic computation.
From bool Type Type Rounding_Dir To
Result output_ext(std::ostream &os, const Type &x, const Numeric_Format &format, Rounding_Dir dir)
Result trunc_ext(To &to, const From &x, Rounding_Dir dir)
int fpu_check_inexact()
Queries the inexact computation status.
void lcm_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Result add_mul_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
Not a number result class.
void swap(Checked_Number< T, Policy > &x, Checked_Number< T, Policy > &y)
const T & raw_value(const Checked_Number< T, Policy > &x)
Result_Relation result_relation(Result r)
#define PPL_DEFINE_BINARY_OP_ASSIGN(f, fun)
void sqrt_assign(GMP_Integer &x, const GMP_Integer &y)
void exact_div_assign(Checked_Number< T, Policy > &x, const Checked_Number< T, Policy > &y, const Checked_Number< T, Policy > &z)
Result neg_ext(To &to, const From &x, Rounding_Dir dir)
Result idiv_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
int maybe_check_fpu_inexact()
Result classify(bool nan=true, bool inf=true, bool sign=true) const
Classifies *this.
Enable_If< Is_Native_Or_Checked< To >::value, Result >::type assign_r(To &to, const char *x, Rounding_Dir dir)
Checked_Number< T, Policy > operator-(const Checked_Number< T, Policy > &x)
#define PPL_DEFINE_ASSIGN_FUN5_5(f, fun)
void div_2exp_assign(GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
A wrapper for numeric types implementing a given policy.
Result div_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
#define PPL_DEFINE_CTOR(type)
#define PPL_DEFINE_BINARY_OP(f, fun)
#define PPL_DEFINE_COMPARE(f, fun)
Result_Class result_class(Result r)
Result mul_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
Equal. This need to be accompanied by a value.
void fpu_reset_inexact()
Clears the inexact computation status.
const mpz_class & raw_value(const GMP_Integer &x)
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
void gcdext_assign(GMP_Integer &x, GMP_Integer &s, GMP_Integer &t, const GMP_Integer &y, const GMP_Integer &z)
#define PPL_DEFINE_ASSIGN_FUN3_3(f, fun)
Less than. This need to be accompanied by a value.
#define PPL_DEFINE_INCREMENT(f, fun)
void rem_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Converting from unknown string.
Result add_2exp_ext(To &to, const From &x, unsigned int exp, Rounding_Dir dir)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_not_a_number(const T &x)
Enable_If< Is_Native_Or_Checked< From >::value, int >::type sgn(const From &x)
Checked_Number & operator=(const Checked_Number &y)
Assignment operator.
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_plus_infinity(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, Result >::type output(std::ostream &os, const T &x, const Numeric_Format &format, Rounding_Dir dir)
void mul_2exp_assign(GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
static void handle_result(Result r)
bool ne_ext(const Type1 &x, const Type2 &y)
#define PPL_DEFINE_ASSIGN_FUN2_1(f, fun)
bool eq_ext(const Type1 &x, const Type2 &y)
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir From1
#define PPL_DEFINE_FUNC4(name, func)
Result ceil_ext(To &to, const From &x, Rounding_Dir dir)
Plus_Infinity PLUS_INFINITY
void neg_assign(GMP_Integer &x)
Result sub_2exp_ext(To &to, const From &x, unsigned int exp, Rounding_Dir dir)
The entire library is confined to this namespace.
Enable_If< Is_Native_Or_Checked< From1 >::value &&Is_Native_Or_Checked< From2 >::value, int >::type cmp(const From1 &x, const From2 &y)
Greater than. This need to be accompanied by a value.
Rounding_Dir rounding_dir(Rounding_Dir dir)
Result check_result(Result r, Rounding_Dir dir)
static void handle_result(Result r)
Handles r: called by all constructors, operators and functions that do not return a Result value...
#define PPL_DEFINE_ASSIGN_FUN2_2(f, fun)
Minus_Infinity MINUS_INFINITY
Result gcdext_ext(To1 &to, To2 &s, To3 &t, const From1 &x, const From2 &y, Rounding_Dir dir)
Result abs_ext(To &to, const From &x, Rounding_Dir dir)
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir From2
bool lt_ext(const Type1 &x, const Type2 &y)
From bool Type Type Rounding_Dir From
#define PPL_DEFINE_FUNC2(name, func)
memory_size_type total_memory_in_bytes(const Checked_Number< T, Policy > &x)
void maybe_reset_fpu_inexact()
void gcd_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Result input_ext(Type &x, std::istream &is, Rounding_Dir dir)
void sub_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Result assign_ext(To &to, const From &from, Rounding_Dir dir)
Result smod_2exp_ext(To &to, const From &x, unsigned int exp, Rounding_Dir dir)
bool le_ext(const Type1 &x, const Type2 &y)
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
#define PPL_DEFINE_ASSIGN_2EXP(f, fun)
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type construct(To &to, const From &, Rounding_Dir dir)
#define PPL_DEFINE_FUNC1_A(name, func)
A class that provides a type member called type equivalent to T if and only if b is true...
Enable_If< Is_Native< T >::value, memory_size_type >::type total_memory_in_bytes(const T &)
For native types, returns the total size in bytes of the memory occupied by the type of the (unused) ...
memory_size_type external_memory_in_bytes(const Checked_Number< T, Policy > &x)
Checked_Number()
Default constructor.
bool gt_ext(const Type1 &x, const Type2 &y)
Enable_If< Is_Native_Or_Checked< T >::value, int >::type infinity_sign(const T &x)
T & raw_value()
Returns a reference to the underlying numeric value.
Result rem_ext(To &to, const From1 &x, const From2 &y, Rounding_Dir dir)
bool ge_ext(const Type1 &x, const Type2 &y)
Result div_2exp_ext(To &to, const From &x, unsigned int exp, Rounding_Dir dir)
Result umod_2exp_ext(To &to, const From &x, unsigned int exp, Rounding_Dir dir)
Result floor_ext(To &to, const From &x, Rounding_Dir dir)