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