PPL  1.2
Checked_Number_defs.hh
Go to the documentation of this file.
1 /* Checked_Number class declaration.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Checked_Number_defs_hh
25 #define PPL_Checked_Number_defs_hh 1
26 
27 #include "Checked_Number_types.hh"
28 #include "checked_defs.hh"
29 #include "meta_programming.hh"
30 #include "Slow_Copy.hh"
31 #include <iosfwd>
32 
33 namespace Parma_Polyhedra_Library {
34 
35 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
36 
37 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
39  const_bool_nodef(check_overflow, true);
40  const_bool_nodef(check_inf_add_inf, false);
41  const_bool_nodef(check_inf_sub_inf, false);
42  const_bool_nodef(check_inf_mul_zero, false);
43  const_bool_nodef(check_div_zero, false);
44  const_bool_nodef(check_inf_div_inf, false);
45  const_bool_nodef(check_inf_mod, false);
46  const_bool_nodef(check_sqrt_neg, false);
47  const_bool_nodef(has_nan, true);
48  const_bool_nodef(has_infinity, true);
49 
50  // `convertible' is intentionally not defined: the compile time
51  // error on conversions is the expected behavior.
52 
54  const_bool_nodef(fpu_check_nan_result, true);
55 
56  // ROUND_DEFAULT_CONSTRUCTOR is intentionally not defined.
57  // ROUND_DEFAULT_OPERATOR is intentionally not defined.
58  // ROUND_DEFAULT_FUNCTION is intentionally not defined.
59  // ROUND_DEFAULT_INPUT is intentionally not defined.
60  // ROUND_DEFAULT_OUTPUT is intentionally not defined.
61 
62  static void handle_result(Result r);
63 };
64 
65 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
66 
68 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
69 template <typename T>
71  const_bool_nodef(check_overflow, true);
72  const_bool_nodef(check_inf_add_inf, false);
73  const_bool_nodef(check_inf_sub_inf, false);
74  const_bool_nodef(check_inf_mul_zero, false);
75  const_bool_nodef(check_div_zero, false);
76  const_bool_nodef(check_inf_div_inf, false);
77  const_bool_nodef(check_inf_mod, false);
78  const_bool_nodef(check_sqrt_neg, false);
79  const_bool_nodef(has_nan, std::numeric_limits<T>::has_quiet_NaN);
80  const_bool_nodef(has_infinity, std::numeric_limits<T>::has_infinity);
81  const_bool_nodef(convertible, true);
83  const_bool_nodef(fpu_check_nan_result, true);
84 };
85 
86 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
87 
88 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
89 template <typename T, typename Enable = void>
91 
92 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
93 
94 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
95 template <typename T>
96 struct Native_Checked_From_Wrapper<T, typename Enable_If<Is_Native<T>::value>::type> {
98  static const T& raw_value(const T& v) {
99  return v;
100  }
101 };
102 
103 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
104 
105 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
106 template <typename T, typename P>
108  typedef P Policy;
109  static const T& raw_value(const Checked_Number<T, P>& v) {
110  return v.raw_value();
111  }
112 };
113 
114 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
115 
116 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
117 template <typename T, typename Enable = void>
119 
120 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
121 
122 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
123 template <typename T>
124 struct Native_Checked_To_Wrapper<T, typename Enable_If<Is_Native<T>::value>::type> {
126  static T& raw_value(T& v) {
127  return v;
128  }
129 };
130 
131 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
132 
133 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
134 template <typename T, typename P>
136  typedef P Policy;
138  return v.raw_value();
139  }
140 };
141 
142 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
143 
144 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
145 template <typename T>
146 struct Is_Checked : public False { };
147 
148 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
149 
150 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
151 template <typename T, typename P>
152 struct Is_Checked<Checked_Number<T, P> > : public True { };
153 
154 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
155 
156 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
157 template <typename T>
159  : public Bool<Is_Native<T>::value || Is_Checked<T>::value> { };
160 
162 
169 template <typename T, typename Policy>
171 public:
172 
174 
175 
177  Checked_Number();
178 
180  Checked_Number(const Checked_Number& y);
181 
183  template <typename From, typename From_Policy>
185 
187  Checked_Number(char y, Rounding_Dir dir);
188 
190  Checked_Number(signed char y, Rounding_Dir dir);
191 
193  Checked_Number(signed short y, Rounding_Dir dir);
194 
196  Checked_Number(signed int y, Rounding_Dir dir);
197 
199  Checked_Number(signed long y, Rounding_Dir dir);
200 
202  Checked_Number(signed long long y, Rounding_Dir dir);
203 
205  Checked_Number(unsigned char y, Rounding_Dir dir);
206 
208  Checked_Number(unsigned short y, Rounding_Dir dir);
209 
211  Checked_Number(unsigned int y, Rounding_Dir dir);
212 
214  Checked_Number(unsigned long y, Rounding_Dir dir);
215 
217  Checked_Number(unsigned long long y, Rounding_Dir dir);
218 
219 #if PPL_SUPPORTED_FLOAT
220  Checked_Number(float y, Rounding_Dir dir);
222 #endif
223 
224 #if PPL_SUPPORTED_DOUBLE
225  Checked_Number(double y, Rounding_Dir dir);
227 #endif
228 
229 #if PPL_SUPPORTED_LONG_DOUBLE
230  Checked_Number(long double y, Rounding_Dir dir);
232 #endif
233 
235  Checked_Number(const mpq_class& y, Rounding_Dir dir);
236 
238  Checked_Number(const mpz_class& y, Rounding_Dir dir);
239 
241  Checked_Number(const char* y, Rounding_Dir dir);
242 
244  template <typename From>
245  Checked_Number(const From&, Rounding_Dir dir,
246  typename Enable_If<Is_Special<From>::value, bool>::type
247  ignored = false);
248 
250  template <typename From, typename From_Policy>
252 
254  Checked_Number(char y);
255 
257  Checked_Number(signed char y);
258 
260  Checked_Number(signed short y);
261 
263  Checked_Number(signed int y);
264 
266  Checked_Number(signed long y);
267 
269  Checked_Number(signed long long y);
270 
272  Checked_Number(unsigned char y);
273 
275  Checked_Number(unsigned short y);
276 
278  Checked_Number(unsigned int y);
279 
281  Checked_Number(unsigned long y);
282 
284  Checked_Number(unsigned long long y);
285 
287  Checked_Number(float y);
288 
290  Checked_Number(double y);
291 
293  Checked_Number(long double y);
294 
296  Checked_Number(const mpq_class& y);
297 
299  Checked_Number(const mpz_class& y);
300 
302  Checked_Number(const char* y);
303 
305  template <typename From>
306  Checked_Number(const From&, typename Enable_If<Is_Special<From>::value, bool>::type ignored = false);
307 
308 
310 
312 
313 
315  operator T() const;
316 
318  T& raw_value();
319 
321  const T& raw_value() const;
322 
324 
326  bool OK() const;
327 
329 
338  Result classify(bool nan = true, bool inf = true, bool sign = true) const;
339 
341 
342 
345 
347  template <typename From>
348  Checked_Number& operator=(const From& y);
349 
351  template <typename From_Policy>
353 
355  Checked_Number& operator+=(const T& y);
356 
358  template <typename From>
361  operator+=(const From& y);
362 
364  template <typename From_Policy>
366 
368  Checked_Number& operator-=(const T& y);
369 
371  template <typename From>
374  operator-=(const From& y);
375 
377  template <typename From_Policy>
379 
381  Checked_Number& operator*=(const T& y);
382 
384  template <typename From>
387  operator*=(const From& y);
388 
390  template <typename From_Policy>
392 
394  Checked_Number& operator/=(const T& y);
395 
397  template <typename From>
400  operator/=(const From& y);
401 
403  template <typename From_Policy>
405 
407  Checked_Number& operator%=(const T& y);
408 
410  template <typename From>
413  operator%=(const From& y);
414 
416 
417 
419 
420 
423 
426 
429 
432 
434 
435 private:
437  T v;
438 };
439 
440 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
441 
442 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
443 template <typename T, typename P>
444 struct Slow_Copy<Checked_Number<T, P> > : public Bool<Slow_Copy<T>::value> {};
445 
447 template <typename T>
448 typename Enable_If<Is_Native_Or_Checked<T>::value, bool>::type
449 is_not_a_number(const T& x);
450 
452 template <typename T>
453 typename Enable_If<Is_Native_Or_Checked<T>::value, bool>::type
454 is_minus_infinity(const T& x);
455 
457 template <typename T>
458 typename Enable_If<Is_Native_Or_Checked<T>::value, bool>::type
459 is_plus_infinity(const T& x);
460 
462 template <typename T>
463 typename Enable_If<Is_Native_Or_Checked<T>::value, int>::type
464 infinity_sign(const T& x);
465 
467 template <typename T>
468 typename Enable_If<Is_Native_Or_Checked<T>::value, bool>::type
469 is_integer(const T& x);
470 
472 template <typename To, typename From>
474 construct(To& to, const From& x, Rounding_Dir dir);
475 
477 template <typename To, typename From>
478 typename Enable_If<Is_Native_Or_Checked<To>::value && Is_Special<From>::value, Result>::type
479 assign_r(To& to, const From& x, Rounding_Dir dir);
480 
482 template <typename To>
484 assign_r(To& to, const char* x, Rounding_Dir dir);
485 
487 template <typename To, typename To_Policy>
489 assign_r(To& to, char* x, Rounding_Dir dir);
490 
491 #define PPL_DECLARE_FUNC1_A(name) \
492 template <typename To, typename From> \
493 typename Enable_If<Is_Native_Or_Checked<To>::value \
494  && Is_Native_Or_Checked<From>::value, \
495  Result>::type \
496  PPL_U(name)(To& to, const From& x, Rounding_Dir dir);
497 
499 PPL_DECLARE_FUNC1_A(floor_assign_r)
500 PPL_DECLARE_FUNC1_A(ceil_assign_r)
501 PPL_DECLARE_FUNC1_A(trunc_assign_r)
502 PPL_DECLARE_FUNC1_A(neg_assign_r)
503 PPL_DECLARE_FUNC1_A(abs_assign_r)
504 PPL_DECLARE_FUNC1_A(sqrt_assign_r)
505 
506 #undef PPL_DECLARE_FUNC1_A
507 
508 #define PPL_DECLARE_FUNC1_B(name) \
509 template <typename To, typename From> \
510 typename Enable_If<Is_Native_Or_Checked<To>::value \
511  && Is_Native_Or_Checked<From>::value, \
512  Result>::type \
513  PPL_U(name)(To& to, const From& x, unsigned int exp, Rounding_Dir dir);
514 
515 PPL_DECLARE_FUNC1_B(add_2exp_assign_r)
516 PPL_DECLARE_FUNC1_B(sub_2exp_assign_r)
517 PPL_DECLARE_FUNC1_B(mul_2exp_assign_r)
518 PPL_DECLARE_FUNC1_B(div_2exp_assign_r)
519 PPL_DECLARE_FUNC1_B(smod_2exp_assign_r)
520 PPL_DECLARE_FUNC1_B(umod_2exp_assign_r)
521 
522 #undef PPL_DECLARE_FUNC1_B
523 
524 #define PPL_DECLARE_FUNC2(name) \
525 template <typename To, typename From1, typename From2> \
526 typename Enable_If<Is_Native_Or_Checked<To>::value \
527  && Is_Native_Or_Checked<From1>::value \
528  && Is_Native_Or_Checked<From2>::value, \
529  Result>::type \
530  PPL_U(name)(To& to, const From1& x, const From2& y, Rounding_Dir dir);
531 
532 PPL_DECLARE_FUNC2(add_assign_r)
533 PPL_DECLARE_FUNC2(sub_assign_r)
534 PPL_DECLARE_FUNC2(mul_assign_r)
535 PPL_DECLARE_FUNC2(div_assign_r)
536 PPL_DECLARE_FUNC2(idiv_assign_r)
537 PPL_DECLARE_FUNC2(rem_assign_r)
538 PPL_DECLARE_FUNC2(gcd_assign_r)
539 PPL_DECLARE_FUNC2(lcm_assign_r)
540 PPL_DECLARE_FUNC2(add_mul_assign_r)
541 PPL_DECLARE_FUNC2(sub_mul_assign_r)
542 
543 #undef PPL_DECLARE_FUNC2
544 
545 #define PPL_DECLARE_FUNC4(name) \
546 template <typename To1, typename To2, typename To3, \
547  typename From1, typename From2> \
548 typename Enable_If<Is_Native_Or_Checked<To1>::value \
549  && Is_Native_Or_Checked<To2>::value \
550  && Is_Native_Or_Checked<To3>::value \
551  && Is_Native_Or_Checked<From1>::value \
552  && Is_Native_Or_Checked<From2>::value, \
553  Result>::type \
554  PPL_U(name)(To1& to, To2& s, To3& t, \
555  const From1& x, const From2& y, \
556  Rounding_Dir dir);
557 
558 PPL_DECLARE_FUNC4(gcdext_assign_r)
559 
560 #undef PPL_DECLARE_FUNC4
561 
563 
564 
566 
568 
569 
571 
572 template <typename T, typename Policy>
574 total_memory_in_bytes(const Checked_Number<T, Policy>& x);
575 
577 
578 template <typename T, typename Policy>
580 external_memory_in_bytes(const Checked_Number<T, Policy>& x);
581 
583 
585 
586 
588 
589 template <typename T, typename Policy>
590 Checked_Number<T, Policy>
591 operator+(const Checked_Number<T, Policy>& x);
592 
594 
595 template <typename T, typename Policy>
596 Checked_Number<T, Policy>
597 operator-(const Checked_Number<T, Policy>& x);
598 
600 
601 template <typename T, typename Policy>
602 void
603 floor_assign(Checked_Number<T, Policy>& x);
604 
606 
607 template <typename T, typename Policy>
608 void
609 floor_assign(Checked_Number<T, Policy>& x, const Checked_Number<T, Policy>& y);
610 
612 
613 template <typename T, typename Policy>
614 void
615 ceil_assign(Checked_Number<T, Policy>& x);
616 
618 
619 template <typename T, typename Policy>
620 void
621 ceil_assign(Checked_Number<T, Policy>& x, const Checked_Number<T, Policy>& y);
622 
624 
625 template <typename T, typename Policy>
626 void
627 trunc_assign(Checked_Number<T, Policy>& x);
628 
630 
631 template <typename T, typename Policy>
632 void
633 trunc_assign(Checked_Number<T, Policy>& x, const Checked_Number<T, Policy>& y);
634 
636 
637 template <typename T, typename Policy>
638 void
639 neg_assign(Checked_Number<T, Policy>& x);
640 
642 
643 template <typename T, typename Policy>
644 void
645 neg_assign(Checked_Number<T, Policy>& x, const Checked_Number<T, Policy>& y);
646 
648 
649 template <typename T, typename Policy>
650 void
651 abs_assign(Checked_Number<T, Policy>& x);
652 
654 
655 template <typename T, typename Policy>
656 void
657 abs_assign(Checked_Number<T, Policy>& x, const Checked_Number<T, Policy>& y);
658 
660 
661 template <typename T, typename Policy>
662 void
663 add_mul_assign(Checked_Number<T, Policy>& x,
664  const Checked_Number<T, Policy>& y,
665  const Checked_Number<T, Policy>& z);
666 
668 
669 template <typename T, typename Policy>
670 void
671 sub_mul_assign(Checked_Number<T, Policy>& x,
672  const Checked_Number<T, Policy>& y,
673  const Checked_Number<T, Policy>& z);
674 
676 
677 template <typename T, typename Policy>
678 void
679 gcd_assign(Checked_Number<T, Policy>& x,
680  const Checked_Number<T, Policy>& y,
681  const Checked_Number<T, Policy>& z);
682 
688 template <typename T, typename Policy>
689 void
690 gcdext_assign(Checked_Number<T, Policy>& x,
691  Checked_Number<T, Policy>& s,
692  Checked_Number<T, Policy>& t,
693  const Checked_Number<T, Policy>& y,
694  const Checked_Number<T, Policy>& z);
695 
697 
698 template <typename T, typename Policy>
699 void
700 lcm_assign(Checked_Number<T, Policy>& x,
701  const Checked_Number<T, Policy>& y,
702  const Checked_Number<T, Policy>& z);
703 
705 
706 template <typename T, typename Policy>
707 void
708 mul_2exp_assign(Checked_Number<T, Policy>& x,
709  const Checked_Number<T, Policy>& y,
710  unsigned int exp);
711 
713 
714 template <typename T, typename Policy>
715 void
716 div_2exp_assign(Checked_Number<T, Policy>& x,
717  const Checked_Number<T, Policy>& y,
718  unsigned int exp);
719 
727 template <typename T, typename Policy>
728 void
729 exact_div_assign(Checked_Number<T, Policy>& x,
730  const Checked_Number<T, Policy>& y,
731  const Checked_Number<T, Policy>& z);
732 
734 
735 template <typename T, typename Policy>
736 void sqrt_assign(Checked_Number<T, Policy>& x,
737  const Checked_Number<T, Policy>& y);
738 
740 
741 
743 
744 
746 
747 template <typename T1, typename T2>
748 inline
752  bool>::type
753 operator==(const T1& x, const T2& y);
754 
756 template <typename T1, typename T2>
759  bool>::type
760 equal(const T1& x, const T2& y);
761 
763 
764 template <typename T1, typename T2>
765 inline
767  && Is_Native_Or_Checked<T2>::value
769  bool>::type
770 operator!=(const T1& x, const T2& y);
771 
773 template <typename T1, typename T2>
775  && Is_Native_Or_Checked<T2>::value,
776  bool>::type
777 not_equal(const T1& x, const T2& y);
778 
780 
781 template <typename T1, typename T2>
782 inline
784  && Is_Native_Or_Checked<T2>::value
786  bool>::type
787 operator>=(const T1& x, const T2& y);
788 
790 template <typename T1, typename T2>
792  && Is_Native_Or_Checked<T2>::value,
793  bool>::type
794 greater_or_equal(const T1& x, const T2& y);
795 
797 
798 template <typename T1, typename T2>
799 inline
801  && Is_Native_Or_Checked<T2>::value
803  bool>::type
804 operator>(const T1& x, const T2& y);
805 
807 template <typename T1, typename T2>
809  && Is_Native_Or_Checked<T2>::value,
810  bool>::type
811 greater_than(const T1& x, const T2& y);
812 
814 
815 template <typename T1, typename T2>
816 inline
818  && Is_Native_Or_Checked<T2>::value
820  bool>::type
821 operator<=(const T1& x, const T2& y);
822 
824 template <typename T1, typename T2>
826  && Is_Native_Or_Checked<T2>::value,
827  bool>::type
828 less_or_equal(const T1& x, const T2& y);
829 
831 
832 template <typename T1, typename T2>
833 inline
835  && Is_Native_Or_Checked<T2>::value
837  bool>::type
838 operator<(const T1& x, const T2& y);
839 
841 template <typename T1, typename T2>
843  && Is_Native_Or_Checked<T2>::value,
844  bool>::type
845 less_than(const T1& x, const T2& y);
846 
853 template <typename From>
855 sgn(const From& x);
856 
863 template <typename From1, typename From2>
866  int>::type
867 cmp(const From1& x, const From2& y);
868 
870 
872 
873 
875 template <typename T>
877 output(std::ostream& os,
878  const T& x,
879  const Numeric_Format& format,
880  Rounding_Dir dir);
881 
883 
884 template <typename T, typename Policy>
885 std::ostream&
886 operator<<(std::ostream& os, const Checked_Number<T, Policy>& x);
887 
889 
890 template <typename T>
891 typename Enable_If<Is_Native_Or_Checked<T>::value, void>::type
892 ascii_dump(std::ostream& s, const T& t);
893 
895 
1019 template <typename T>
1021 input(T& x, std::istream& is, Rounding_Dir dir);
1022 
1024 
1025 template <typename T, typename Policy>
1026 std::istream&
1027 operator>>(std::istream& is, Checked_Number<T, Policy>& x);
1028 
1030 
1031 template <typename T>
1032 typename Enable_If<Is_Native_Or_Checked<T>::value, bool>::type
1033 ascii_load(std::ostream& s, T& t);
1034 
1036 
1038 
1039 template <typename T>
1040 T
1041 plus_infinity();
1042 
1043 template <typename T>
1044 T
1045 minus_infinity();
1046 
1047 template <typename T>
1048 T
1049 not_a_number();
1050 
1052 
1053 template <typename T, typename Policy>
1054 void swap(Checked_Number<T, Policy>& x, Checked_Number<T, Policy>& y);
1055 
1056 template <typename T, typename Policy>
1057 struct FPU_Related<Checked_Number<T, Policy> > : public FPU_Related<T> {};
1058 
1059 template <typename T>
1061 
1062 template <typename T>
1064 
1065 } // namespace Parma_Polyhedra_Library
1066 
1067 #include "Checked_Number_inlines.hh"
1068 #include "Checked_Number_templates.hh"
1069 
1070 #endif // !defined(PPL_Checked_Number_defs_hh)
#define PPL_DECLARE_FUNC1_B(name)
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_minus_infinity(const T &x)
void swap(CO_Tree &x, CO_Tree &y)
Checked_Number & operator%=(const Checked_Number< T, From_Policy > &y)
Compute remainder and assign operator.
#define PPL_DECLARE_FUNC1_A(name)
void throw_result_exception(Result r)
bool OK() const
Checks if all the invariants are satisfied.
Rounding_Dir
Rounding directions for arithmetic computations.
Enable_If< Is_Native_Or_Checked< T >::value, void >::type ascii_dump(std::ostream &s, const T &t)
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)
void abs_assign(GMP_Integer &x)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
From bool Type Type Rounding_Dir To
int fpu_check_inexact()
Queries the inexact computation status.
void lcm_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
std::istream & operator>>(std::istream &is, Interval< Boundary, Info > &x)
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)
Checked_Number & operator/=(const Checked_Number< T, From_Policy > &y)
Divide and assign operator.
Result classify(bool nan=true, bool inf=true, bool sign=true) const
Classifies *this.
Checked_Number & operator++()
Pre-increment operator.
void div_2exp_assign(GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
A wrapper for numeric types implementing a given policy.
#define PPL_DECLARE_FUNC2(name)
A class holding a constant called value that evaluates to true.
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)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_not_a_number(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type ascii_load(std::istream &s, T &t)
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)
Coefficient value
Definition: PIP_Tree.cc:618
Checked_Number & operator+=(const Checked_Number< T, From_Policy > &y)
Add and assign operator.
Checked_Number & operator--()
Pre-decrement operator.
void mul_2exp_assign(GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir From1
Checked_Number & operator*=(const Checked_Number< T, From_Policy > &y)
Multiply and assign operator.
void neg_assign(GMP_Integer &x)
The entire library is confined to this namespace.
Definition: version.hh:61
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator+(const Interval< B, Info > &x, const T &y)
int cmp(const GMP_Integer &x, const GMP_Integer &y)
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir From2
From bool Type Type Rounding_Dir From
void gcd_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
int sgn(Boundary_Type type, const T &x, const Info &info)
#define PPL_DECLARE_FUNC4(name)
void sub_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator-(const Interval< B, Info > &x, const T &y)
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type construct(To &to, const From &, Rounding_Dir dir)
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) ...
Enable_If< Is_Native_Or_Checked< T >::value, int >::type infinity_sign(const T &x)
A class holding a constant called value that evaluates to false.
T & raw_value()
Returns a reference to the underlying numeric value.
A class holding a constant called value that evaluates to b.
Checked_Number & operator-=(const Checked_Number< T, From_Policy > &y)
Subtract and assign operator.