My Project
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
longrat.h File Reference
#include "misc/auxiliary.h"
#include "coeffs/si_gmp.h"
#include "coeffs/coeffs.h"
#include "factory/si_log2.h"

Go to the source code of this file.

Data Structures

struct  number
 'SR_INT' is the type of those integers small enough to fit into 29 bits. More...
 

Macros

#define SR_HDL(A)   ((long)(A))
 
#define SR_INT   1L
 
#define INT_TO_SR(INT)   ((number) (((long)INT << 2) + SR_INT))
 
#define SR_TO_INT(SR)   (((long)SR) >> 2)
 
#define MP_SMALL   1
 

Functions

number nlGetDenom (number &n, const coeffs r)
 
number nlGetNumerator (number &n, const coeffs r)
 
BOOLEAN nlInitChar (coeffs, void *)
 
static FORCE_INLINE int nlQlogSize (number n, const coeffs r)
 only used by slimgb (tgb.cc)
 
static FORCE_INLINE BOOLEAN nlIsInteger (number q, const coeffs r)
 
void nlMPZ (mpz_t m, number &n, 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)
 
number nlInit2 (int i, int j, const coeffs r)
 create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
 
number nlInit2gmp (mpz_t i, mpz_t j, const coeffs r)
 create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode
 
number nlChineseRemainderSym (number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF)
 

Data Structure Documentation

◆ snumber

struct snumber

'SR_INT' is the type of those integers small enough to fit into 29 bits.

Therefor the value range of this small integers is: $-2^{28}...2^{28}-1$.

Small integers are represented by an immediate integer handle, containing the value instead of pointing to it, which has the following form:

+-------+-------+-------+-------+- - - -+-------+-------+-------+
| guard | sign  | bit   | bit   |       | bit   | tag   | tag   |
| bit   | bit   | 27    | 26    |       | 0     | 0     | 1     |
+-------+-------+-------+-------+- - - -+-------+-------+-------+

Immediate integers handles carry the tag 'SR_INT', i.e. the last bit is 1. This distuingishes immediate integers from other handles which point to structures aligned on 4 byte boundaries and therefor have last bit zero. (The second bit is reserved as tag to allow extensions of this scheme.) Using immediates as pointers and dereferencing them gives address errors.

To aid overflow check the most significant two bits must always be equal, that is to say that the sign bit of immediate integers has a guard bit.

The macros 'INT_TO_SR' and 'SR_TO_INT' should be used to convert between a small integer value and its representation as immediate integer handle.

Large integers and rationals are represented by z and n where n may be undefined (if s==3) NULL represents only deleted values

Definition at line 48 of file longrat.h.

Data Fields
int debug
mpz_t n
BOOLEAN s parameter s in number: 0 (or FALSE): not normalised rational 1 (or TRUE): normalised rational 3 : integer with n==NULL
mpz_t z

Macro Definition Documentation

◆ INT_TO_SR

#define INT_TO_SR (   INT)    ((number) (((long)INT << 2) + SR_INT))

Definition at line 68 of file longrat.h.

◆ MP_SMALL

#define MP_SMALL   1

Definition at line 71 of file longrat.h.

◆ SR_HDL

#define SR_HDL (   A)    ((long)(A))

Definition at line 65 of file longrat.h.

◆ SR_INT

#define SR_INT   1L

Definition at line 67 of file longrat.h.

◆ SR_TO_INT

#define SR_TO_INT (   SR)    (((long)SR) >> 2)

Definition at line 69 of file longrat.h.

Function Documentation

◆ nlChineseRemainderSym()

number nlChineseRemainderSym ( number x,
number q,
int  rl,
BOOLEAN  sym,
CFArray inv_cache,
const coeffs  CF 
)

Definition at line 3086 of file longrat.cc.

3088{
3089 setCharacteristic( 0 ); // only in char 0
3091 CFArray X(rl), Q(rl);
3092 int i;
3093 for(i=rl-1;i>=0;i--)
3094 {
3095 X[i]=CF->convSingNFactoryN(x[i],FALSE,CF); // may be larger MAX_INT
3096 Q[i]=CF->convSingNFactoryN(q[i],FALSE,CF); // may be larger MAX_INT
3097 }
3099 if (n_SwitchChinRem)
3101 else
3103 number n=CF->convFactoryNSingN(xnew,CF);
3104 if (sym)
3105 {
3106 number p=CF->convFactoryNSingN(qnew,CF);
3107 number p2;
3108 if (getCoeffType(CF) == n_Q) p2=nlIntDiv(p,nlInit(2, CF),CF);
3109 else p2=CF->cfDiv(p,CF->cfInit(2, CF),CF);
3110 if (CF->cfGreater(n,p2,CF))
3111 {
3112 number n2=CF->cfSub(n,p,CF);
3113 CF->cfDelete(&n,CF);
3114 n=n2;
3115 }
3116 CF->cfDelete(&p2,CF);
3117 CF->cfDelete(&p,CF);
3118 }
3119 CF->cfNormalize(n,CF);
3120 return n;
3121}
#define FALSE
Definition auxiliary.h:96
void Off(int sw)
switches
void FACTORY_PUBLIC setCharacteristic(int c)
Definition cf_char.cc:28
int i
Definition cfEzgcd.cc:132
Variable x
Definition cfModGcd.cc:4090
int p
Definition cfModGcd.cc:4086
void FACTORY_PUBLIC chineseRemainder(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew)
void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2,...
Definition cf_chinese.cc:57
void FACTORY_PUBLIC chineseRemainderCached(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew, CFArray &inv)
static const int SW_RATIONAL
set to 1 for computations over Q
Definition cf_defs.h:31
factory's main class
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:429
VAR int n_SwitchChinRem
Definition longrat.cc:3085
number nlIntDiv(number a, number b, const coeffs r)
Definition longrat.cc:935
LINLINE number nlInit(long i, const coeffs r)
Definition longrat.cc:2597
#define Q
Definition sirandom.c:26

◆ nlDelete()

void nlDelete ( number a,
const coeffs  r 
)

Definition at line 2657 of file longrat.cc.

2658{
2659 if (*a!=NULL)
2660 {
2661 nlTest(*a, r);
2662 if ((SR_HDL(*a) & SR_INT)==0)
2663 {
2664 _nlDelete_NoImm(a);
2665 }
2666 *a=NULL;
2667 }
2668}
#define nlTest(a, r)
Definition longrat.cc:87
void _nlDelete_NoImm(number *a)
Definition longrat.cc:1761
#define SR_INT
Definition longrat.h:67
#define NULL
Definition omList.c:12
#define SR_HDL(A)
Definition tgb.cc:35

◆ nlGetDenom()

number nlGetDenom ( number n,
const coeffs  r 
)

Definition at line 1633 of file longrat.cc.

1634{
1635 if (!(SR_HDL(n) & SR_INT))
1636 {
1637 if (n->s==0)
1638 {
1639 nlNormalize(n,r);
1640 }
1641 if (!(SR_HDL(n) & SR_INT))
1642 {
1643 if (n->s!=3)
1644 {
1646 u->s=3;
1647#if defined(LDEBUG)
1648 u->debug=123456;
1649#endif
1650 mpz_init_set(u->z,n->n);
1651 u=nlShort3_noinline(u);
1652 return u;
1653 }
1654 }
1655 }
1656 return INT_TO_SR(1);
1657}
#define ALLOC_RNUMBER()
Definition coeffs.h:94
number nlShort3_noinline(number x)
Definition longrat.cc:159
void nlNormalize(number &x, const coeffs r)
Definition longrat.cc:1481
#define INT_TO_SR(INT)
Definition longrat.h:68

◆ nlGetNumerator()

number nlGetNumerator ( number n,
const coeffs  r 
)

Definition at line 1662 of file longrat.cc.

1663{
1664 if (!(SR_HDL(n) & SR_INT))
1665 {
1666 if (n->s==0)
1667 {
1668 nlNormalize(n,r);
1669 }
1670 if (!(SR_HDL(n) & SR_INT))
1671 {
1673#if defined(LDEBUG)
1674 u->debug=123456;
1675#endif
1676 u->s=3;
1677 mpz_init_set(u->z,n->z);
1678 if (n->s!=3)
1679 {
1680 u=nlShort3_noinline(u);
1681 }
1682 return u;
1683 }
1684 }
1685 return n; // imm. int
1686}

◆ nlInit2()

number nlInit2 ( int  i,
int  j,
const coeffs  r 
)

create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode

Definition at line 2535 of file longrat.cc.

2536{
2538#if defined(LDEBUG)
2539 z->debug=123456;
2540#endif
2541 mpz_init_set_si(z->z,(long)i);
2542 mpz_init_set_si(z->n,(long)j);
2543 z->s = 0;
2544 nlNormalize(z,r);
2545 return z;
2546}
int j
Definition facHensel.cc:110

◆ nlInit2gmp()

number nlInit2gmp ( mpz_t  i,
mpz_t  j,
const coeffs  r 
)

create a rational i/j (implicitly) over Q NOTE: make sure to use correct Q in debug mode

Definition at line 2548 of file longrat.cc.

2549{
2551#if defined(LDEBUG)
2552 z->debug=123456;
2553#endif
2554 mpz_init_set(z->z,i);
2555 mpz_init_set(z->n,j);
2556 z->s = 0;
2557 nlNormalize(z,r);
2558 return z;
2559}

◆ nlInitChar()

BOOLEAN nlInitChar ( coeffs  r,
void p 
)

Definition at line 3466 of file longrat.cc.

3467{
3468 r->is_domain=TRUE;
3469 r->rep=n_rep_gap_rat;
3470
3471 r->nCoeffIsEqual=nlCoeffIsEqual;
3472 //r->cfKillChar = ndKillChar; /* dummy */
3473 //r->cfCoeffString=nlCoeffString;
3474 r->cfCoeffName=nlCoeffName;
3475
3476 r->cfInitMPZ = nlInitMPZ;
3477 r->cfMPZ = nlMPZ;
3478
3479 r->cfMult = nlMult;
3480 r->cfSub = nlSub;
3481 r->cfAdd = nlAdd;
3482 r->cfExactDiv= nlExactDiv;
3483 if (p==NULL) /* Q */
3484 {
3485 r->is_field=TRUE;
3486 r->cfDiv = nlDiv;
3487 //r->cfGcd = ndGcd_dummy;
3488 r->cfSubringGcd = nlGcd;
3489 }
3490 else /* Z: coeffs_BIGINT */
3491 {
3492 r->is_field=FALSE;
3493 r->cfDiv = nlIntDiv;
3494 r->cfIntMod= nlIntMod;
3495 r->cfGcd = nlGcd;
3496 r->cfDivBy=nlDivBy;
3497 r->cfDivComp = nlDivComp;
3498 r->cfIsUnit = nlIsUnit;
3499 r->cfGetUnit = nlGetUnit;
3500 r->cfQuot1 = nlQuot1;
3501 r->cfLcm = nlLcm;
3502 r->cfXExtGcd=nlXExtGcd;
3503 r->cfQuotRem=nlQuotRem;
3504 }
3505 r->cfInit = nlInit;
3506 r->cfSize = nlSize;
3507 r->cfInt = nlInt;
3508
3509 r->cfChineseRemainder=nlChineseRemainderSym;
3510 r->cfFarey=nlFarey;
3511 r->cfInpNeg = nlNeg;
3512 r->cfInvers= nlInvers;
3513 r->cfCopy = nlCopy;
3514 r->cfRePart = nlCopy;
3515 //r->cfImPart = ndReturn0;
3516 r->cfWriteLong = nlWrite;
3517 r->cfRead = nlRead;
3518 r->cfNormalize=nlNormalize;
3519 r->cfGreater = nlGreater;
3520 r->cfEqual = nlEqual;
3521 r->cfIsZero = nlIsZero;
3522 r->cfIsOne = nlIsOne;
3523 r->cfIsMOne = nlIsMOne;
3524 r->cfGreaterZero = nlGreaterZero;
3525 r->cfPower = nlPower;
3526 r->cfGetDenom = nlGetDenom;
3527 r->cfGetNumerator = nlGetNumerator;
3528 r->cfExtGcd = nlExtGcd; // only for ring stuff and Z
3529 r->cfNormalizeHelper = nlNormalizeHelper;
3530 r->cfDelete= nlDelete;
3531 r->cfSetMap = nlSetMap;
3532 //r->cfName = ndName;
3533 r->cfInpMult=nlInpMult;
3534 r->cfInpAdd=nlInpAdd;
3535 //r->cfCoeffWrite=nlCoeffWrite;
3536
3537 r->cfClearContent = nlClearContent;
3538 r->cfClearDenominators = nlClearDenominators;
3539
3540#ifdef LDEBUG
3541 // debug stuff
3542 r->cfDBTest=nlDBTest;
3543#endif
3544 r->convSingNFactoryN=nlConvSingNFactoryN;
3545 r->convFactoryNSingN=nlConvFactoryNSingN;
3546
3547 r->cfRandom=nlRandom;
3548
3549 // io via ssi
3550 r->cfWriteFd=nlWriteFd;
3551 r->cfReadFd=nlReadFd;
3552
3553 //r->type = n_Q;
3554 r->ch = 0;
3555 r->has_simple_Alloc=FALSE;
3556 r->has_simple_Inverse=FALSE;
3557
3558 // variables for this type of coeffs:
3559 // (none)
3560 return FALSE;
3561}
#define TRUE
Definition auxiliary.h:100
@ n_rep_gap_rat
(number), see longrat.h
Definition coeffs.h:118
void nlWriteFd(number n, const ssiInfo *d, const coeffs)
Definition longrat.cc:3321
LINLINE void nlInpMult(number &a, number b, const coeffs r)
Definition longrat.cc:2776
LINLINE BOOLEAN nlEqual(number a, number b, const coeffs r)
Definition longrat.cc:2588
LINLINE number nlAdd(number la, number li, const coeffs r)
Definition longrat.cc:2692
long nlInt(number &n, const coeffs r)
Definition longrat.cc:740
static number nlLcm(number a, number b, const coeffs r)
Definition longrat.cc:3442
LINLINE number nlSub(number la, number li, const coeffs r)
Definition longrat.cc:2758
number nlIntMod(number a, number b, const coeffs r)
Definition longrat.cc:1016
LINLINE number nlCopy(number a, const coeffs r)
Definition longrat.cc:2644
LINLINE number nlNeg(number za, const coeffs r)
Definition longrat.cc:2673
number nlXExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
Definition longrat.cc:2819
void nlPower(number x, int exp, number *lu, const coeffs r)
Definition longrat.cc:1250
number nlQuotRem(number a, number b, number *r, const coeffs R)
Definition longrat.cc:2871
number nlFarey(number nN, number nP, const coeffs CF)
Definition longrat.cc:2959
LINLINE BOOLEAN nlIsOne(number a, const coeffs r)
Definition longrat.cc:2615
number nlNormalizeHelper(number a, number b, const coeffs r)
Definition longrat.cc:1525
LINLINE void nlDelete(number *a, const coeffs r)
Definition longrat.cc:2657
BOOLEAN nlGreaterZero(number za, const coeffs r)
Definition longrat.cc:1303
LINLINE void nlInpAdd(number &a, number b, const coeffs r)
Definition longrat.cc:2710
number nlExactDiv(number a, number b, const coeffs r)
Definition longrat.cc:870
const char * nlRead(const char *s, number *a, const coeffs r)
Definition longrat0.cc:31
void nlMPZ(mpz_t m, number &n, const coeffs r)
Definition longrat.cc:2810
number nlInvers(number a, const coeffs r)
Definition longrat.cc:790
BOOLEAN nlIsUnit(number a, const coeffs)
Definition longrat.cc:1131
static number nlConvFactoryNSingN(const CanonicalForm f, const coeffs r)
Definition longrat.cc:365
number nlChineseRemainderSym(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs CF)
Definition longrat.cc:3086
int nlDivComp(number a, number b, const coeffs r)
Definition longrat.cc:1091
char * nlCoeffName(const coeffs r)
Definition longrat.cc:3315
number nlExtGcd(number a, number b, number *s, number *t, const coeffs)
Definition longrat.cc:3030
LINLINE number nlMult(number a, number b, const coeffs r)
Definition longrat.cc:2728
static number nlInitMPZ(mpz_t m, const coeffs)
Definition longrat.cc:164
static void nlClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition longrat.cc:3221
LINLINE BOOLEAN nlIsZero(number za, const coeffs r)
Definition longrat.cc:2624
number nlGetDenom(number &n, const coeffs r)
Definition longrat.cc:1633
number nlGcd(number a, number b, const coeffs r)
Definition longrat.cc:1340
number nlReadFd(const ssiInfo *d, const coeffs)
Definition longrat.cc:3367
int nlSize(number a, const coeffs)
Definition longrat.cc:711
nMapFunc nlSetMap(const coeffs src, const coeffs dst)
Definition longrat.cc:2473
BOOLEAN nlDBTest(number a, const char *f, const int l)
number nlDiv(number a, number b, const coeffs r)
Definition longrat.cc:1140
BOOLEAN nlIsMOne(number a, const coeffs r)
Definition longrat.cc:1328
static void nlClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition longrat.cc:3130
number nlGetNumerator(number &n, const coeffs r)
Definition longrat.cc:1662
BOOLEAN nlCoeffIsEqual(const coeffs r, n_coeffType n, void *p)
Definition longrat.cc:3430
static CanonicalForm nlConvSingNFactoryN(number n, const BOOLEAN setChar, const coeffs)
Definition longrat.cc:327
number nlGetUnit(number n, const coeffs cf)
Definition longrat.cc:1102
coeffs nlQuot1(number c, const coeffs r)
Definition longrat.cc:1108
BOOLEAN nlGreater(number a, number b, const coeffs r)
Definition longrat.cc:1313
BOOLEAN nlDivBy(number a, number b, const coeffs)
Definition longrat.cc:1077
void nlWrite(number a, const coeffs r)
Definition longrat0.cc:90
static number nlRandom(siRandProc p, number v2, number, const coeffs cf)
Definition longrat.cc:3452

◆ nlInpGcd()

void nlInpGcd ( number a,
number  b,
const coeffs  r 
)

Definition at line 2924 of file longrat.cc.

2925{
2926 if ((SR_HDL(b)|SR_HDL(a))&SR_INT)
2927 {
2928 number n=nlGcd(a,b,r);
2929 nlDelete(&a,r);
2930 a=n;
2931 }
2932 else
2933 {
2934 mpz_gcd(a->z,a->z,b->z);
2935 a=nlShort3_noinline(a);
2936 }
2937}
CanonicalForm b
Definition cfModGcd.cc:4111

◆ nlIsInteger()

static FORCE_INLINE BOOLEAN nlIsInteger ( number  q,
const coeffs  r 
)
static

Definition at line 94 of file longrat.h.

95{
96 assume( nCoeff_is_Q (r) );
97 n_Test(q, r);
98
99 if (SR_HDL(q) & SR_INT)
100 return TRUE; // immediate int
101
102 return ( q->s == 3 );
103}
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition coeffs.h:713
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition coeffs.h:799
#define SR_HDL(A)
Definition longrat.h:65
#define assume(x)
Definition mod2.h:387

◆ nlModP()

number nlModP ( number  q,
const coeffs  Q,
const coeffs  Zp 
)

Definition at line 1572 of file longrat.cc.

1573{
1574 const int p = n_GetChar(Zp);
1575 assume( p > 0 );
1576
1577 const long P = p;
1578 assume( P > 0 );
1579
1580 // embedded long within q => only long numerator has to be converted
1581 // to int (modulo char.)
1582 if (SR_HDL(q) & SR_INT)
1583 {
1584 long i = SR_TO_INT(q);
1585 return n_Init( i, Zp );
1586 }
1587
1588 const unsigned long PP = p;
1589
1590 // numerator modulo char. should fit into int
1591 number z = n_Init( static_cast<long>(mpz_fdiv_ui(q->z, PP)), Zp );
1592
1593 // denominator != 1?
1594 if (q->s!=3)
1595 {
1596 // denominator modulo char. should fit into int
1597 number n = n_Init( static_cast<long>(mpz_fdiv_ui(q->n, PP)), Zp );
1598
1599 number res = n_Div( z, n, Zp );
1600
1601 n_Delete(&z, Zp);
1602 n_Delete(&n, Zp);
1603
1604 return res;
1605 }
1606
1607 return z;
1608}
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...
Definition coeffs.h:616
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition coeffs.h:448
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:459
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:539
CanonicalForm res
Definition facAbsFact.cc:60
#define SR_TO_INT(SR)
Definition longrat.h:69

◆ nlMPZ()

void nlMPZ ( mpz_t  m,
number n,
const coeffs  r 
)

Definition at line 2810 of file longrat.cc.

2811{
2812 nlTest(n, r);
2813 nlNormalize(n, r);
2814 if (SR_HDL(n) & SR_INT) mpz_init_set_si(m, SR_TO_INT(n)); /* n fits in an int */
2815 else mpz_init_set(m, (mpz_ptr)n->z);
2816}
int m
Definition cfEzgcd.cc:128

◆ nlNormalize()

void nlNormalize ( number x,
const coeffs  r 
)

Definition at line 1481 of file longrat.cc.

1482{
1483 if ((SR_HDL(x) & SR_INT) ||(x==NULL))
1484 return;
1485 if (x->s==3)
1486 {
1488 nlTest(x,r);
1489 return;
1490 }
1491 else if (x->s==0)
1492 {
1493 if (mpz_cmp_si(x->n,1L)==0)
1494 {
1495 mpz_clear(x->n);
1496 x->s=3;
1497 x=nlShort3(x);
1498 }
1499 else
1500 {
1501 mpz_t gcd;
1502 mpz_init(gcd);
1503 mpz_gcd(gcd,x->z,x->n);
1504 x->s=1;
1505 if (mpz_cmp_si(gcd,1L)!=0)
1506 {
1507 mpz_divexact(x->z,x->z,gcd);
1508 mpz_divexact(x->n,x->n,gcd);
1509 if (mpz_cmp_si(x->n,1L)==0)
1510 {
1511 mpz_clear(x->n);
1512 x->s=3;
1514 }
1515 }
1516 mpz_clear(gcd);
1517 }
1518 }
1519 nlTest(x, r);
1520}
static number nlShort3(number x)
Definition longrat.cc:109
int gcd(int a, int b)

◆ nlQlogSize()

static FORCE_INLINE int nlQlogSize ( number  n,
const coeffs  r 
)
static

only used by slimgb (tgb.cc)

Definition at line 76 of file longrat.h.

77{
78 assume( nCoeff_is_Q (r) );
79
80 if(SR_HDL(n)&SR_INT)
81 {
82 if (SR_HDL(n)==SR_INT) return 0;
83 long i = SR_TO_INT (n);
84 unsigned long v;
85 v = ABS(i);
86 return SI_LOG2_LONG(v) + 1;
87 }
88 //assume denominator is 0
89 number nn=(number) n;
90 return mpz_sizeinbase (nn->z, 2);
91}
static int ABS(int v)
Definition auxiliary.h:112
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
static int SI_LOG2_LONG(long v)
Definition si_log2.h:22