31 "type error: InternalInteger expected" );
41 mpz_init_set( d,
MPI( c ) );
44 return result->normalize_myself();
50 mpz_init( mpiResult );
51 if ( mpz_sgn(
MPI( c ) ) > 0 )
52 mpz_fdiv_q( mpiResult,
thempi,
MPI( c ) );
54 mpz_cdiv_q( mpiResult,
thempi,
MPI( c ) );
57 if ( mpz_sgn(
MPI( c ) ) > 0 )
72 "type error: immediate integer expected" );
74 "math error: divide by zero" );
81 mpz_init_set_si( n, intC );
85 mpz_init_set_si( d, intC );
89 return result->normalize_myself();
93 int mpiSign = mpz_sgn(
thempi );
102 mpz_init( mpiResult );
104 mpz_fdiv_q_ui( mpiResult,
thempi, intC );
106 mpz_fdiv_q_ui( mpiResult,
thempi, -intC );
107 mpz_neg( mpiResult, mpiResult );
128 "type error: InternalInteger expected" );
138 mpz_init( mpiResult );
139 mpz_divexact( mpiResult,
thempi,
MPI( c ) );
154 "type error: immediate integer expected" );
156 "math error: divide by zero" );
158 "math error: c does not divide CO" );
168 mpz_init_set_si( mpiC,
imm2int( c ) );
169 mpz_init( mpiResult );
170 mpz_divexact( mpiResult,
thempi, mpiC );
175 mpz_init_set_si( mpiC,
imm2int( c ) );
189 "type error: InternalInteger expected" );
199 mpz_init( mpiResult );
215 "type error: immediate integer expected" );
217 "math error: divide by zero" );
233 mpz_init_set( mpiResult,
thempi );
234 mpz_abs( mpiResult, mpiResult );
235 mpz_sub_ui( mpiResult, mpiResult, -intC );
274 "type error: InternalInteger expected" );
284 mpz_init_set( n,
thempi );
285 mpz_init_set( d,
MPI( c ) );
287 quot =
result->normalize_myself();
294 mpz_init( q ); mpz_init( r );
295 if ( mpz_sgn(
MPI( c ) ) > 0 )
311 "type error: immediate integer expected" );
313 "math error: divide by zero" );
320 mpz_init_set_si( n, intC );
321 mpz_init_set( d,
thempi );
323 mpz_init_set( n,
thempi );
324 mpz_init_set_si( d, intC );
327 quot =
result->normalize_myself();
338 mpz_init_set( mpiResult,
thempi );
339 mpz_abs( mpiResult, mpiResult );
340 mpz_sub_ui( mpiResult, mpiResult, -intC );
347 mpz_init( q ); mpz_init( dummy );
#define ASSERT(expression, message)
static const int SW_RATIONAL
set to 1 for computations over Q
INST_VAR CFSwitches cf_glob_switches
bool isOn(int s) const
check if 's' is on
virtual class for internal CanonicalForm's
virtual int levelcoeff() const
virtual InternalCF * invert()
InternalCF * dividecoeff(InternalCF *, bool)
InternalCF * normalizeMyself()
normalizeMyself(), uiNormalizeMyself() - normalize CO.
InternalCF * modsame(InternalCF *)
static InternalCF * uiNormalizeMPI(mpz_ptr)
‘uiNormalizeMPI()’ is the same as ‘normalizeMPI()’ except that ‘aMpi’ is expected to be non-begative.
void divremcoeff(InternalCF *, InternalCF *&, InternalCF *&, bool)
friend class InternalRational
InternalCF * modcoeff(InternalCF *, bool)
InternalCF * modulocoeff(InternalCF *, bool)
InternalCF * modulosame(InternalCF *)
InternalCF * divcoeff(InternalCF *, bool)
void divremsame(InternalCF *, InternalCF *&, InternalCF *&)
static InternalCF * normalizeMPI(mpz_ptr)
normalizeMPI(), uiNormalizeMPI() - normalize a mpi.
bool divremsamet(InternalCF *, InternalCF *&, InternalCF *&)
InternalCF * dividesame(InternalCF *)
InternalCF * divsame(InternalCF *)
static mpz_ptr MPI(const InternalCF *const c)
MPI() - return underlying mpz_t of ‘c’.
InternalCF * uiNormalizeMyself()
‘uiNormalizeMyself()’ is the same as ‘normalizeMyself()’ except that CO is expected to be non-negativ...
bool divremcoefft(InternalCF *, InternalCF *&, InternalCF *&, bool)
factory's class for rationals
some useful template functions.
utility functions for gmp
operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int,...
static long imm2int(const InternalCF *const imm)
static InternalCF * int2imm(long i)
Factory's internal CanonicalForm's.
Factory's internal integers.
Factory's internal rationals.
void rem(unsigned long *a, unsigned long *q, unsigned long p, int °a, int degq)