source: git/libpolys/coeffs/rmodulo2m.cc @ e5422d

spielwiese
Last change on this file since e5422d was e5422d, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
fixed zero divisior issue in Z/2^mZ coauthor: Frank Seelisch <seelisch@mathematik.uni-kl.de>
  • Property mode set to 100644
File size: 16.6 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id$ */
5/*
6* ABSTRACT: numbers modulo 2^m
7*/
8
9#include "config.h"
10#include <misc/auxiliary.h>
11
12#ifdef HAVE_RINGS
13
14#include <misc/mylimits.h>
15#include <coeffs/coeffs.h>
16#include <reporter/reporter.h>
17#include <omalloc/omalloc.h>
18#include <coeffs/numbers.h>
19#include <coeffs/longrat.h>
20#include <coeffs/mpr_complex.h>
21#include <coeffs/rmodulo2m.h>
22#include <coeffs/si_gmp.h>
23
24#include <string.h>
25
26extern omBin gmp_nrz_bin; /* init in rintegers*/
27
28/* for initializing function pointers */
29BOOLEAN nr2mInitChar (coeffs r, void* p)
30{
31 
32  nr2mInitExp((int)(long)(p), r);
33
34  r->cfInit        = nr2mInit;
35  r->cfCopy        = ndCopy;
36  r->cfInt         = nr2mInt;
37  r->cfAdd         = nr2mAdd;
38  r->cfSub         = nr2mSub;
39  r->cfMult        = nr2mMult;
40  r->cfDiv         = nr2mDiv;
41  r->cfIntDiv      = nr2mIntDiv;
42  r->cfIntMod      = nr2mMod;
43  r->cfExactDiv    = nr2mDiv;
44  r->cfNeg         = nr2mNeg;
45  r->cfInvers      = nr2mInvers;
46  r->cfDivBy       = nr2mDivBy;
47  r->cfDivComp     = nr2mDivComp;
48  r->cfGreater     = nr2mGreater;
49  r->cfEqual       = nr2mEqual;
50  r->cfIsZero      = nr2mIsZero;
51  r->cfIsOne       = nr2mIsOne;
52  r->cfIsMOne      = nr2mIsMOne;
53  r->cfGreaterZero = nr2mGreaterZero;
54  r->cfWrite       = nr2mWrite;
55  r->cfRead        = nr2mRead;
56  r->cfPower       = nr2mPower;
57  r->cfSetMap      = nr2mSetMap;
58  r->cfNormalize   = ndNormalize;
59  r->cfLcm         = nr2mLcm;
60  r->cfGcd         = nr2mGcd;
61  r->cfIsUnit      = nr2mIsUnit;
62  r->cfGetUnit     = nr2mGetUnit;
63  r->cfExtGcd      = nr2mExtGcd;
64  r->cfName        = ndName;
65#ifdef LDEBUG
66  r->cfDBTest      = nr2mDBTest;
67#endif
68  r->has_simple_Alloc=TRUE;
69  return FALSE;
70}
71
72/*
73 * Multiply two numbers
74 */
75number nr2mMult(number a, number b, const coeffs r)
76{
77  if (((NATNUMBER)a == 0) || ((NATNUMBER)b == 0))
78    return (number)0;
79  else
80    return nr2mMultM(a, b, r);
81}
82
83/*
84 * Give the smallest k, such that a * x = k = b * y has a solution
85 */
86number nr2mLcm(number a, number b, const coeffs r)
87{
88  NATNUMBER res = 0;
89  if ((NATNUMBER)a == 0) a = (number) 1;
90  if ((NATNUMBER)b == 0) b = (number) 1;
91  while ((NATNUMBER)a % 2 == 0)
92  {
93    a = (number)((NATNUMBER)a / 2);
94    if ((NATNUMBER)b % 2 == 0) b = (number)((NATNUMBER)b / 2);
95    res++;
96  }
97  while ((NATNUMBER)b % 2 == 0)
98  {
99    b = (number)((NATNUMBER)b / 2);
100    res++;
101  }
102  return (number)(1L << res);  // (2**res)
103}
104
105/*
106 * Give the largest k, such that a = x * k, b = y * k has
107 * a solution.
108 */
109number nr2mGcd(number a, number b, const coeffs r)
110{
111  NATNUMBER res = 0;
112  if ((NATNUMBER)a == 0 && (NATNUMBER)b == 0) return (number)1;
113  while ((NATNUMBER)a % 2 == 0 && (NATNUMBER)b % 2 == 0)
114  {
115    a = (number)((NATNUMBER)a / 2);
116    b = (number)((NATNUMBER)b / 2);
117    res++;
118  }
119//  if ((NATNUMBER)b % 2 == 0)
120//  {
121//    return (number)((1L << res)); // * (NATNUMBER) a);  // (2**res)*a    a is a unit
122//  }
123//  else
124//  {
125    return (number)((1L << res)); // * (NATNUMBER) b);  // (2**res)*b    b is a unit
126//  }
127}
128
129/*
130 * Give the largest k, such that a = x * k, b = y * k has
131 * a solution.
132 */
133number nr2mExtGcd(number a, number b, number *s, number *t, const coeffs r)
134{
135  NATNUMBER res = 0;
136  if ((NATNUMBER)a == 0 && (NATNUMBER)b == 0) return (number)1;
137  while ((NATNUMBER)a % 2 == 0 && (NATNUMBER)b % 2 == 0)
138  {
139    a = (number)((NATNUMBER)a / 2);
140    b = (number)((NATNUMBER)b / 2);
141    res++;
142  }
143  if ((NATNUMBER)b % 2 == 0)
144  {
145    *t = NULL;
146    *s = nr2mInvers(a,r);
147    return (number)((1L << res)); // * (NATNUMBER) a);  // (2**res)*a    a is a unit
148  }
149  else
150  {
151    *s = NULL;
152    *t = nr2mInvers(b,r);
153    return (number)((1L << res)); // * (NATNUMBER) b);  // (2**res)*b    b is a unit
154  }
155}
156
157void nr2mPower(number a, int i, number * result, const coeffs r)
158{
159  if (i == 0)
160  {
161    *(NATNUMBER *)result = 1;
162  }
163  else if (i == 1)
164  {
165    *result = a;
166  }
167  else
168  {
169    nr2mPower(a, i-1, result, r);
170    *result = nr2mMultM(a, *result, r);
171  }
172}
173
174/*
175 * create a number from int
176 */
177number nr2mInit(int i, const coeffs r)
178{
179  if (i == 0) return (number)(NATNUMBER)i;
180
181  long ii = i;
182  NATNUMBER j = (NATNUMBER)1;
183  if (ii < 0) { j = r->mod2mMask; ii = -ii; }
184  NATNUMBER k = (NATNUMBER)ii;
185  k = k & r->mod2mMask;
186  /* now we have: i = j * k mod 2^m */
187  return (number)nr2mMult((number)j, (number)k, r);
188}
189
190/*
191 * convert a number to an int in ]-k/2 .. k/2],
192 * where k = 2^m; i.e., an int in ]-2^(m-1) .. 2^(m-1)];
193 * note that the code computes a long which will then
194 * automatically casted to int
195 */
196int nr2mInt(number &n, const coeffs r)
197{
198  NATNUMBER nn = (unsigned long)(NATNUMBER)n & r->mod2mMask;
199  unsigned long l = r->mod2mMask >> 1; l++; /* now: l = 2^(m-1) */
200  if ((NATNUMBER)nn > l)
201    return (int)((NATNUMBER)nn - r->mod2mMask - 1);
202  else
203    return (int)((NATNUMBER)nn);
204}
205
206number nr2mAdd(number a, number b, const coeffs r)
207{
208  return nr2mAddM(a, b, r);
209}
210
211number nr2mSub(number a, number b, const coeffs r)
212{
213  return nr2mSubM(a, b, r);
214}
215
216BOOLEAN nr2mIsUnit(number a, const coeffs r)
217{
218  return ((NATNUMBER)a % 2 == 1);
219}
220
221number nr2mGetUnit(number k, const coeffs r)
222{
223  if (k == NULL) return (number)1;
224  NATNUMBER erg = (NATNUMBER)k;
225  while (erg % 2 == 0) erg = erg / 2;
226  return (number)erg;
227}
228
229BOOLEAN nr2mIsZero(number a, const coeffs r)
230{
231  return 0 == (NATNUMBER)a;
232}
233
234BOOLEAN nr2mIsOne(number a, const coeffs r)
235{
236  return 1 == (NATNUMBER)a;
237}
238
239BOOLEAN nr2mIsMOne(number a, const coeffs r)
240{
241  return (r->mod2mMask  == (NATNUMBER)a);
242}
243
244BOOLEAN nr2mEqual(number a, number b, const coeffs r)
245{
246  return (a == b);
247}
248
249BOOLEAN nr2mGreater(number a, number b, const coeffs r)
250{
251  return nr2mDivBy(a, b,r);
252}
253
254/* Is a divisible by b? There are two cases:
255   1) a = 0 mod 2^m; then TRUE iff b = 0 or b is a power of 2
256   2) a, b <> 0; then TRUE iff b/gcd(a, b) is a unit mod 2^m
257   TRUE iff b(gcd(a, b) is a unit */
258BOOLEAN nr2mDivBy (number a, number b, const coeffs r)
259{
260  if (a == NULL)
261  {
262    NATNUMBER c = r->mod2mMask + 1;
263    if (c != 0) /* i.e., if no overflow */
264      return (c % (NATNUMBER)b) == 0;
265    else
266    {
267      /* overflow: we need to check whether b
268         is zero or a power of 2: */
269      c = (NATNUMBER)b;
270      while (c != 0)
271      {
272        if ((c % 2) != 0) return FALSE;
273        c = c >> 1;
274      }
275      return TRUE;
276    }
277  }
278  else
279  {
280    number n = nr2mGcd(a, b, r);
281    n = nr2mDiv(b, n, r);
282    return nr2mIsUnit(n, r);
283  }
284}
285
286int nr2mDivComp(number as, number bs, const coeffs r)
287{
288  NATNUMBER a = (NATNUMBER)as;
289  NATNUMBER b = (NATNUMBER)bs;
290  assume(a != 0 && b != 0);
291  while (a % 2 == 0 && b % 2 == 0)
292  {
293    a = a / 2;
294    b = b / 2;
295  }
296  if (a % 2 == 0)
297  {
298    return -1;
299  }
300  else
301  {
302    if (b % 2 == 1)
303    {
304      return 2;
305    }
306    else
307    {
308      return 1;
309    }
310  }
311}
312
313/* TRUE iff 0 < k <= 2^m / 2 */
314BOOLEAN nr2mGreaterZero(number k, const coeffs r)
315{
316  if ((NATNUMBER)k == 0) return FALSE;
317  if ((NATNUMBER)k > ((r->mod2mMask >> 1) + 1)) return FALSE;
318  return TRUE;
319}
320
321/* assumes that 'a' is odd, i.e., a unit in Z/2^m, and computes
322   the extended gcd of 'a' and 2^m, in order to find some 's'
323   and 't' such that a * s + 2^m * t = gcd(a, 2^m) = 1;
324   this code will always find a positive 's' */
325void specialXGCD(unsigned long& s, unsigned long a, const coeffs r)
326{
327  int_number u = (int_number)omAlloc(sizeof(mpz_t));
328  mpz_init_set_ui(u, a);
329  int_number u0 = (int_number)omAlloc(sizeof(mpz_t));
330  mpz_init(u0);
331  int_number u1 = (int_number)omAlloc(sizeof(mpz_t));
332  mpz_init_set_ui(u1, 1);
333  int_number u2 = (int_number)omAlloc(sizeof(mpz_t));
334  mpz_init(u2);
335  int_number v = (int_number)omAlloc(sizeof(mpz_t));
336  mpz_init_set_ui(v, r->mod2mMask);
337  mpz_add_ui(v, v, 1); /* now: v = 2^m */
338  int_number v0 = (int_number)omAlloc(sizeof(mpz_t));
339  mpz_init(v0);
340  int_number v1 = (int_number)omAlloc(sizeof(mpz_t));
341  mpz_init(v1);
342  int_number v2 = (int_number)omAlloc(sizeof(mpz_t));
343  mpz_init_set_ui(v2, 1);
344  int_number q = (int_number)omAlloc(sizeof(mpz_t));
345  mpz_init(q);
346  int_number rr = (int_number)omAlloc(sizeof(mpz_t));
347  mpz_init(rr);
348
349  while (mpz_cmp_ui(v, 0) != 0) /* i.e., while v != 0 */
350  {
351    mpz_div(q, u, v);
352    mpz_mod(rr, u, v);
353    mpz_set(u, v);
354    mpz_set(v, rr);
355    mpz_set(u0, u2);
356    mpz_set(v0, v2);
357    mpz_mul(u2, u2, q); mpz_sub(u2, u1, u2); /* u2 = u1 - q * u2 */
358    mpz_mul(v2, v2, q); mpz_sub(v2, v1, v2); /* v2 = v1 - q * v2 */
359    mpz_set(u1, u0);
360    mpz_set(v1, v0);
361  }
362
363  while (mpz_cmp_ui(u1, 0) < 0) /* i.e., while u1 < 0 */
364  {
365    /* we add 2^m = (2^m - 1) + 1 to u1: */
366    mpz_add_ui(u1, u1, r->mod2mMask);
367    mpz_add_ui(u1, u1, 1);
368  }
369  s = mpz_get_ui(u1); /* now: 0 <= s <= 2^m - 1 */
370
371  mpz_clear(u);  omFree((ADDRESS)u);
372  mpz_clear(u0); omFree((ADDRESS)u0);
373  mpz_clear(u1); omFree((ADDRESS)u1);
374  mpz_clear(u2); omFree((ADDRESS)u2);
375  mpz_clear(v);  omFree((ADDRESS)v);
376  mpz_clear(v0); omFree((ADDRESS)v0);
377  mpz_clear(v1); omFree((ADDRESS)v1);
378  mpz_clear(v2); omFree((ADDRESS)v2);
379  mpz_clear(q); omFree((ADDRESS)q);
380  mpz_clear(rr); omFree((ADDRESS)rr);
381}
382
383NATNUMBER InvMod(NATNUMBER a, const coeffs r)
384{
385  assume((NATNUMBER)a % 2 != 0);
386  unsigned long s;
387  specialXGCD(s, a, r);
388  return s;
389}
390//#endif
391
392inline number nr2mInversM(number c, const coeffs r)
393{
394  assume((NATNUMBER)c % 2 != 0);
395  // Table !!!
396  NATNUMBER inv;
397  inv = InvMod((NATNUMBER)c,r);
398  return (number)inv;
399}
400
401number nr2mDiv(number a, number b, const coeffs r)
402{
403  if ((NATNUMBER)a == 0) return (number)0;
404  else if ((NATNUMBER)b % 2 == 0)
405  {
406    if ((NATNUMBER)b != 0)
407    {
408      while (((NATNUMBER)b % 2 == 0) && ((NATNUMBER)a % 2 == 0))
409      {
410        a = (number)((NATNUMBER)a / 2);
411        b = (number)((NATNUMBER)b / 2);
412      }
413    }
414    if ((NATNUMBER)b % 2 == 0)
415    {
416      WerrorS("Division not possible, even by cancelling zero divisors.");
417      WerrorS("Result is integer division without remainder.");
418      return (number) ((NATNUMBER) a / (NATNUMBER) b);
419    }
420  }
421  return (number)nr2mMult(a, nr2mInversM(b,r),r);
422}
423
424number nr2mMod(number a, number b, const coeffs r)
425{
426  /*
427    We need to return the number rr which is uniquely determined by the
428    following two properties:
429      (1) 0 <= rr < |b| (with respect to '<' and '<=' performed in Z x Z)
430      (2) There exists some k in the integers Z such that a = k * b + rr.
431    Consider g := gcd(2^m, |b|). Note that then |b|/g is a unit in Z/2^m.
432    Now, there are three cases:
433      (a) g = 1
434          Then |b| is a unit in Z/2^m, i.e. |b| (and also b) divides a.
435          Thus rr = 0.
436      (b) g <> 1 and g divides a
437          Then a = (a/g) * (|b|/g)^(-1) * b (up to sign), i.e. again rr = 0.
438      (c) g <> 1 and g does not divide a
439          Let's denote the division with remainder of a by g as follows:
440          a = s * g + t. Then t = a - s * g = a - s * (|b|/g)^(-1) * |b|
441          fulfills (1) and (2), i.e. rr := t is the correct result. Hence
442          in this third case, rr is the remainder of division of a by g in Z.
443    This algorithm is the same as for the case Z/n, except that we may
444    compute the gcd of |b| and 2^m "by hand": We just extract the highest
445    power of 2 (<= 2^m) that is contained in b.
446  */
447  assume((NATNUMBER)b != 0);
448  NATNUMBER g = 1;
449  NATNUMBER b_div = (NATNUMBER)b;
450  if (b_div < 0) b_div = -b_div; // b_div now represents |b|
451  NATNUMBER rr = 0;
452  while ((g < r->mod2mMask ) && (b_div > 0) && (b_div % 2 == 0))
453  {
454    b_div = b_div >> 1;
455    g = g << 1;
456  } // g is now the gcd of 2^m and |b|
457
458  if (g != 1) rr = (NATNUMBER)a % g;
459  return (number)rr;
460}
461
462number nr2mIntDiv(number a, number b, const coeffs r)
463{
464  if ((NATNUMBER)a == 0)
465  {
466    if ((NATNUMBER)b == 0)
467      return (number)1;
468    if ((NATNUMBER)b == 1)
469      return (number)0;
470    NATNUMBER c = r->mod2mMask + 1;
471    if (c != 0) /* i.e., if no overflow */
472      return (number)(c / (NATNUMBER)b);
473    else
474    {
475      /* overflow: c = 2^32 resp. 2^64, depending on platform */
476      int_number cc = (int_number)omAlloc(sizeof(mpz_t));
477      mpz_init_set_ui(cc, r->mod2mMask); mpz_add_ui(cc, cc, 1);
478      mpz_div_ui(cc, cc, (unsigned long)(NATNUMBER)b);
479      unsigned long s = mpz_get_ui(cc);
480      mpz_clear(cc); omFree((ADDRESS)cc);
481      return (number)(NATNUMBER)s;
482    }
483  }
484  else
485  {
486    if ((NATNUMBER)b == 0)
487      return (number)0;
488    return (number)((NATNUMBER) a / (NATNUMBER) b);
489  }
490}
491
492number nr2mInvers(number c, const coeffs r)
493{
494  if ((NATNUMBER)c % 2 == 0)
495  {
496    WerrorS("division by zero divisor");
497    return (number)0;
498  }
499  return nr2mInversM(c, r);
500}
501
502number nr2mNeg(number c, const coeffs r)
503{
504  if ((NATNUMBER)c == 0) return c;
505  return nr2mNegM(c, r);
506}
507
508number nr2mMapMachineInt(number from, const coeffs src, const coeffs dst)
509{
510  NATNUMBER i = ((NATNUMBER)from) % dst->mod2mMask ;
511  return (number)i;
512}
513
514number nr2mMapZp(number from, const coeffs src, const coeffs dst)
515{
516  NATNUMBER j = (NATNUMBER)1;
517  long ii = (long)from;
518  if (ii < 0) { j = dst->mod2mMask; ii = -ii; }
519  NATNUMBER i = (NATNUMBER)ii;
520  i = i & dst->mod2mMask;
521  /* now we have: from = j * i mod 2^m */
522  return (number)nr2mMult((number)i, (number)j, dst);
523}
524
525number nr2mMapQ(number from, const coeffs src, const coeffs dst)
526{
527  int_number erg = (int_number)omAllocBin(gmp_nrz_bin);
528  mpz_init(erg);
529  int_number k = (int_number)omAlloc(sizeof(mpz_t));
530  mpz_init_set_ui(k, dst->mod2mMask);
531
532  nlGMP(from, (number)erg, dst);
533  mpz_and(erg, erg, k);
534  number res = (number)mpz_get_ui(erg);
535
536  mpz_clear(erg); omFree((ADDRESS)erg);
537  mpz_clear(k);   omFree((ADDRESS)k);
538
539  return (number)res;
540}
541
542number nr2mMapGMP(number from, const coeffs src, const coeffs dst)
543{
544  int_number erg = (int_number)omAllocBin(gmp_nrz_bin);
545  mpz_init(erg);
546  int_number k = (int_number)omAlloc(sizeof(mpz_t));
547  mpz_init_set_ui(k, dst->mod2mMask);
548
549  mpz_and(erg, (int_number)from, k);
550  number res = (number) mpz_get_ui(erg);
551
552  mpz_clear(erg); omFree((ADDRESS)erg);
553  mpz_clear(k);   omFree((ADDRESS)k);
554
555  return (number)res;
556}
557
558nMapFunc nr2mSetMap(const coeffs src, const coeffs dst)
559{
560  if (nCoeff_is_Ring_2toM(src)
561     && (src->mod2mMask == dst->mod2mMask))
562  {
563    return ndCopyMap;
564  }
565  if (nCoeff_is_Ring_2toM(src)
566     && (src->ringflagb < dst->ringflagb))
567  { /* i.e. map an integer mod 2^s into Z mod 2^t, where t < s */
568    return nr2mMapMachineInt;
569  }
570  if (nCoeff_is_Ring_2toM(src)
571     && (src->ringflagb > dst->ringflagb))
572  { /* i.e. map an integer mod 2^s into Z mod 2^t, where t > s */
573    // to be done
574  }
575  if (nCoeff_is_Ring_Z(src))
576  {
577    return nr2mMapGMP;
578  }
579  if (nCoeff_is_Q(src))
580  {
581    return nr2mMapQ;
582  }
583  if (nCoeff_is_Zp(src) && (src->ch == 2))
584  {
585    return nr2mMapZp;
586  }
587  if (nCoeff_is_Ring_PtoM(src) || nCoeff_is_Ring_ModN(src))
588  {
589    // Computing the n of Z/n
590    int_number modul = (int_number)omAllocBin(gmp_nrz_bin);
591    mpz_init_set(modul, src->modNumber);
592    int_number twoToTheK = (int_number)omAllocBin(gmp_nrz_bin);
593    mpz_init_set_ui(twoToTheK, src->mod2mMask);
594    mpz_add_ui(twoToTheK, twoToTheK, 1);
595    if (mpz_divisible_p(modul, twoToTheK))
596    {
597      mpz_clear(modul);     omFree((void *)modul);
598      mpz_clear(twoToTheK); omFree((void *)twoToTheK);
599      return nr2mMapGMP;
600    }
601    mpz_clear(modul);     omFree((void *) modul);
602    mpz_clear(twoToTheK); omFree((void *)twoToTheK);
603  }
604  return NULL;      // default
605}
606
607/*
608 * set the exponent
609 */
610
611void nr2mSetExp(int m, coeffs r)
612{
613  if (m > 1)
614  {
615    /* we want mod2mMask to be the bit pattern
616       '111..1' consisting of m one's: */
617    r->mod2mMask = 1;
618    for (int i = 1; i < m; i++) r->mod2mMask = (r->mod2mMask << 1) + 1;
619  }
620  else
621  {
622    /* code unexpectedly called with m = 1; we go on with m = 2: */
623    r->mod2mMask = 3; /* i.e., '11' in binary representation */
624  }
625  r->ch = r->mod2mMask + 1;
626}
627
628void nr2mInitExp(int m, coeffs r)
629{
630  nr2mSetExp(m, r);
631  if (m < 2)
632    WarnS("nr2mInitExp unexpectedly called with m = 1 (we go on with Z/2^2");
633}
634
635#ifdef LDEBUG
636BOOLEAN nr2mDBTest (number a, const char *f, const int l, const coeffs r)
637{
638  if ((NATNUMBER)a < 0) return FALSE;
639  if (((NATNUMBER)a & r->mod2mMask) != (NATNUMBER)a) return FALSE;
640  return TRUE;
641}
642#endif
643
644void nr2mWrite (number &a, const coeffs r)
645{
646  int i = nr2mInt(a, r);
647  StringAppend("%d", i);
648}
649
650static const char* nr2mEati(const char *s, int *i, const coeffs r)
651{
652
653  if (((*s) >= '0') && ((*s) <= '9'))
654  {
655    (*i) = 0;
656    do
657    {
658      (*i) *= 10;
659      (*i) += *s++ - '0';
660      if ((*i) >= (MAX_INT_VAL / 10)) (*i) = (*i) & r->mod2mMask;
661    }
662    while (((*s) >= '0') && ((*s) <= '9'));
663    (*i) = (*i) & r->mod2mMask;
664  }
665  else (*i) = 1;
666  return s;
667}
668
669const char * nr2mRead (const char *s, number *a, const coeffs r)
670{
671  int z;
672  int n=1;
673
674  s = nr2mEati(s, &z,r);
675  if ((*s) == '/')
676  {
677    s++;
678    s = nr2mEati(s, &n,r);
679  }
680  if (n == 1)
681    *a = (number)z;
682  else
683      *a = nr2mDiv((number)z,(number)n,r);
684  return s;
685}
686#endif
687/* #ifdef HAVE_RINGS */
Note: See TracBrowser for help on using the repository browser.