Add precise() to numeric_traits

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-07-19 10:42:19 -07:00
parent c581990f67
commit 6e6d83d46c
4 changed files with 4 additions and 0 deletions

View file

@ -246,6 +246,7 @@ public:
template<>
class numeric_traits<mpbq> {
public:
static bool precise() { return true; }
static bool is_zero(mpbq const & v) { return v.is_zero(); }
static bool is_pos(mpbq const & v) { return v.is_pos(); }
static bool is_neg(mpbq const & v) { return v.is_neg(); }

View file

@ -211,6 +211,7 @@ public:
template<>
class numeric_traits<mpq> {
public:
static bool precise() { return true; }
static bool is_zero(mpq const & v) { return v.is_zero(); }
static bool is_pos(mpq const & v) { return v.is_pos(); }
static bool is_neg(mpq const & v) { return v.is_neg(); }

View file

@ -221,6 +221,7 @@ public:
template<>
class numeric_traits<mpz> {
public:
static bool precise() { return true; }
static bool is_zero(mpz const & v) { return v.is_zero(); }
static bool is_pos(mpz const & v) { return v.is_pos(); }
static bool is_neg(mpz const & v) { return v.is_neg(); }

View file

@ -18,6 +18,7 @@ void double_power(double & v, unsigned k);
template<>
class numeric_traits<double> {
public:
static bool precise() { return false; }
static bool is_zero(double v) { return v == 0.0; }
static bool is_pos(double v) { return v > 0.0; }
static bool is_neg(double v) { return v < 0.0; }