My Project  debian-1:4.1.2-p1+ds-2
shortfl.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 
5 /*
6 * ABSTRACT:
7 */
8 
9 
10 
11 #include "misc/auxiliary.h"
12 #include "misc/mylimits.h"
13 
14 #include "reporter/reporter.h"
15 
16 #include "coeffs/numbers.h"
17 #include "coeffs/coeffs.h"
18 #include "coeffs/mpr_complex.h"
19 
20 #include "coeffs/shortfl.h"
21 #include "coeffs/longrat.h"
22 
23 //#include <string.h>
24 #include <cmath>
25 
26 // Private interface should be hidden!!!
27 
28 #ifdef LDEBUG
29 static BOOLEAN nrDBTest(number a, const coeffs r, const char *f, const int l);
30 #endif
31 
32 /// Get a mapping function from src into the domain of this type: n_R
33 static nMapFunc nrSetMap(const coeffs src, const coeffs dst);
34 
35 // Where are the following used?
36 static number nrMapQ(number from, const coeffs r, const coeffs aRing);
37 
38 static const SI_FLOAT nrEps = 1.0e-3;
39 
40 union nf
41 {
42  SI_FLOAT _f;
43  number _n;
44 
45  nf(SI_FLOAT f): _f(f){};
46 
47  nf(number n): _n(n){};
48 
49  inline SI_FLOAT F() const {return _f;}
50  inline number N() const {return _n;}
51 };
52 
53 
54 
55 
56 SI_FLOAT nrFloat(number n)
57 {
58  return nf(n).F();
59 }
60 
61 
62 static void nrCoeffWrite (const coeffs r, BOOLEAN /*details*/)
63 {
64  assume( getCoeffType(r) == n_R );
65  PrintS("Float()"); /* R */
66 }
67 
68 
69 static BOOLEAN nrGreaterZero (number k, const coeffs r)
70 {
71  assume( getCoeffType(r) == n_R );
72 
73  return nf(k).F() >= 0.0;
74 }
75 
76 static number nrMult (number a,number b, const coeffs r)
77 {
78  assume( getCoeffType(r) == n_R );
79 
80  return nf(nf(a).F() * nf(b).F()).N();
81 }
82 
83 /*2
84 * create a number from int
85 */
86 static number nrInit (long i, const coeffs r)
87 {
88  assume( getCoeffType(r) == n_R );
89 
90  SI_FLOAT f = (SI_FLOAT)i;
91  return nf(nf(f).F()).N();
92 }
93 
94 /*2
95 * convert a number to int
96 */
97 static long nrInt(number &n, const coeffs r)
98 {
99  assume( getCoeffType(r) == n_R );
100 
101  long i;
102  SI_FLOAT f = nf(n).F();
103  if (((SI_FLOAT)(-MAX_INT_VAL-1) <= f) || ((SI_FLOAT)MAX_INT_VAL >= f))
104  i = (long)f;
105  else
106  i = 0;
107  return i;
108 }
109 
110 static number nrAdd (number a, number b, const coeffs r)
111 {
112  assume( getCoeffType(r) == n_R );
113 
114  SI_FLOAT x = nf(a).F();
115  SI_FLOAT y = nf(b).F();
116  SI_FLOAT f = x + y;
117  if (x > 0.0)
118  {
119  if (y < 0.0)
120  {
121  x = f / (x - y);
122  if (x < 0.0)
123  x = -x;
124  if (x < nrEps)
125  f = 0.0;
126  }
127  }
128  else
129  {
130  if (y > 0.0)
131  {
132  x = f / (y - x);
133  if (x < 0.0)
134  x = -x;
135  if (x < nrEps)
136  f = 0.0;
137  }
138  }
139  return nf(f).N();
140 }
141 
142 static number nrSub (number a, number b, const coeffs r)
143 {
144  assume( getCoeffType(r) == n_R );
145 
146  SI_FLOAT x = nf(a).F();
147  SI_FLOAT y = nf(b).F();
148  SI_FLOAT f = x - y;
149  if (x > 0.0)
150  {
151  if (y > 0.0)
152  {
153  x = f / (x + y);
154  if (x < 0.0)
155  x = -x;
156  if (x < nrEps)
157  f = 0.0;
158  }
159  }
160  else
161  {
162  if (y < 0.0)
163  {
164  x = f / (x + y);
165  if (x < 0.0)
166  x = -x;
167  if (x < nrEps)
168  f = 0.0;
169  }
170  }
171  return nf(f).N();
172 }
173 
174 static BOOLEAN nrIsZero (number a, const coeffs r)
175 {
176  assume( getCoeffType(r) == n_R );
177 
178  return (0.0 == nf(a).F());
179 }
180 
181 static BOOLEAN nrIsOne (number a, const coeffs r)
182 {
183  assume( getCoeffType(r) == n_R );
184 
185  SI_FLOAT aa=nf(a).F()-1.0;
186  if (aa<0.0) aa=-aa;
187  return (aa<nrEps);
188 }
189 
190 static BOOLEAN nrIsMOne (number a, const coeffs r)
191 {
192  assume( getCoeffType(r) == n_R );
193 
194  SI_FLOAT aa=nf(a).F()+1.0;
195  if (aa<0.0) aa=-aa;
196  return (aa<nrEps);
197 }
198 
199 static number nrDiv (number a,number b, const coeffs r)
200 {
201  assume( getCoeffType(r) == n_R );
202 
203  SI_FLOAT n = nf(b).F();
204  if (n == 0.0)
205  {
206  WerrorS(nDivBy0);
207  return nf((SI_FLOAT)0.0).N();
208  }
209  else
210  return nf(nf(a).F() / n).N();
211 }
212 
213 static number nrInvers (number c, const coeffs r)
214 {
215  assume( getCoeffType(r) == n_R );
216 
217  SI_FLOAT n = nf(c).F();
218  if (n == 0.0)
219  {
220  WerrorS(nDivBy0);
221  return nf((SI_FLOAT)0.0).N();
222  }
223  return nf(1.0 / n).N();
224 }
225 
226 static number nrNeg (number c, const coeffs r)
227 {
228  assume( getCoeffType(r) == n_R );
229 
230  return nf(-nf(c).F()).N();
231 }
232 
233 static BOOLEAN nrGreater (number a,number b, const coeffs r)
234 {
235  assume( getCoeffType(r) == n_R );
236 
237  return nf(a).F() > nf(b).F();
238 }
239 
240 static BOOLEAN nrEqual (number a,number b, const coeffs r)
241 {
242  assume( getCoeffType(r) == n_R );
243 
244  number x = nrSub(a,b,r);
245  return nf(x).F() == nf((SI_FLOAT)0.0).F();
246 }
247 
248 static void nrWrite (number a, const coeffs r)
249 {
250  assume( getCoeffType(r) == n_R );
251 
252  //#if SIZEOF_DOUBLE == SIZEOF_LONG
253  //char ch[16];
254  //int n = sprintf(ch,"%12.6e", nf(a).F());
255  //#else
256  char ch[11];
257  int n = sprintf(ch,"%9.3e", nf(a).F());
258  //#endif
259  if (ch[0] == '-')
260  {
261  char* chbr = new char[n+3];
262  memcpy(&chbr[2],&ch[1],n-1);
263  chbr[0] = '-';
264  chbr[1] = '(';
265  chbr[n+1] = ')';
266  chbr[n+2] = '\0';
267  StringAppendS(chbr);
268  delete[] chbr;
269  }
270  else
271  StringAppend("(%s)",ch);
272 }
273 
274 #if 0
275 static void nrPower (number a, int i, number * result, const coeffs r)
276 {
277  assume( getCoeffType(r) == n_R );
278 
279  if (i==0)
280  {
281  *result = nf(nf(1.0).F()).N();
282  return;
283  }
284  if (i==1)
285  {
286  *result = nf(nf(a).F()).N();
287  return;
288  }
289  nrPower(a,i-1,result,r);
290  *result = nf(nf(a).F() * nf(*result).F()).N();
291 }
292 #endif
293 
294 namespace {
295  static const char* nrEatr(const char *s, SI_FLOAT *r)
296  {
297  int i;
298 
299  if (*s >= '0' && *s <= '9')
300  {
301  *r = 0.0;
302  do
303  {
304  *r *= 10.0;
305  i = *s++ - '0';
306  *r += (SI_FLOAT)i;
307  }
308  while (*s >= '0' && *s <= '9');
309  }
310  else *r = 1.0;
311  return s;
312  }
313 }
314 
315 static const char * nrRead (const char *s, number *a, const coeffs r)
316 {
317 
318  assume( getCoeffType(r) == n_R );
319 
320  static const char *nIllegalChar="illegal character in number";
321 
322  const char *t;
323  const char *start=s;
324  SI_FLOAT z1,z2;
325  SI_FLOAT n=1.0;
326 
327  s = nrEatr(s, &z1);
328  if (*s == '/')
329  {
330  if (s==start) { WerrorS(nIllegalChar);return s; }
331  s++;
332  s = nrEatr(s, &z2);
333  if (z2==0.0)
334  WerrorS(nDivBy0);
335  else
336  z1 /= z2;
337  }
338  else if (*s =='.')
339  {
340  if (s==start) { WerrorS(nIllegalChar);return s; }
341  s++;
342  t = s;
343  while (*t >= '0' && *t <= '9')
344  {
345  t++;
346  n *= 10.0;
347  }
348  s = nrEatr(s, &z2);
349  z1 = (z1*n + z2) / n;
350  if (*s=='e')
351  {
352  int e=0; /* exponent */
353  int si=1;/* sign of exponent */
354  s++;
355  if (*s=='+') s++;
356  else if (*s=='-') {s++; si=-1; }
357  while (*s >= '0' && *s <= '9')
358  {
359  e=e*10+(*s)-'0';
360  s++;
361  }
362  if (si==1)
363  {
364  while (e>0) {z1*=10.0; e--; }
365  }
366  else
367  {
368  while (e>0) {z1/=10.0; e--; }
369  }
370  }
371  }
372  *a = nf(z1).N();
373  return s;
374 }
375 
376 
377 // the last used charcteristic
378 // int nrGetChar(){ return 0; }
379 
380 
381 #ifdef LDEBUG
382 /*2
383 * test valid numbers: not implemented yet
384 */
385 #pragma GCC diagnostic ignored "-Wunused-parameter"
386 static BOOLEAN nrDBTest(number a, const char *f, const int l, const coeffs r)
387 {
388  assume( getCoeffType(r) == n_R );
389 
390  return TRUE;
391 }
392 #endif
393 
394 static number nrMapP(number from, const coeffs aRing, const coeffs r)
395 {
396  assume( getCoeffType(r) == n_R );
397  assume( getCoeffType(aRing) == n_Zp );
398 
399  int i = (int)((long)from);
400  SI_FLOAT f = (SI_FLOAT)i;
401  return nf(f).N();
402 }
403 
404 static number nrMapLongR(number from, const coeffs aRing, const coeffs r)
405 {
406  assume( getCoeffType(r) == n_R );
407  assume( getCoeffType(aRing) == n_long_R );
408 
409  SI_FLOAT t =(SI_FLOAT)mpf_get_d((mpf_srcptr)from);
410  return nf(t).N();
411 }
412 
413 static number nrMapC(number from, const coeffs aRing, const coeffs r)
414 {
415  assume( getCoeffType(r) == n_R );
416  assume( getCoeffType(aRing) == n_long_C );
417 
418  gmp_float h = ((gmp_complex*)from)->real();
419  SI_FLOAT t =(SI_FLOAT)mpf_get_d((mpf_srcptr)&h);
420  return nf(t).N();
421 }
422 
423 
424 static number nrMapQ(number from, const coeffs aRing, const coeffs r)
425 {
426 /* in longrat.h
427 #define SR_INT 1
428 #define mpz_size1(A) (ABS((A)->_mp_size))
429 */
430 #define SR_HDL(A) ((long)(A))
431 #define IS_INT(A) ((A)->s==3)
432 #define IS_IMM(A) (SR_HDL(A) & SR_INT)
433 #define GET_NOM(A) ((A)->z)
434 #define GET_DENOM(A) ((A)->n)
435 
436  assume( getCoeffType(r) == n_R );
437  assume( aRing->rep == n_rep_gap_rat );
438 
439  mpz_ptr z;
440  mpz_ptr zz=NULL;
441  if (IS_IMM(from))
442  {
443  zz=(mpz_ptr)omAlloc(sizeof(mpz_t));
444  mpz_init_set_si(zz,SR_TO_INT(from));
445  z=zz;
446  }
447  else
448  {
449  /* read out the enumerator */
450  z=GET_NOM(from);
451  }
452 
453  int i = mpz_size1(z);
454  mpf_t e;
455  mpf_init(e);
456  mpf_set_z(e,z);
457  int sign= mpf_sgn(e);
458  mpf_abs (e, e);
459 
460  if (zz!=NULL)
461  {
462  mpz_clear(zz);
463  omFreeSize(zz,sizeof(mpz_t));
464  }
465  /* if number was an integer, we are done*/
466  if(IS_IMM(from)|| IS_INT(from))
467  {
468  if(i>4)
469  {
470  WerrorS("SI_FLOAT overflow");
471  return nf(0.0).N();
472  }
473  double basis;
474  signed long int exp;
475  basis = mpf_get_d_2exp(&exp, e);
476  SI_FLOAT f= sign*ldexp(basis,exp);
477  mpf_clear(e);
478  return nf(f).N();
479  }
480 
481  /* else read out the denominator */
482  mpz_ptr n = GET_DENOM(from);
483  int j = mpz_size1(n);
484  if(j-i>4)
485  {
486  WerrorS("SI_FLOAT overflow");
487  mpf_clear(e);
488  return nf(0.0).N();
489  }
490  mpf_t d;
491  mpf_init(d);
492  mpf_set_z(d,n);
493 
494  /* and compute the quotient */
495  mpf_t q;
496  mpf_init(q);
497  mpf_div(q,e,d);
498 
499  double basis;
500  signed long int exp;
501  basis = mpf_get_d_2exp(&exp, q);
502  SI_FLOAT f = sign*ldexp(basis,exp);
503  mpf_clear(e);
504  mpf_clear(d);
505  mpf_clear(q);
506  return nf(f).N();
507 }
508 
509 static number nrMapZ(number from, const coeffs aRing, const coeffs r)
510 {
511  assume( getCoeffType(r) == n_R );
512  assume( aRing->rep == n_rep_gap_gmp );
513 
514  mpz_ptr z;
515  mpz_ptr zz=NULL;
516  if (IS_IMM(from))
517  {
518  zz=(mpz_ptr)omAlloc(sizeof(mpz_t));
519  mpz_init_set_si(zz,SR_TO_INT(from));
520  z=zz;
521  }
522  else
523  {
524  /* read out the enumerator */
525  z=(mpz_ptr)from;
526  }
527 
528  int i = mpz_size1(z);
529  mpf_t e;
530  mpf_init(e);
531  mpf_set_z(e,z);
532  int sign= mpf_sgn(e);
533  mpf_abs (e, e);
534 
535  if (zz!=NULL)
536  {
537  mpz_clear(zz);
538  omFreeSize(zz,sizeof(mpz_t));
539  }
540  if(i>4)
541  {
542  WerrorS("float overflow");
543  return nf(0.0).N();
544  }
545  double basis;
546  signed long int exp;
547  basis = mpf_get_d_2exp(&exp, e);
548  SI_FLOAT f= sign*ldexp(basis,exp);
549  mpf_clear(e);
550  return nf(f).N();
551 }
552 
553 // old version:
554 // number nrMapQ(number from, const coeffs aRing, const coeffs r)
555 // {
556 // /* in longrat.h
557 // #define SR_INT 1
558 // #define mpz_size1(A) (ABS((A)->_mp_size))
559 // */
560 // #define SR_HDL(A) ((long)(A))
561 // #define mpz_isNeg(A) ((A)->_mp_size<0)
562 // #define mpz_limb_size(A) ((A)->_mp_size)
563 // #define mpz_limb_d(A) ((A)->_mp_d)
564 // #define MPZ_DIV(A,B,C) mpz_tdiv_q((A),(B),(C))
565 // #define IS_INT(A) ((A)->s==3)
566 // #define IS_IMM(A) (SR_HDL(A)&SR_INT)
567 // #define GET_NOM(A) ((A)->z)
568 // #define GET_DENOM(A) ((A)->n)
569 // #define MPZ_INIT mpz_init
570 // #define MPZ_CLEAR mpz_clear
571 
572 // assume( getCoeffType(r) == n_R );
573 // assume( getCoeffType(aRing) == n_Q );
574 
575 // mpz_t h;
576 // mpz_ptr g,z,n;
577 // int i,j,t,s;
578 // SI_FLOAT ba,rr,rn,y;
579 
580 // if (IS_IMM(from))
581 // return nf((SI_FLOAT)nlInt(from,NULL /* dummy for nlInt*/)).N();
582 // z=GET_NOM(from);
583 // s=0X10000;
584 // ba=(SI_FLOAT)s;
585 // ba*=ba;
586 // rr=0.0;
587 // i=mpz_size1(z);
588 // if(IS_INT(from))
589 // {
590 // if(i>4)
591 // {
592 // WerrorS("SI_FLOAT overflow");
593 // return nf(rr).N();
594 // }
595 // i--;
596 // rr=(SI_FLOAT)mpz_limb_d(z)[i];
597 // while(i>0)
598 // {
599 // i--;
600 // y=(SI_FLOAT)mpz_limb_d(z)[i];
601 // rr=rr*ba+y;
602 // }
603 // if(mpz_isNeg(z))
604 // rr=-rr;
605 // return nf(rr).N();
606 // }
607 // n=GET_DENOM(from);
608 // j=s=mpz_limb_size(n);
609 // if(j>i)
610 // {
611 // g=n; n=z; z=g;
612 // t=j; j=i; i=t;
613 // }
614 // t=i-j;
615 // if(t>4)
616 // {
617 // if(j==s)
618 // WerrorS("SI_FLOAT overflow");
619 // return nf(rr).N();
620 // }
621 // if(t>1)
622 // {
623 // g=h;
624 // MPZ_INIT(g);
625 // MPZ_DIV(g,z,n);
626 // t=mpz_size1(g);
627 // if(t>4)
628 // {
629 // MPZ_CLEAR(g);
630 // if(j==s)
631 // WerrorS("SI_FLOAT overflow");
632 // return nf(rr).N();
633 // }
634 // t--;
635 // rr=(SI_FLOAT)mpz_limb_d(g)[t];
636 // while(t)
637 // {
638 // t--;
639 // y=(SI_FLOAT)mpz_limb_d(g)[t];
640 // rr=rr*ba+y;
641 // }
642 // MPZ_CLEAR(g);
643 // if(j!=s)
644 // rr=1.0/rr;
645 // if(mpz_isNeg(z))
646 // rr=-rr;
647 // return nf(rr).N();
648 // }
649 // rn=(SI_FLOAT)mpz_limb_d(n)[j-1];
650 // rr=(SI_FLOAT)mpz_limb_d(z)[i-1];
651 // if(j>1)
652 // {
653 // rn=rn*ba+(SI_FLOAT)mpz_limb_d(n)[j-2];
654 // rr=rr*ba+(SI_FLOAT)mpz_limb_d(z)[i-2];
655 // i--;
656 // }
657 // if(t!=0)
658 // rr=rr*ba+(SI_FLOAT)mpz_limb_d(z)[i-2];
659 // if(j==s)
660 // rr=rr/rn;
661 // else
662 // rr=rn/rr;
663 // if(mpz_isNeg(z))
664 // rr=-rr;
665 // return nf(rr).N();
666 // }
667 
668 static nMapFunc nrSetMap(const coeffs src, const coeffs dst)
669 {
670  assume( getCoeffType(dst) == n_R );
671 
672  if (src->rep==n_rep_gap_rat) /*Q, Z */
673  {
674  return nrMapQ;
675  }
676  if (src->rep==n_rep_gap_gmp) /*Q, Z */
677  {
678  return nrMapZ;
679  }
680  if ((src->rep==n_rep_gmp_float) && nCoeff_is_long_R(src))
681  {
682  return nrMapLongR;
683  }
684  if ((src->rep==n_rep_float) && nCoeff_is_R(src))
685  {
686  return ndCopyMap;
687  }
688  if ((src->rep==n_rep_int) && nCoeff_is_Zp(src))
689  {
690  return nrMapP;
691  }
692  if ((src->rep==n_rep_gmp_complex) && nCoeff_is_long_C(src))
693  {
694  return nrMapC;
695  }
696  return NULL;
697 }
698 
699 static char* nrCoeffString(const coeffs r)
700 {
701  return omStrDup("Float()");
702 }
703 
704 static char* nrCoeffName(const coeffs r)
705 {
706  return (char*)"Float()";
707 }
708 
710 {
711  assume( getCoeffType(n) == n_R );
712 
713  assume( p == NULL );
714 
715  n->is_field=TRUE;
716  n->is_domain=TRUE;
717  n->rep=n_rep_float;
718 
719  //n->cfKillChar = ndKillChar; /* dummy */
720  n->ch = 0;
721  n->cfCoeffString = nrCoeffString;
722  n->cfCoeffName = nrCoeffName;
723 
724  n->cfInit = nrInit;
725  n->cfInt = nrInt;
726  n->cfAdd = nrAdd;
727  n->cfSub = nrSub;
728  n->cfMult = nrMult;
729  n->cfDiv = nrDiv;
730  n->cfExactDiv= nrDiv;
731  n->cfInpNeg = nrNeg;
732  n->cfInvers= nrInvers;
733  //n->cfCopy = ndCopy;
734  n->cfGreater = nrGreater;
735  n->cfEqual = nrEqual;
736  n->cfIsZero = nrIsZero;
737  n->cfIsOne = nrIsOne;
738  n->cfIsMOne = nrIsMOne;
739  n->cfGreaterZero = nrGreaterZero;
740  n->cfWriteLong = nrWrite;
741  n->cfRead = nrRead;
742  //n->cfPower = nrPower;
743  n->cfSetMap = nrSetMap;
744  n->cfCoeffWrite = nrCoeffWrite;
745 
746  /* nName= ndName; */
747  /*nSize = ndSize;*/
748 #ifdef LDEBUG
749  n->cfDBTest=nrDBTest; // not yet implemented: nrDBTest;
750 #endif
751 
752  //n->nCoeffIsEqual = ndCoeffIsEqual;
753 
754  n->float_len = SHORT_REAL_LENGTH;
755  n->float_len2 = SHORT_REAL_LENGTH;
756 
757  // TODO: Any variables?
758  return FALSE;
759 }
All the auxiliary stuff.
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int l
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:125
int k
Definition: cfEzgcd.cc:92
Variable x
Definition: cfModGcd.cc:4023
int p
Definition: cfModGcd.cc:4019
CanonicalForm b
Definition: cfModGcd.cc:4044
FILE * f
Definition: checklibs.c:9
gmp_complex numbers based on
Definition: mpr_complex.h:179
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
Definition: coeffs.h:913
@ n_R
single prescision (6,6) real numbers
Definition: coeffs.h:32
@ n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:34
@ n_Zp
\F{p < 2^31}
Definition: coeffs.h:30
@ n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:42
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition: coeffs.h:822
@ n_rep_gap_rat
(number), see longrat.h
Definition: coeffs.h:111
@ n_rep_gap_gmp
(), see rinteger.h, new impl.
Definition: coeffs.h:112
@ n_rep_float
(float), see shortfl.h
Definition: coeffs.h:116
@ n_rep_int
(int), see modulop.h
Definition: coeffs.h:110
@ n_rep_gmp_float
(gmp_float), see
Definition: coeffs.h:117
@ n_rep_gmp_complex
(gmp_complex), see gnumpc.h
Definition: coeffs.h:118
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
Definition: coeffs.h:858
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
Definition: coeffs.h:916
#define StringAppend
Definition: emacs.cc:79
return result
Definition: facAbsBiFact.cc:76
const CanonicalForm int s
Definition: facAbsFact.cc:55
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
int j
Definition: facHensel.cc:105
void WerrorS(const char *s)
Definition: feFopen.cc:24
STATIC_VAR Poly * h
Definition: janet.cc:971
#define SR_TO_INT(SR)
Definition: longrat.h:68
#define assume(x)
Definition: mod2.h:390
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
const int MAX_INT_VAL
Definition: mylimits.h:12
The main handler for Singular numbers which are suitable for Singular polynomials.
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:251
const char *const nDivBy0
Definition: numbers.h:88
#define SHORT_REAL_LENGTH
Definition: numbers.h:57
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12
void StringAppendS(const char *st)
Definition: reporter.cc:107
void PrintS(const char *s)
Definition: reporter.cc:284
static int sign(int x)
Definition: ring.cc:3375
static number nrSub(number a, number b, const coeffs r)
Definition: shortfl.cc:142
static void nrCoeffWrite(const coeffs r, BOOLEAN)
Definition: shortfl.cc:62
static const SI_FLOAT nrEps
Definition: shortfl.cc:38
static number nrMapQ(number from, const coeffs r, const coeffs aRing)
Definition: shortfl.cc:424
static number nrMult(number a, number b, const coeffs r)
Definition: shortfl.cc:76
SI_FLOAT nrFloat(number n)
Converts a n_R number into a float. Needed by Maps.
Definition: shortfl.cc:56
static number nrMapC(number from, const coeffs aRing, const coeffs r)
Definition: shortfl.cc:413
BOOLEAN nrInitChar(coeffs n, void *p)
Initialize r.
Definition: shortfl.cc:709
#define IS_INT(A)
#define IS_IMM(A)
static nMapFunc nrSetMap(const coeffs src, const coeffs dst)
Get a mapping function from src into the domain of this type: n_R.
Definition: shortfl.cc:668
static number nrInvers(number c, const coeffs r)
Definition: shortfl.cc:213
static number nrDiv(number a, number b, const coeffs r)
Definition: shortfl.cc:199
static number nrAdd(number a, number b, const coeffs r)
Definition: shortfl.cc:110
static number nrNeg(number c, const coeffs r)
Definition: shortfl.cc:226
static number nrMapZ(number from, const coeffs aRing, const coeffs r)
Definition: shortfl.cc:509
static BOOLEAN nrDBTest(number a, const coeffs r, const char *f, const int l)
#define GET_DENOM(A)
static BOOLEAN nrEqual(number a, number b, const coeffs r)
Definition: shortfl.cc:240
static void nrWrite(number a, const coeffs r)
Definition: shortfl.cc:248
static char * nrCoeffString(const coeffs r)
Definition: shortfl.cc:699
#define GET_NOM(A)
static BOOLEAN nrIsZero(number a, const coeffs r)
Definition: shortfl.cc:174
static number nrInit(long i, const coeffs r)
Definition: shortfl.cc:86
static number nrMapP(number from, const coeffs aRing, const coeffs r)
Definition: shortfl.cc:394
static BOOLEAN nrGreater(number a, number b, const coeffs r)
Definition: shortfl.cc:233
static BOOLEAN nrIsMOne(number a, const coeffs r)
Definition: shortfl.cc:190
static const char * nrRead(const char *s, number *a, const coeffs r)
Definition: shortfl.cc:315
static BOOLEAN nrIsOne(number a, const coeffs r)
Definition: shortfl.cc:181
static char * nrCoeffName(const coeffs r)
Definition: shortfl.cc:704
static number nrMapLongR(number from, const coeffs aRing, const coeffs r)
Definition: shortfl.cc:404
static long nrInt(number &n, const coeffs r)
Definition: shortfl.cc:97
static BOOLEAN nrGreaterZero(number k, const coeffs r)
Definition: shortfl.cc:69
#define SI_FLOAT
Definition: shortfl.h:15
#define mpz_size1(A)
Definition: si_gmp.h:12
Definition: gnumpfl.cc:27
nf(number n)
Definition: shortfl.cc:47
nf(SI_FLOAT f)
Definition: shortfl.cc:45
SI_FLOAT _f
Definition: gnumpfl.cc:28
number _n
Definition: gnumpfl.cc:29
SI_FLOAT F() const
Definition: shortfl.cc:49
number N() const
Definition: shortfl.cc:50