From 25118db0b8cc702d7cbafefe2fd67670e559b759 Mon Sep 17 00:00:00 2001 From: Hans Schoenemann Date: Tue, 2 Feb 2016 17:32:48 +0100 Subject: [PATCH] ring Z via longrat: some preparation --- libpolys/coeffs/longrat.cc | 10 ++++------ libpolys/coeffs/longrat.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/libpolys/coeffs/longrat.cc b/libpolys/coeffs/longrat.cc index b499ade71c..882414212c 100644 --- a/libpolys/coeffs/longrat.cc +++ b/libpolys/coeffs/longrat.cc @@ -88,7 +88,7 @@ void nlInpIntDiv(number &a, number b, const coeffs r); #ifdef LDEBUG #define nlTest(a, r) nlDBTest(a,__FILE__,__LINE__, r) -BOOLEAN nlDBTest(number a, char *f,int l, const coeffs r); +BOOLEAN nlDBTest(number a, const char *f,int l, const coeffs r); #else #define nlTest(a, r) do {} while (0) #endif @@ -112,7 +112,7 @@ BOOLEAN nlDBTest(number a, char *f,int l, const coeffs r); static inline number nlShort3(number x) // assume x->s==3 { assume(x->s==3); - if (mpz_cmp_ui(x->z,(long)0)==0) + if (mpz_cmp_si(x->z,(long)0)==0) { mpz_clear(x->z); FREE_RNUMBER(x); @@ -935,10 +935,7 @@ int nlDivComp(number a, number b, const coeffs r) number nlGetUnit (number n, const coeffs r) { - if (nlGreaterZero(n, r)) - return INT_TO_SR(1); - else - return INT_TO_SR(-1); + return INT_TO_SR(1); } coeffs nlQuot1(number c, const coeffs r) @@ -2584,6 +2581,7 @@ static number nlInitMPZ(mpz_t m, const coeffs) z->debug=123456; #endif mpz_init_set(z->z, m); + z=nlShort3(z); return z; } diff --git a/libpolys/coeffs/longrat.h b/libpolys/coeffs/longrat.h index 3e8eea908d..746d5133e9 100644 --- a/libpolys/coeffs/longrat.h +++ b/libpolys/coeffs/longrat.h @@ -110,7 +110,6 @@ static FORCE_INLINE BOOLEAN nlIsInteger(number q, const coeffs r) number nlModP(number q, const coeffs Q, const coeffs Zp); void nlNormalize(number &x, const coeffs r); void nlInpGcd(number &a, number b, const coeffs r); -void nlDelete(number *a, const coeffs r); /// create a rational i/j (implicitly) over Q