21 mpz_init_set( dummy,
thempi );
28 if ( *c ==
'*' && mpz_cmp_si(
thempi, 1 ) == 0 )
30 else if ( *c ==
'*' && mpz_cmp_si(
thempi, -1 ) == 0 )
33 char * str =
new char[mpz_sizeinbase(
thempi, 10 ) + 2];
34 str = mpz_get_str( str, 10,
thempi );
72 mpz_init_set( dummy,
thempi );
73 mpz_neg( dummy, dummy );
215 mpz_sub_ui( dummy,
thempi, -cc );
217 mpz_add_ui( dummy,
thempi, cc );
254 mpz_init_set_si( dummy, cc );
255 mpz_sub( dummy, dummy,
thempi );
261 mpz_add_ui( dummy,
thempi, -cc );
263 mpz_sub_ui( dummy,
thempi, cc );
279 mpz_init_set_si( dummy, cc );
310 mpz_mul_ui( dummy,
thempi, -cc );
311 mpz_neg( dummy, dummy );
314 mpz_mul_ui( dummy,
thempi, cc );
360 mpz_abs( result, result );
388 if ( cInt == 1 || cInt == -1 )
390 else if ( cInt == 0 )
395 if ( cInt < 0 ) cInt = -cInt;
399 cInt = mpz_gcd_ui( dummy,
thempi, cInt );
401 if ( cInt < 0 ) cInt = -cInt;
425 mpz_gcdext( result, aMPI, bMPI,
thempi,
MPI( c ) );
428 if ( mpz_sgn( result ) < 0 )
430 mpz_neg( result, result );
431 mpz_neg( aMPI, aMPI );
432 mpz_neg( bMPI, bMPI );
478 if ( cInt == 1 || cInt == -1 )
483 else if ( cInt == 0 )
508 return mpz_get_si(
thempi );
513 return (
int)mpz_fdiv_ui(
thempi, (
unsigned long)p );
531 ASSERT( mpz_cmp_si(
thempi, 0 ) >= 0,
"sqrt() argument < 0" );
534 mpz_sqrt( result,
thempi );
551 ASSERT( mpz_cmp_si(
thempi, 0 ) > 0,
"log() argument <= 0" );
552 return mpz_sizeinbase(
thempi, 2 ) - 1;
Factory's internal rationals.
int comparecoeff(InternalCF *)
virtual bool isOne() const
bool InternalCF::isOne, isZero () const
InternalCF * neg()
InternalCF * InternalInteger::neg ()
static InternalCF * int2imm(long i)
InternalCF * bgcdcoeff(const InternalCF *const)
InternalCF * copyObject()
InternalCF * bextgcdsame(InternalCF *, CanonicalForm &, CanonicalForm &)
void print(OSTREAM &, char *)
virtual bool isZero() const
int comparesame(InternalCF *)
virtual class for internal CanonicalForm's
virtual int levelcoeff() const
InternalCF * bextgcdcoeff(InternalCF *, CanonicalForm &, CanonicalForm &)
bool isOn(int s) const
check if 's' is on
InternalCF * subsame(InternalCF *)
static const int SW_RATIONAL
set to 1 for computations over Q
InternalCF * addcoeff(InternalCF *)
InternalCF * subcoeff(InternalCF *, bool)
static mpz_ptr MPI(const InternalCF *const c)
MPI() - return underlying mpz_t of `c'.
InternalCF * sqrt()
InternalCF * InternalInteger::sqrt ()
InternalCF * mulsame(InternalCF *)
static long imm2int(const InternalCF *const imm)
#define omGetSpecBin(size)
utility functions for gmp
InternalCF * deepCopyObject() const
void divremcoeff(InternalCF *, InternalCF *&, InternalCF *&, bool)
operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int...
InternalCF * addsame(InternalCF *)
INST_VAR CFSwitches cf_glob_switches
InternalCF * bgcdsame(const InternalCF *const) const
#define ASSERT(expression, message)
int sign() const
int InternalInteger::sign () const
InternalCF * mulcoeff(InternalCF *)
int ilog2()
int InternalInteger::ilog2 ()
bool mpz_is_imm(const mpz_t mpi)
factory's class for integers
static const omBin InternalInteger_bin
Factory's internal integers.