1 /* Declarations of specializations of std:: objects for 2 multi-precision types. 3 Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> 4 Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com) 5 6 This file is part of the Parma Polyhedra Library (PPL). 7 8 The PPL is free software; you can redistribute it and/or modify it 9 under the terms of the GNU General Public License as published by the 10 Free Software Foundation; either version 3 of the License, or (at your 11 option) any later version. 12 13 The PPL is distributed in the hope that it will be useful, but WITHOUT 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software Foundation, 20 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 21 22 For the most up-to-date information see the Parma Polyhedra Library 23 site: http://bugseng.com/products/ppl/ . */ 24 25 #ifndef PPL_mp_std_bits_defs_hh 26 #define PPL_mp_std_bits_defs_hh 1 27 28 #include <gmpxx.h> 29 #include <limits> 30 31 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 32 //! Swaps \p x with \p y. 33 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 34 void swap(mpz_class& x, mpz_class& y); 35 36 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 37 //! Swaps \p x with \p y. 38 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 39 void swap(mpq_class& x, mpq_class& y); 40 41 #if __GNU_MP_VERSION < 5 \ 42 || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1) 43 44 namespace std { 45 46 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 47 //! Specialization of std::numeric_limits. 48 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 49 template <> 50 class numeric_limits<mpz_class> { 51 private: 52 typedef mpz_class Type; 53 54 public: 55 static const bool is_specialized = true; 56 static const int digits = 0; 57 static const int digits10 = 0; 58 static const bool is_signed = true; 59 static const bool is_integer = true; 60 static const bool is_exact = true; 61 static const int radix = 2; 62 static const int min_exponent = 0; 63 static const int min_exponent10 = 0; 64 static const int max_exponent = 0; 65 static const int max_exponent10 = 0; 66 static const bool has_infinity = false; 67 static const bool has_quiet_NaN = false; 68 static const bool has_signaling_NaN = false; 69 static const float_denorm_style has_denorm = denorm_absent; 70 static const bool has_denorm_loss = false; 71 static const bool is_iec559 = false; 72 static const bool is_bounded = false; 73 static const bool is_modulo = false; 74 static const bool traps = false; 75 static const bool tinyness_before = false; 76 static const float_round_style round_style = round_toward_zero; 77 min()78 static Type min() { 79 return static_cast<Type>(0); 80 } 81 max()82 static Type max() { 83 return static_cast<Type>(0); 84 } 85 epsilon()86 static Type epsilon() { 87 return static_cast<Type>(0); 88 } 89 round_error()90 static Type round_error() { 91 return static_cast<Type>(0); 92 } 93 infinity()94 static Type infinity() { 95 return static_cast<Type>(0); 96 } 97 quiet_NaN()98 static Type quiet_NaN() { 99 return static_cast<Type>(0); 100 } 101 denorm_min()102 static Type denorm_min() { 103 return static_cast<Type>(1); 104 } 105 }; 106 107 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS 108 //! Specialization of std::numeric_limits. 109 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) 110 template <> 111 class numeric_limits<mpq_class> { 112 private: 113 typedef mpq_class Type; 114 115 public: 116 static const bool is_specialized = true; 117 static const int digits = 0; 118 static const int digits10 = 0; 119 static const bool is_signed = true; 120 static const bool is_integer = false; 121 static const bool is_exact = true; 122 static const int radix = 2; 123 static const int min_exponent = 0; 124 static const int min_exponent10 = 0; 125 static const int max_exponent = 0; 126 static const int max_exponent10 = 0; 127 static const bool has_infinity = false; 128 static const bool has_quiet_NaN = false; 129 static const bool has_signaling_NaN = false; 130 static const float_denorm_style has_denorm = denorm_absent; 131 static const bool has_denorm_loss = false; 132 static const bool is_iec559 = false; 133 static const bool is_bounded = false; 134 static const bool is_modulo = false; 135 static const bool traps = false; 136 static const bool tinyness_before = false; 137 static const float_round_style round_style = round_toward_zero; 138 min()139 static Type min() { 140 return static_cast<Type>(0); 141 } 142 max()143 static Type max() { 144 return static_cast<Type>(0); 145 } 146 epsilon()147 static Type epsilon() { 148 return static_cast<Type>(0); 149 } 150 round_error()151 static Type round_error() { 152 return static_cast<Type>(0); 153 } 154 infinity()155 static Type infinity() { 156 return static_cast<Type>(0); 157 } 158 quiet_NaN()159 static Type quiet_NaN() { 160 return static_cast<Type>(0); 161 } 162 denorm_min()163 static Type denorm_min() { 164 return static_cast<Type>(0); 165 } 166 }; 167 168 } // namespace std 169 170 #endif // __GNU_MP_VERSION < 5 171 // || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1) 172 173 #include "mp_std_bits_inlines.hh" 174 175 #endif // !defined(PPL_mp_std_bits_defs_hh) 176