Skip to content

Instantly share code, notes, and snippets.

@liancheng
Created August 15, 2012 12:52
Show Gist options
  • Save liancheng/3359897 to your computer and use it in GitHub Desktop.
Save liancheng/3359897 to your computer and use it in GitHub Desktop.
std::numeric_limits<mpz_class> specialization for GNU MP C++ API
#include <limits>
namespace std {
template<>
struct numeric_limits<mpz_class> {
public:
static const bool is_specialized = true;
static mpz_class min() throw() {
return mpz_class(0u);
}
static mpz_class max() throw() {
return mpz_class(0u);
}
static const int digits = 0;
static const int digits10 = 0;
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static mpz_class epsilon() throw() {
return mpz_class(0u);
}
static mpz_class round_error() throw() {
return mpz_class(0u);
}
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static mpz_class infinity() throw() {
return mpz_class(0U);
}
static mpz_class quiet_NaN() throw() {
return mpz_class(0u);
}
static mpz_class signaling_NaN() throw() {
return mpz_class(0u);
}
static mpz_class denorm_min() throw() {
return mpz_class(0u);
}
static const bool is_iec559 = false;
static const bool is_bounded = false;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
}; // class numeric_limits<mpz_class>
} // namespace std
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment