38 int i2=(int)(
long)b->
Data();
48 mpz_ptr modBase= (mpz_ptr)
omAlloc(
sizeof(mpz_t));
49 mpz_init_set_ui(modBase,i2);
61 number i2=(number)b->
Data();
65 number modBase= (number)
omAlloc(
sizeof(mpz_t));
67 info.
base= (mpz_ptr)modBase;
88 a2=(number2)a->
Data();
93 b2=(number2)b->
Data();
94 if ((a2!=
NULL) && (a2->cf!=b2->cf))
96 WerrorS(
"Number not compatible");
101 number2
r=(number2)
omAlloc(
sizeof(*r));
102 if (a2!=
NULL) r->cf=a2->cf;
104 if (r->cf==
NULL) op=0;
117 if ((b2==
NULL) &&(op!=
'^') &&(op!=0))
130 case '+': r->n=
n_Add(aa,bb,r->cf);
break;
131 case '-': r->n=
n_Sub(aa,bb,r->cf);
break;
132 case '*': r->n=
n_Mult(aa,bb,r->cf);
break;
133 case '/': r->n=
n_Div(aa,bb,r->cf);
break;
134 case '%': r->n=
n_IntMod(aa,bb,r->cf);
break;
136 case '^':
n_Power(aa,(
int)(
long)b->
Data(),&(r->n),r->cf);
break;
150 number2 a2=(number2)a->
Data();
151 number2
r=(number2)
omAlloc(
sizeof(*r));
153 if (a2->cf==
NULL) op=0;
156 case '-': r->n=
n_Copy(a2->n,a2->cf);r->n=
n_InpNeg(r->n,a2->cf);
break;
168 number2
r=(number2)
omAlloc(
sizeof(*r));
191 number2 a2=(number2)a->
Data();
197 r->n=nMap(a2->n,a2->cf,r->cf);
203 default: bo=
TRUE;
break;
217 number2 n=(number2)a->
Data();
219 res->
data=(
void*)n->cf;
238 (int)(
long)c->
Data(),
246 number2 n2=(number2)a->
Data();
264 res->
data=(
void*)(
long)(a2==b2);
275 r=(number2)
omAlloc(
sizeof(*r));
330 ring
r=(ring)a->
Data();
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
BOOLEAN jjNUMBER2_OP2(leftv res, leftv a, leftv b)
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
const CanonicalForm int s
BOOLEAN jjN2_CR(leftv res, leftv a)
Class used for (list of) interpreter objects.
only used if HAVE_RINGS is defined
BOOLEAN jjCMATRIX_3(leftv res, leftv r, leftv c, leftv cf)
BOOLEAN jjCRING_Zm(leftv res, leftv a, leftv b)
void n2Delete(number2 &d)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
#define omFreeSize(addr, size)
BOOLEAN jjCM_CR(leftv res, leftv a)
BOOLEAN jjEQUAL_CR(leftv res, leftv a, leftv b)
void WerrorS(const char *s)
void nlGMP(number &i, number n, const coeffs r)
char * crString(coeffs c)
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
BOOLEAN jjN2_N(leftv res, leftv a)
BOOLEAN jjNUMBER2CR(leftv res, leftv a, leftv b)
The main handler for Singular numbers which are suitable for Singular polynomials.
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
void StringSetS(const char *st)
void StringAppendS(const char *st)
const ExtensionInfo & info
< [in] sqrfree poly
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE char * nCoeffName(const coeffs cf)
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
only used if HAVE_RINGS is defined
void PrintS(const char *s)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
BOOLEAN jjR2_CR(leftv res, leftv a)
number2 n2Copy(const number2 d)
BOOLEAN jjNUMBER2_OP1(leftv res, leftv a)
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
const char * Tok2Cmdname(int tok)
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
coeffs basecoeffs() const
BOOLEAN jjCRING_Zp(leftv res, leftv a, leftv b)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
BOOLEAN jjBIM2_CR(leftv res, leftv a)
void nKillChar(coeffs r)
undo all initialisations
void Werror(const char *fmt,...)
char * n2String(number2 d, BOOLEAN typed)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL