My Project
Loading...
Searching...
No Matches
mpr_complex.cc
Go to the documentation of this file.
1/****************************************
2* Computer Algebra System SINGULAR *
3****************************************/
4
5/*
6* ABSTRACT - multipolynomial resultants - real floating-point numbers using gmp
7* and complex numbers based on pairs of real floating-point numbers
8*
9*/
10
11// WARNING! ALWAYS use omAlloc and FreeL when alloc. memory for some char* !!
12
13
14#include "misc/auxiliary.h"
15
16#include "reporter/reporter.h"
17
18#include "coeffs/coeffs.h"
19#include "coeffs/numbers.h"
20
21#include "coeffs/mpr_complex.h"
22
23#include "coeffs/longrat.h"
24
25#include <cmath>
26
27
28//%s
29// this was copied form longrat0.cc
30// and will be used in numberToFloat.
31// Make sure that it is up to date!!
32#define SR_HDL(A) ((long)(A))
33#define SR_TO_INT(SR) (((long)SR) >> 2)
34
35#define SIGN_PLUS 1
36#define SIGN_SPACE 2
37#define SIGN_EMPTY 4
38
39#define EXTRABYTES 4
40
41#define DEFPREC 20 // minimum number of digits (output operations)
43
46
47
48/** Set size of mantissa
49 * digits - the number of output digits (basis 10)
50 * the size of mantissa consists of two parts:
51 * the "output" part a and the "rest" part b.
52 * According to the GMP-precision digits is
53 * recomputed to bits (basis 2).
54 * Two numbers a, b are equal if
55 * | a - b | < | a | * 0.1^digits .
56 * In this case we have a - b = 0 .
57 * The epsilon e is e=0.1^(digits+rest) with
58 * 1+e != 1, but 1+0.1*e = 1.
59 */
60void setGMPFloatDigits( size_t digits, size_t rest )
61{
62 size_t bits = 1 + (size_t) ((float)digits * 3.5);
63 size_t rb = 1 + (size_t) ((float)rest * 3.5);
64 size_t db = bits+rb;
65 gmp_output_digits= digits;
66 mpf_set_default_prec( db );
67 if (diff!=NULL) delete diff;
68 diff=new gmp_float(0.0);
69 mpf_set_prec(*diff->_mpfp(),32);
70 if (gmpRel!=NULL) delete gmpRel;
71 gmpRel=new gmp_float(0.0);
72 mpf_set_prec(*gmpRel->_mpfp(),32);
73 mpf_set_d(*gmpRel->_mpfp(),0.1);
74 mpf_pow_ui(*gmpRel->_mpfp(),*gmpRel->_mpfp(),digits);
75}
76
77#if 1
78void gmp_float::setFromStr(const char * in )
79{
80 BOOLEAN neg=false;
81 if (*in == '-') { in++; neg=TRUE; }
82 char *s;
83 if ((s=strchr((char *)in,'E')) !=NULL)
84 {
85 *s='e';
86 }
87
88 // gmp doesn't understand number which begin with "." -- it needs 0.
89 // so, insert the zero
90 if (*in == '.')
91 {
92 int len = strlen(in)+2;
93 char* c_in = (char*) omAlloc(len);
94 *c_in = '0';
95 strcpy(&(c_in[1]), in);
96
97 if(mpf_set_str( t, c_in, 10 )!=0) WerrorS("syntax error in GMP float");
98 omFreeSize((void*)c_in, len);
99 }
100 else
101 {
102 if(mpf_set_str( t, in, 10 )!=0) WerrorS("syntax error in GMP float");
103 }
104 if (neg) mpf_neg( t, t );
105}
106#else
107// problems with solve_s.tst
108void gmp_float::setFromStr(const char * in )
109{
110 BOOLEAN neg=false;
111 BOOLEAN E_found=FALSE;
112 if (*in == '-') { in++; neg=TRUE; }
113 char *s;
114 if ((s=strchr(in,'E')) !=NULL)
115 {
116 *s='e';
117 E_found=TRUE;
118 }
119 // gmp doesn't understand number like 1e1, it need 1e+1
120 // so, insert the +
121 if (E_found ||((s=strchr(in,'e')) !=NULL))
122 {
123 if ((*(s+1)!='+') && (*(s+1)!='-'))
124 {
125 int len = strlen(in)+3;
126 char* c_in = (char*) omAlloc(len);
127 if (*in == '.')
128 {
129 *c_in = '0';
130 strcpy(&(c_in[1]), in);
131 }
132 else
133 {
134 strcpy(c_in, in);
135 }
136 char * ss=strchr(c_in,'e');
137 memmove(ss+2,s+1,strlen(s+1));
138 *(ss+1)+'+';
139
140 mpf_set_str( t, c_in, 10 );
141 omFreeSize((void*)c_in, len);
142 }
143 }
144
145 // gmp doesn't understand number which begin with "." -- it needs 0.
146 // so, insert the zero
147 else if (*in == '.')
148 {
149 int len = strlen(in)+2;
150 char* c_in = (char*) omAlloc(len);
151 *c_in = '0';
152 strcpy(&(c_in[1]), in);
153
154 mpf_set_str( t, c_in, 10 );
155 omFreeSize((void*)c_in, len);
156 }
157 else
158 {
159 mpf_set_str( t, in, 10 );
160 }
161 if (neg) mpf_neg( t, t );
162}
163#endif
164
165
166// <gmp_float> = <gmp_float> operator <gmp_float>
168{
169 gmp_float tmp( a );
170 tmp += b;
171 return tmp;
172}
174{
175 gmp_float tmp( a );
176 tmp -= b;
177 return tmp;
178}
180{
181 gmp_float tmp( a );
182 tmp *= b;
183 return tmp;
184}
186{
187 gmp_float tmp( a );
188 tmp /= b;
189 return tmp;
190}
191
192// <gmp_float> operator <gmp_float>
194{
195 if (mpf_sgn(t) != -(mpf_sgn(a.t)))
196 {
197 mpf_add( t, t, a.t);
198 return *this;
199 }
200 if((mpf_sgn(a.t)==0) && (mpf_sgn(t)==0))
201 {
202 mpf_set_d( t, 0.0);
203 return *this;
204 }
205 mpf_add( t, t, a.t );
206 mpf_set(diff->t, t);
207 mpf_set_prec(diff->t, 32);
208 mpf_div(diff->t, diff->t, a.t);
209 mpf_abs(diff->t, diff->t);
210 if(mpf_cmp(diff->t, gmpRel->t) < 0)
211 mpf_set_d( t, 0.0);
212 return *this;
213}
215{
216 if (mpf_sgn(t) != mpf_sgn(a.t))
217 {
218 mpf_sub( t, t, a.t);
219 return *this;
220 }
221 if((mpf_sgn(a.t)==0) && (mpf_sgn(t)==0))
222 {
223 mpf_set_d( t, 0.0);
224 return *this;
225 }
226 mpf_sub( t, t, a.t );
227 mpf_set(diff->t, t);
228 mpf_set_prec(diff->t, 32);
229 mpf_div(diff->t, diff->t, a.t);
230 mpf_abs(diff->t, diff->t);
231 if(mpf_cmp(diff->t, gmpRel->t) < 0)
232 mpf_set_d( t, 0.0);
233 return *this;
234}
235
236// <gmp_float> == <gmp_float> ??
237bool operator == ( const gmp_float & a, const gmp_float & b )
238{
239 if(mpf_sgn(a.t) != mpf_sgn(b.t))
240 return false;
241 if((mpf_sgn(a.t)==0) && (mpf_sgn(b.t)==0))
242 return true;
243 mpf_sub(diff->t, a.t, b.t);
244 mpf_div(diff->t, diff->t, a.t);
245 mpf_abs(diff->t, diff->t);
246 if(mpf_cmp(diff->t, gmpRel->t) < 0)
247 return true;
248 else
249 return false;
250}
251// t == 0 ?
253{
254 return (mpf_sgn( t ) == 0);
255}
256// t == 1 ?
258{
259#ifdef VARIANTE_1
260 return (mpf_cmp_ui( t , 1 ) == 0);
261#else
262 if (mpf_sgn(t) <= 0)
263 return false;
264 mpf_sub_ui(diff->t, t, 1);
265 mpf_abs(diff->t, diff->t);
266 if(mpf_cmp(diff->t, gmpRel->t) < 0)
267 return true;
268 else
269 return false;
270#endif
271}
272// t == -1 ?
274{
275#ifdef VARIANTE_1
276 return (mpf_cmp_si( t , -1 ) == 0);
277#else
278 if (mpf_sgn(t) >= 0)
279 return false;
280 mpf_add_ui(diff->t, t, 1);
281 mpf_abs(diff->t, diff->t);
282 if(mpf_cmp(diff->t, gmpRel->t) < 0)
283 return true;
284 else
285 return false;
286#endif
287}
288bool operator > ( const gmp_float & a, const gmp_float & b )
289{
290 return mpf_cmp( a.t, b.t ) > 0;
291}
292bool operator < ( const gmp_float & a, const gmp_float & b )
293{
294 return mpf_cmp( a.t, b.t ) < 0;
295}
296bool operator >= ( const gmp_float & a, const gmp_float & b )
297{
298 return mpf_cmp( a.t, b.t ) >= 0;
299}
300bool operator <= ( const gmp_float & a, const gmp_float & b )
301{
302 return mpf_cmp( a.t, b.t ) <= 0;
303}
304
305// unary -
307{
308 gmp_float tmp;
309 mpf_neg( *(tmp._mpfp()), *(a.mpfp()) );
310 return tmp;
311}
312
314{
315 gmp_float tmp;
316 mpf_abs( *(tmp._mpfp()), *a.mpfp() );
317 return tmp;
318}
320{
321 gmp_float tmp;
322 mpf_sqrt( *(tmp._mpfp()), *a.mpfp() );
323 return tmp;
324}
326{
327 gmp_float tmp( sin((double)a) );
328 return tmp;
329}
331{
332 gmp_float tmp( cos((double)a) );
333 return tmp;
334}
336{
337 gmp_float tmp( log((double)a) );
338 return tmp;
339}
340gmp_float hypot( const gmp_float & a, const gmp_float & b )
341{
342#if 1
343 return ( sqrt( (a*a) + (b*b) ) );
344#else
345 gmp_float tmp( hypot( (double)a, (double)b ) );
346 return tmp;
347#endif
348}
350{
351 gmp_float tmp( exp((double)a) );
352 return tmp;
353}
354gmp_float max( const gmp_float & a, const gmp_float & b )
355{
356 gmp_float tmp;
357 a > b ? tmp= a : tmp= b;
358 return tmp;
359}
360//
361// number to float, number = Q, R, C
362// makes a COPY of num! (Ist das gut?)
363//
365{
366 gmp_float r;
367
368 if ( nCoeff_is_Q(src) )
369 {
370 if ( num != NULL )
371 {
372 if (SR_HDL(num) & SR_INT)
373 {
374 //n_Print(num, src);printf("\n");
375 int nn = SR_TO_INT(num);
376 if((long)nn == SR_TO_INT(num))
377 r = SR_TO_INT(num);
378 else
379 r = gmp_float(SR_TO_INT(num));
380 //int dd = 20;
381 //gmp_printf("\nr = %.*Ff\n",dd,*r.mpfp());
382 //getchar();
383 }
384 else
385 {
386 if ( num->s == 0 )
387 {
388 nlNormalize( num, src ); // FIXME? TODO? // extern void nlNormalize(number &x, const coeffs r); // FIXME
389 }
390 if (SR_HDL(num) & SR_INT)
391 {
392 r= SR_TO_INT(num);
393 }
394 else
395 {
396 if ( num->s != 3 )
397 {
398 r= num->z;
399 r/= (gmp_float)num->n;
400 }
401 else
402 {
403 r= num->z;
404 }
405 }
406 }
407 }
408 else
409 {
410 r= 0.0;
411 }
412 }
413 else if (nCoeff_is_long_R(src) || nCoeff_is_long_C(src))
414 {
415 r= *(gmp_float*)num;
416 }
417 else if ( nCoeff_is_R(src) )
418 {
419 // Add some code here :-)
420 WerrorS("Ground field not implemented!");
421 }
422 else
423 {
424 WerrorS("Ground field not implemented!");
425 }
426
427 return r;
428}
429
431{
432 gmp_float r;
433
434 switch (cf)
435 {
436 case QTOF:
437 if ( num != NULL )
438 {
439 if (SR_HDL(num) & SR_INT)
440 {
441 r = gmp_float(SR_TO_INT(num));
442 }
443 else
444 {
445 if ( num->s != 3 )
446 {
447 r= gmp_float(num->z);
448 r/= gmp_float(num->n);
449 }
450 else
451 {
452 r= num->z;
453 }
454 }
455 }
456 else
457 {
458 r= 0.0;
459 }
460 break;
461 case RTOF:
462 r= *(gmp_float*)num;
463 break;
464 case CTOF:
465 WerrorS("Can not map from field C to field R!");
466 break;
467 case ZTOF:
468 default:
469 WerrorS("Ground field not implemented!");
470 } // switch
471
472 return r;
473}
474
475// Do some strange things with the mantissa string and the exponent
476// to get some nice output string.
477char *nicifyFloatStr( char * in, mp_exp_t exponent, size_t oprec, int *size, int thesign )
478{
479 char *out;
480
481 int sign= (in[0] == '-') ? 1 : 0;
482 char csign[2];
483
484 switch (thesign)
485 {
486 case SIGN_PLUS:
487 sign ? strcpy(csign,"-") : strcpy(csign,"+"); //+123, -123
488 break;
489 case SIGN_SPACE:
490 sign ? strcpy(csign,"-") : strcpy(csign," "); // 123, -123
491 break;
492 case SIGN_EMPTY:
493 default:
494 sign ? strcpy(csign,"-") : strcpy(csign,""); //123, -123
495 break;
496 }
497
498 if ( strlen(in) == 0 )
499 {
500 *size= 2*sizeof(char);
501 return omStrDup("0");
502 }
503
504 if ( ((unsigned int)ABS(exponent) <= oprec)
505 /*|| (exponent+sign >= (int)strlen(in))*/ )
506 {
507 if ( exponent+sign < (int)strlen(in) )
508 {
509 int eexponent= (exponent >= 0) ? 0 : -exponent;
510 int eeexponent= (exponent >= 0) ? exponent : 0;
511 *size= (strlen(in)+15+eexponent) * sizeof(char);
512 out= (char*)omAlloc(*size);
513 memset(out,0,*size);
514
515 strcpy(out,csign);
516 strncat(out,in+sign,eeexponent);
517
518 if (exponent == 0)
519 strcat(out,"0.");
520 else if ( exponent > 0 )
521 strcat(out,".");
522 else
523 {
524 strcat(out,"0.");
525 memset(out+strlen(out),'0',eexponent);
526 }
527 strcat(out,in+sign+eeexponent);
528 }
529 else if ( exponent+sign > (int)strlen(in) )
530 {
531 *size= (strlen(in)+exponent+12)*sizeof(char);
532 out= (char*)omAlloc0(*size);
533 snprintf(out,*size,"%s%s",csign,in+sign);
534 memset(out+strlen(out),'0',exponent-strlen(in)+sign);
535 }
536 else
537 {
538 *size= (strlen(in)+2) * sizeof(char) + 10;
539 out= (char*)omAlloc0(*size);
540 snprintf(out,*size,"%s%s",csign,in+sign);
541 }
542 }
543 else
544 {
545// if ( exponent > 0 )
546// {
547 int c=1,d=10;
548 while ( exponent / d > 0 )
549 { // count digits
550 d*=10;
551 c++;
552 }
553 *size= (strlen(in)+12+c) * sizeof(char) + 10;
554 out= (char*)omAlloc0(*size);
555 snprintf(out,*size,"%s0.%se%s%d",csign,in+sign,exponent>=0?"+":"",(int)exponent);
556// }
557// else
558// {
559// *size=2;
560// out= (char*)omAlloc(*size);
561// strcpy(out,"0");
562// }
563 }
564 return out;
565}
566
567char *floatToStr( const gmp_float & r, const unsigned int oprec )
568{
569#if 1
570 mp_exp_t exponent;
571 int size,insize;
572 char *nout,*out,*in;
573
574 insize= (oprec+2) * sizeof(char) + 10;
575 in= (char*)omAlloc( insize );
576
577 mpf_get_str(in,&exponent,10,oprec,*(r.mpfp()));
578
579 //if ( (exponent > 0)
580 //&& (exponent < (int)oprec)
581 //&& (strlen(in)-(in[0]=='-'?1:0) == oprec) )
582 //{
583 // omFree( (void *) in );
584 // insize= (exponent+oprec+2) * sizeof(char) + 10;
585 // in= (char*)omAlloc( insize );
586 // int newprec= exponent+oprec;
587 // mpf_get_str(in,&exponent,10,newprec,*(r.mpfp()));
588 //}
589 nout= nicifyFloatStr( in, exponent, oprec, &size, SIGN_EMPTY );
590 omFree( (void *) in );
591 out= (char*)omAlloc( (strlen(nout)+1) * sizeof(char) );
592 strcpy( out, nout );
593 omFree( (void *) nout );
594
595 return out;
596#else
597 // for testing purpose...
598 char *out= (char*)omAlloc(1024);
599 snprintf(out,1024,"% .10f",(double)r);
600 return out;
601#endif
602}
603//<-
604
605//-> gmp_complex::*
606// <gmp_complex> = <gmp_complex> operator <gmp_complex>
607//
609{
610 return gmp_complex( a.r + b.r, a.i + b.i );
611}
613{
614 return gmp_complex( a.r - b.r, a.i - b.i );
615}
617{
618 return gmp_complex( a.r * b.r - a.i * b.i,
619 a.r * b.i + a.i * b.r);
620}
622{
623 gmp_float d = b.r*b.r + b.i*b.i;
624 return gmp_complex( (a.r * b.r + a.i * b.i) / d,
625 (a.i * b.r - a.r * b.i) / d);
626}
627
628// <gmp_complex> operator <gmp_complex>
629//
631{
632 r+=b.r;
633 i+=b.i;
634 return *this;
635}
637{
638 r-=b.r;
639 i-=b.i;
640 return *this;
641}
643{
644 gmp_float f = r * b.r - i * b.i;
645 i = r * b.i + i * b.r;
646 r = f;
647 return *this;
648}
650{
651 i.neg();
652 r.neg();
653 return *this;
654}
656{
657 gmp_float d = b.r*b.r + b.i*b.i;
658 r = (r * b.r + i * b.i) / d;
659 i = (i * b.r - r * b.i) / d;
660 return *this;
661}
662
663// Returns square root of gmp_complex number
664//
666{
667 gmp_float r = abs(x);
668 gmp_float nr, ni;
669 if (r == (gmp_float) 0.0)
670 {
671 nr = ni = r;
672 }
673 else if ( x.real() > (gmp_float)0)
674 {
675 nr = sqrt((gmp_float)0.5 * (r + x.real()));
676 ni = x.imag() / nr / (gmp_float)2;
677 }
678 else
679 {
680 ni = sqrt((gmp_float)0.5 * (r - x.real()));
681 if (x.imag() < (gmp_float)0)
682 {
683 ni = - ni;
684 }
685 nr = x.imag() / ni / (gmp_float)2;
686 }
687 gmp_complex tmp(nr, ni);
688 return tmp;
689}
690
691// converts a gmp_complex to a string ( <real part> + I * <imaginary part> )
692//
693char *complexToStr( gmp_complex & c, const unsigned int oprec, const coeffs src )
694{
695 const char * complex_parameter = "I";
696 int N = 1; // strlen(complex_parameter);
697
698 if (nCoeff_is_long_C(src))
699 {
700 complex_parameter = n_ParameterNames(src)[0];
701 N = strlen(complex_parameter);
702 }
703
704 assume( complex_parameter != NULL && N > 0);
705
706 char *out,*in_imag,*in_real;
707
708 c.SmallToZero();
709 if ( !c.imag().isZero() )
710 {
711
712 in_real=floatToStr( c.real(), oprec ); // get real part
713 in_imag=floatToStr( abs(c.imag()), oprec ); // get imaginary part
714
715 if (nCoeff_is_long_C(src))
716 {
717 int len=(strlen(in_real)+strlen(in_imag)+7+N)*sizeof(char);
718 out=(char*)omAlloc(len);
719 memset(out,0,len);
720 if ( !c.real().isZero() ) // (-23-i*5.43) or (15.1+i*5.3)
721 snprintf(out,len,"(%s%s%s*%s)",in_real,c.imag().sign()>=0?"+":"-",complex_parameter,in_imag);
722 else // (-i*43) or (i*34)
723 {
724 if (c.imag().isOne())
725 snprintf(out,len,"%s", complex_parameter);
726 else if (c.imag().isMOne())
727 snprintf(out,len,"-%s", complex_parameter);
728 else
729 snprintf(out,len,"(%s%s*%s)",c.imag().sign()>=0?"":"-", complex_parameter,in_imag);
730 }
731 }
732 else
733 {
734 int len=(strlen(in_real)+strlen(in_imag)+9) * sizeof(char);
735 out=(char*)omAlloc( len );
736 memset(out,0,len);
737 if ( !c.real().isZero() )
738 snprintf(out,len,"(%s%s%s)",in_real,c.imag().sign()>=0?"+I*":"-I*",in_imag);
739 else
740 snprintf(out,len,"(%s%s)",c.imag().sign()>=0?"I*":"-I*",in_imag);
741 }
742 omFree( (void *) in_real );
743 omFree( (void *) in_imag );
744 }
745 else
746 {
747 out= floatToStr( c.real(), oprec );
748 }
749
750 return out;
751}
752//<-
753
754bool complexNearZero( gmp_complex * c, int digits )
755{
756 gmp_float eps,epsm;
757
758 if ( digits < 1 ) return true;
759
760 eps=pow(10.0,(int)digits);
761 //Print("eps: %s\n",floatToStr(eps,gmp_output_digits));
762 eps=(gmp_float)1.0/eps;
763 epsm=-eps;
764
765 //Print("eps: %s\n",floatToStr(eps,gmp_output_digits));
766
767 if ( c->real().sign() > 0 ) // +
768 return (c->real() < eps && (c->imag() < eps && c->imag() > epsm));
769 else // -
770 return (c->real() > epsm && (c->imag() < eps && c->imag() > epsm));
771}
772
774{
775 gmp_float ar=this->real();
776 gmp_float ai=this->imag();
777 if (ar.isZero() || ai.isZero()) return;
778 mpf_abs(*ar._mpfp(), *ar._mpfp());
779 mpf_abs(*ai._mpfp(), *ai._mpfp());
780 mpf_set_prec(*ar._mpfp(), 32);
781 mpf_set_prec(*ai._mpfp(), 32);
782 if (ar > ai)
783 {
784 mpf_div(*ai._mpfp(), *ai._mpfp(), *ar._mpfp());
785 if (ai < *gmpRel) this->imag(0.0);
786 }
787 else
788 {
789 mpf_div(*ar._mpfp(), *ar._mpfp(), *ai._mpfp());
790 if (ar < *gmpRel) this->real(0.0);
791 }
792}
793
794//%e
795
796// local Variables: ***
797// folded-file: t ***
798// compile-command-1: "make installg" ***
799// compile-command-2: "make install" ***
800// End: ***
Rational pow(const Rational &a, int e)
Definition GMPrat.cc:411
All the auxiliary stuff.
static int ABS(int v)
Definition auxiliary.h:113
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600
CanonicalForm num(const CanonicalForm &f)
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
Variable x
Definition cfModGcd.cc:4090
CanonicalForm cf
Definition cfModGcd.cc:4091
CanonicalForm b
Definition cfModGcd.cc:4111
FILE * f
Definition checklibs.c:9
gmp_complex numbers based on
gmp_float i
gmp_float imag() const
gmp_complex(const gmp_float re=0.0, const gmp_float im=0.0)
gmp_complex & operator*=(const gmp_complex &a)
gmp_complex & operator/=(const gmp_complex &a)
void SmallToZero()
gmp_complex & neg()
gmp_complex & operator+=(const gmp_complex &a)
gmp_float r
gmp_float real() const
gmp_complex & operator-=(const gmp_complex &a)
void setFromStr(const char *in)
gmp_float(const int v=0)
Definition mpr_complex.h:34
bool isOne() const
bool isMOne() const
gmp_float & operator-=(const gmp_float &a)
mpf_t * _mpfp()
gmp_float & operator+=(const gmp_float &a)
gmp_float & neg()
bool isZero() const
const mpf_t * mpfp() const
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
Definition coeffs.h:889
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition coeffs.h:770
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition coeffs.h:804
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
Definition coeffs.h:834
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
Definition coeffs.h:892
const CanonicalForm int s
Definition facAbsFact.cc:51
void WerrorS(const char *s)
Definition feFopen.cc:24
#define STATIC_VAR
Definition globaldefs.h:7
#define VAR
Definition globaldefs.h:5
#define exponent
void nlNormalize(number &x, const coeffs r)
Definition longrat.cc:1482
#define SR_INT
Definition longrat.h:67
#define assume(x)
Definition mod2.h:389
EXTERN_VAR size_t gmp_output_digits
Definition mpr_base.h:115
gmp_float sin(const gmp_float &a)
gmp_float operator*(const gmp_float &a, const gmp_float &b)
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
bool operator<(const gmp_float &a, const gmp_float &b)
bool operator<=(const gmp_float &a, const gmp_float &b)
gmp_float abs(const gmp_float &a)
gmp_float max(const gmp_float &a, const gmp_float &b)
#define SIGN_EMPTY
char * nicifyFloatStr(char *in, mp_exp_t exponent, size_t oprec, int *size, int thesign)
char * floatToStr(const gmp_float &r, const unsigned int oprec)
bool complexNearZero(gmp_complex *c, int digits)
gmp_float sqrt(const gmp_float &a)
#define SIGN_SPACE
#define SIGN_PLUS
#define DEFPREC
gmp_float exp(const gmp_float &a)
gmp_float operator-(const gmp_float &a, const gmp_float &b)
gmp_float operator+(const gmp_float &a, const gmp_float &b)
gmp_float cos(const gmp_float &a)
bool operator==(const gmp_float &a, const gmp_float &b)
gmp_float numberToFloat(number num, const coeffs src)
#define SR_HDL(A)
gmp_float hypot(const gmp_float &a, const gmp_float &b)
gmp_float numberFieldToFloat(number num, int cf)
gmp_float log(const gmp_float &a)
STATIC_VAR gmp_float * gmpRel
#define SR_TO_INT(SR)
gmp_float operator/(const gmp_float &a, const gmp_float &b)
STATIC_VAR gmp_float * diff
bool operator>=(const gmp_float &a, const gmp_float &b)
bool operator>(const gmp_float &a, const gmp_float &b)
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
#define RTOF
Definition mpr_complex.h:20
#define QTOF
Definition mpr_complex.h:19
#define ZTOF
Definition mpr_complex.h:18
#define CTOF
Definition mpr_complex.h:21
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omStrDup(s)
#define omFreeSize(addr, size)
#define omAlloc(size)
#define omFree(addr)
#define omAlloc0(size)
#define NULL
Definition omList.c:12
static int sign(int x)
Definition ring.cc:3504