Data Structures | Functions
gnumpfl.cc File Reference
#include "misc/auxiliary.h"
#include "reporter/reporter.h"
#include "coeffs/coeffs.h"
#include "coeffs/numbers.h"
#include "coeffs/mpr_complex.h"
#include "coeffs/longrat.h"
#include "coeffs/shortfl.h"
#include "coeffs/gnumpfl.h"
#include "coeffs/gnumpc.h"
#include "coeffs/modulop.h"

Go to the source code of this file.

Data Structures

union  nf
 

Functions

const char * ngfRead (const char *s, number *a, const coeffs r)
 
static number ngfInit (long i, const coeffs r)
 
static long ngfInt (number &i, const coeffs r)
 
static BOOLEAN ngfIsZero (number a, const coeffs r)
 
static int ngfSize (number n, const coeffs r)
 
static void ngfDelete (number *a, const coeffs r)
 
static number ngfCopy (number a, const coeffs r)
 
static number ngfNeg (number a, const coeffs r)
 
static number ngfInvers (number a, const coeffs r)
 
static number ngfAdd (number a, number b, const coeffs R)
 
static number ngfSub (number a, number b, const coeffs R)
 
static number ngfMult (number a, number b, const coeffs R)
 
static number ngfDiv (number a, number b, const coeffs r)
 
static number ngfPower (number x, int exp, const coeffs r)
 
static void ngfPower (number x, int exp, number *u, const coeffs r)
 
static BOOLEAN ngfGreaterZero (number a, const coeffs r)
 
static BOOLEAN ngfGreater (number a, number b, const coeffs r)
 
static BOOLEAN ngfEqual (number a, number b, const coeffs r)
 
static BOOLEAN ngfIsOne (number a, const coeffs r)
 
static BOOLEAN ngfIsMOne (number a, const coeffs r)
 
static char * ngfEatFloatNExp (char *s)
 
static void ngfWrite (number a, const coeffs r)
 
static BOOLEAN ngfCoeffIsEqual (const coeffs r, n_coeffType n, void *parameter)
 
static void ngfSetChar (const coeffs r)
 
static char * ngfCoeffString (const coeffs r)
 
static char * ngfCoeffName (const coeffs r)
 
static number ngfMapQ (number from, const coeffs src, const coeffs dst)
 
static number ngfMapZ (number from, const coeffs aRing, const coeffs r)
 
static number ngfMapR (number from, const coeffs src, const coeffs dst)
 
static number ngfMapP (number from, const coeffs src, const coeffs dst)
 
static number ngfMapC (number from, const coeffs src, const coeffs dst)
 
static nMapFunc ngfSetMap (const coeffs src, const coeffs dst)
 
static void ngfCoeffWrite (const coeffs r, BOOLEAN)
 
BOOLEAN ngfInitChar (coeffs n, void *parameter)
 Initialize r. More...
 

Function Documentation

◆ ngfAdd()

static number ngfAdd ( number  a,
number  b,
const coeffs  R 
)
static

Definition at line 152 of file gnumpfl.cc.

153 {
154  assume( getCoeffType(R) == n_long_R );
155 
156  gmp_float* r= new gmp_float( (*(gmp_float*)a) + (*(gmp_float*)b) );
157  return (number)r;
158 }
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm b
Definition: cfModGcd.cc:4044
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfCoeffIsEqual()

static BOOLEAN ngfCoeffIsEqual ( const coeffs  r,
n_coeffType  n,
void *  parameter 
)
static

Definition at line 384 of file gnumpfl.cc.

385 {
386  if (n==n_long_R)
387  {
388  LongComplexInfo* p = (LongComplexInfo *)(parameter);
389  if ((p!=NULL)
390  && (p->float_len == r->float_len)
391  && (p->float_len2 == r->float_len2))
392  return TRUE;
393  }
394  return FALSE;
395 }
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
real floating point (GMP) numbers
Definition: coeffs.h:34
short float_len2
additional char-flags, rInit
Definition: coeffs.h:102
short float_len
additional char-flags, rInit
Definition: coeffs.h:101
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ ngfCoeffName()

static char* ngfCoeffName ( const coeffs  r)
static

Definition at line 409 of file gnumpfl.cc.

410 {
411  STATIC_VAR char ngfCoeffName_buf[30];
412  snprintf(ngfCoeffName_buf,30,"Float(%d,%d)",r->float_len,r->float_len2);
413  return ngfCoeffName_buf;
414 }
#define STATIC_VAR
Definition: globaldefs.h:7

◆ ngfCoeffString()

static char* ngfCoeffString ( const coeffs  r)
static

Definition at line 402 of file gnumpfl.cc.

403 {
404  char *s=(char*)omAlloc(30);
405  snprintf(s,30,"Float(%d,%d)",r->float_len,r->float_len2);
406  return s;
407 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ ngfCoeffWrite()

static void ngfCoeffWrite ( const coeffs  r,
BOOLEAN   
)
static

Definition at line 502 of file gnumpfl.cc.

503 {
504  Print("Float(%d,%d)", r->float_len,r->float_len2); /* long R */
505 }
#define Print
Definition: emacs.cc:80

◆ ngfCopy()

static number ngfCopy ( number  a,
const coeffs  r 
)
static

Definition at line 96 of file gnumpfl.cc.

97 {
98  assume( getCoeffType(r) == n_long_R );
99 
100  gmp_float* b= new gmp_float( *(gmp_float*)a );
101  return (number)b;
102 }
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm b
Definition: cfModGcd.cc:4044
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfDelete()

static void ngfDelete ( number *  a,
const coeffs  r 
)
static

Definition at line 82 of file gnumpfl.cc.

83 {
84  assume( getCoeffType(r) == n_long_R );
85 
86  if ( *a != NULL )
87  {
88  delete *(gmp_float**)a;
89  *a=NULL;
90  }
91 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define NULL
Definition: omList.c:12

◆ ngfDiv()

static number ngfDiv ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 185 of file gnumpfl.cc.

186 {
187  assume( getCoeffType(r) == n_long_R );
188 
189  if ( ((gmp_float*)b)->isZero() )
190  {
191  // a/0 = error
192  WerrorS(nDivBy0);
193  return NULL;
194  }
195  gmp_float* f= new gmp_float( (*(gmp_float*)a) / (*(gmp_float*)b) );
196  return (number)f;
197 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm b
Definition: cfModGcd.cc:4044
#define assume(x)
Definition: mod2.h:390
const char *const nDivBy0
Definition: numbers.h:88
FILE * f
Definition: checklibs.c:9
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define NULL
Definition: omList.c:12
bool isZero(const CFArray &A)
checks if entries of A are zero

◆ ngfEatFloatNExp()

static char* ngfEatFloatNExp ( char *  s)
static

Definition at line 278 of file gnumpfl.cc.

279 {
280  char *start= s;
281 
282  // eat floats (mantissa) like:
283  // 0.394394993, 102.203003008, .300303032, pssibly starting with -
284  if (*s == '-') s++;
285  while ((*s >= '0' && *s <= '9')||(*s == '.')) s++;
286 
287  // eat the exponent, starts with 'e' followed by '+', '-'
288  // and digits, like:
289  // e-202, e+393, accept also E7
290  if ( (s != start) && ((*s == 'e')||(*s=='E')))
291  {
292  if (*s=='E') *s='e';
293  s++; // skip 'e'/'E'
294  if ((*s == '+') || (*s == '-')) s++;
295  while ((*s >= '0' && *s <= '9')) s++;
296  }
297 
298  return s;
299 }
const CanonicalForm int s
Definition: facAbsFact.cc:55

◆ ngfEqual()

static BOOLEAN ngfEqual ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 251 of file gnumpfl.cc.

252 {
253  assume( getCoeffType(r) == n_long_R );
254 
255  return ( (*(gmp_float*)a) == (*(gmp_float*)b) );
256 }
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm b
Definition: cfModGcd.cc:4044
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfGreater()

static BOOLEAN ngfGreater ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 241 of file gnumpfl.cc.

242 {
243  assume( getCoeffType(r) == n_long_R );
244 
245  return ( (*(gmp_float*)a) > (*(gmp_float*)b) );
246 }
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm b
Definition: cfModGcd.cc:4044
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfGreaterZero()

static BOOLEAN ngfGreaterZero ( number  a,
const coeffs  r 
)
static

Definition at line 231 of file gnumpfl.cc.

232 {
233  assume( getCoeffType(r) == n_long_R );
234 
235  return (((gmp_float*)a)->sign() > 0);
236 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static int sign(int x)
Definition: ring.cc:3375

◆ ngfInit()

static number ngfInit ( long  i,
const coeffs  r 
)
static

Definition at line 39 of file gnumpfl.cc.

40 {
41  assume( getCoeffType(r) == n_long_R );
42 
43  gmp_float* n= new gmp_float( (double)i );
44  return (number)n;
45 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfInitChar()

BOOLEAN ngfInitChar ( coeffs  n,
void *  parameter 
)

Initialize r.

Definition at line 507 of file gnumpfl.cc.

508 {
509  assume( getCoeffType(n) == n_long_R );
510 
511  n->is_field=TRUE;
512  n->is_domain=TRUE;
513  n->rep=n_rep_gmp_float;
514 
515  //n->cfKillChar = ndKillChar; /* dummy */
516 
517  n->cfSetChar = ngfSetChar;
518  n->ch = 0;
519  n->cfCoeffString=ngfCoeffString;
520  n->cfCoeffName=ngfCoeffName;
521 
522  n->cfDelete = ngfDelete;
523  //n->cfNormalize=ndNormalize;
524  n->cfInit = ngfInit;
525  n->cfInt = ngfInt;
526  n->cfAdd = ngfAdd;
527  n->cfSub = ngfSub;
528  n->cfMult = ngfMult;
529  n->cfDiv = ngfDiv;
530  n->cfExactDiv= ngfDiv;
531  n->cfInpNeg = ngfNeg;
532  n->cfInvers = ngfInvers;
533  n->cfCopy = ngfCopy;
534  n->cfGreater = ngfGreater;
535  n->cfEqual = ngfEqual;
536  n->cfIsZero = ngfIsZero;
537  n->cfIsOne = ngfIsOne;
538  n->cfIsMOne = ngfIsMOne;
539  n->cfGreaterZero = ngfGreaterZero;
540  n->cfWriteLong = ngfWrite;
541  n->cfRead = ngfRead;
542  n->cfPower = ngfPower;
543  n->cfSetMap = ngfSetMap;
544  n->cfCoeffWrite = ngfCoeffWrite;
545 #ifdef LDEBUG
546  //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
547 #endif
548 
549  n->nCoeffIsEqual = ngfCoeffIsEqual;
550 
551  if( parameter != NULL)
552  {
553  LongComplexInfo* p = (LongComplexInfo*)parameter;
554 
555  n->float_len = p->float_len;
556  n->float_len2 = p->float_len2;
557  } else // default values, just for testing!
558  {
559  n->float_len = SHORT_REAL_LENGTH;
560  n->float_len2 = SHORT_REAL_LENGTH;
561  }
562 
563  assume( n->float_len2 >= SHORT_REAL_LENGTH );
564 
565  assume( n_NumberOfParameters(n) == 0 );
566  assume( n_ParameterNames(n) == NULL );
567 
568  return FALSE;
569 }
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:251
static char * ngfCoeffString(const coeffs r)
Definition: gnumpfl.cc:402
static void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:397
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:800
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:384
static number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:133
#define SHORT_REAL_LENGTH
Definition: numbers.h:57
#define FALSE
Definition: auxiliary.h:96
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:202
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:61
static long ngfInt(number &i, const coeffs r)
Definition: gnumpfl.cc:50
#define TRUE
Definition: auxiliary.h:100
static number ngfNeg(number a, const coeffs r)
Definition: gnumpfl.cc:122
static void ngfCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpfl.cc:502
static BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:241
real floating point (GMP) numbers
Definition: coeffs.h:34
short float_len2
additional char-flags, rInit
Definition: coeffs.h:102
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:796
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:39
short float_len
additional char-flags, rInit
Definition: coeffs.h:101
#define assume(x)
Definition: mod2.h:390
const char * ngfRead(const char *s, number *a, const coeffs r)
Definition: gnumpfl.cc:307
static void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:366
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:185
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:271
static BOOLEAN ngfGreaterZero(number a, const coeffs r)
Definition: gnumpfl.cc:231
#define NULL
Definition: omList.c:12
static number ngfMult(number a, number b, const coeffs R)
Definition: gnumpfl.cc:174
static number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:96
(gmp_float), see
Definition: coeffs.h:117
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:409
static void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:82
int p
Definition: cfModGcd.cc:4019
static number ngfAdd(number a, number b, const coeffs R)
Definition: gnumpfl.cc:152
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:261
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:163
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:471

◆ ngfInt()

static long ngfInt ( number &  i,
const coeffs  r 
)
static

Definition at line 50 of file gnumpfl.cc.

51 {
52  assume( getCoeffType(r) == n_long_R );
53 
54  double d=(double)*(gmp_float*)i;
55  if (d<0.0)
56  return (long)(d-0.5);
57  else
58  return (long)(d+0.5);
59 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
int i
Definition: cfEzgcd.cc:125
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfInvers()

static number ngfInvers ( number  a,
const coeffs  r 
)
static

Definition at line 133 of file gnumpfl.cc.

134 {
135  assume( getCoeffType(r) == n_long_R );
136 
137  gmp_float* f= NULL;
138  if (((gmp_float*)a)->isZero() )
139  {
140  WerrorS(nDivBy0);
141  }
142  else
143  {
144  f= new gmp_float( gmp_float(1) / (*(gmp_float*)a) );
145  }
146  return (number)f;
147 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
const char *const nDivBy0
Definition: numbers.h:88
FILE * f
Definition: checklibs.c:9
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define NULL
Definition: omList.c:12
bool isZero(const CFArray &A)
checks if entries of A are zero

◆ ngfIsMOne()

static BOOLEAN ngfIsMOne ( number  a,
const coeffs  r 
)
static

Definition at line 271 of file gnumpfl.cc.

272 {
273  assume( getCoeffType(r) == n_long_R );
274 
275  return ((gmp_float*)a)->isMOne();
276 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfIsOne()

static BOOLEAN ngfIsOne ( number  a,
const coeffs  r 
)
static

Definition at line 261 of file gnumpfl.cc.

262 {
263  assume( getCoeffType(r) == n_long_R );
264 
265  return ((gmp_float*)a)->isOne();
266 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfIsZero()

static BOOLEAN ngfIsZero ( number  a,
const coeffs  r 
)
static

Definition at line 61 of file gnumpfl.cc.

62 {
63  assume( getCoeffType(r) == n_long_R );
64 
65  return ( ((gmp_float*)a)->isZero() );
66 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
bool isZero(const CFArray &A)
checks if entries of A are zero

◆ ngfMapC()

static number ngfMapC ( number  from,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 462 of file gnumpfl.cc.

463 {
464  assume( getCoeffType(dst) == n_long_R );
465  assume( getCoeffType(src) == n_long_C );
466 
467  gmp_float *res=new gmp_float(((gmp_complex*)from)->real());
468  return (number)res;
469 }
gmp_complex numbers based on
Definition: mpr_complex.h:178
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm res
Definition: facAbsFact.cc:64
#define assume(x)
Definition: mod2.h:390
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

◆ ngfMapP()

static number ngfMapP ( number  from,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 454 of file gnumpfl.cc.

455 {
456  assume( getCoeffType(dst) == n_long_R );
457  assume( getCoeffType(src) == n_Zp );
458 
459  return ngfInit(npInt(from,src), dst); // FIXME? TODO? // extern int npInt (number &n, const coeffs r);
460 }
long npInt(number &n, const coeffs r)
Definition: modulop.cc:127
{p < 2^31}
Definition: coeffs.h:30
real floating point (GMP) numbers
Definition: coeffs.h:34
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:39
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfMapQ()

static number ngfMapQ ( number  from,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 416 of file gnumpfl.cc.

417 {
418  assume( getCoeffType(dst) == n_long_R );
419  assume( src->rep == n_rep_gap_rat );
420 
422  return (number)res;
423 }
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm res
Definition: facAbsFact.cc:64
#define assume(x)
Definition: mod2.h:390
#define QTOF
Definition: mpr_complex.h:19
gmp_float numberFieldToFloat(number num, int cf)
Definition: mpr_complex.cc:438
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
(number), see longrat.h
Definition: coeffs.h:111

◆ ngfMapR()

static number ngfMapR ( number  from,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 445 of file gnumpfl.cc.

446 {
447  assume( getCoeffType(dst) == n_long_R );
448  assume( getCoeffType(src) == n_R );
449 
450  gmp_float *res=new gmp_float((double)nf(from).F());
451  return (number)res;
452 }
real floating point (GMP) numbers
Definition: coeffs.h:34
Definition: gnumpfl.cc:26
single prescision (6,6) real numbers
Definition: coeffs.h:32
CanonicalForm res
Definition: facAbsFact.cc:64
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfMapZ()

static number ngfMapZ ( number  from,
const coeffs  aRing,
const coeffs  r 
)
static

Definition at line 424 of file gnumpfl.cc.

425 {
426  assume( getCoeffType(r) == n_long_R );
427  assume( aRing->rep == n_rep_gap_gmp);
428 
429  if ( from != NULL )
430  {
431  if (SR_HDL(from) & SR_INT)
432  {
433  gmp_float f_i= gmp_float(SR_TO_INT(from));
434  gmp_float *res=new gmp_float(f_i);
435  return (number)res;
436  }
437  gmp_float f_i=(mpz_ptr)from;
438  gmp_float *res=new gmp_float(f_i);
439  return (number)res;
440  }
441  else
442  return NULL;
443 }
(), see rinteger.h, new impl.
Definition: coeffs.h:112
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm res
Definition: facAbsFact.cc:64
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define SR_TO_INT(SR)
Definition: longrat.h:68
#define NULL
Definition: omList.c:12
#define SR_INT
Definition: longrat.h:66
#define SR_HDL(A)
Definition: tgb.cc:35

◆ ngfMult()

static number ngfMult ( number  a,
number  b,
const coeffs  R 
)
static

Definition at line 174 of file gnumpfl.cc.

175 {
176  assume( getCoeffType(R) == n_long_R );
177 
178  gmp_float* r= new gmp_float( (*(gmp_float*)a) * (*(gmp_float*)b) );
179  return (number)r;
180 }
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm b
Definition: cfModGcd.cc:4044
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfNeg()

static number ngfNeg ( number  a,
const coeffs  r 
)
static

Definition at line 122 of file gnumpfl.cc.

123 {
124  assume( getCoeffType(r) == n_long_R );
125 
126  *(gmp_float*)a= -(*(gmp_float*)a);
127  return (number)a;
128 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfPower() [1/2]

static number ngfPower ( number  x,
int  exp,
const coeffs  r 
)
static

Definition at line 202 of file gnumpfl.cc.

203 {
204  assume( getCoeffType(r) == n_long_R );
205 
206  if ( exp == 0 )
207  {
208  gmp_float* n = new gmp_float(1);
209  return (number)n;
210  }
211  else if ( ngfIsZero(x, r) ) // 0^e, e>0
212  {
213  return ngfInit(0, r);
214  }
215  else if ( exp == 1 )
216  {
217  return ngfCopy(x,r);
218  }
219  return (number) ( new gmp_float( (*(gmp_float*)x)^exp ) );
220 }
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:61
real floating point (GMP) numbers
Definition: coeffs.h:34
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:39
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:96
Variable x
Definition: cfModGcd.cc:4023

◆ ngfPower() [2/2]

static void ngfPower ( number  x,
int  exp,
number *  u,
const coeffs  r 
)
static

Definition at line 223 of file gnumpfl.cc.

224 {
225  *u = ngfPower(x, exp, r);
226 }
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:202
Variable x
Definition: cfModGcd.cc:4023

◆ ngfRead()

const char * ngfRead ( const char *  s,
number *  a,
const coeffs  r 
)

Definition at line 307 of file gnumpfl.cc.

308 {
310 
311  char *s= (char *)start;
312 
313  //Print("%s\n",s);
314 
315  s= ngfEatFloatNExp( s );
316 
317  if (*s=='\0') // 0
318  {
319  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
320  (*(gmp_float**)a)->setFromStr(start);
321  }
322  else if (s==start) // 1
323  {
324  if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
325  (*(gmp_float**)a)= new gmp_float(1);
326  }
327  else
328  {
329  gmp_float divisor(1.0);
330  char *start2=s;
331  if ( *s == '/' )
332  {
333  s++;
334  s= ngfEatFloatNExp( (char *)s );
335  if (s!= start2+1)
336  {
337  char tmp_c=*s;
338  *s='\0';
339  divisor.setFromStr(start2+1);
340  *s=tmp_c;
341  }
342  else
343  {
344  Werror("wrong long real format: %s",start2);
345  }
346  }
347  char c=*start2;
348  *start2='\0';
349  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
350  (*(gmp_float**)a)->setFromStr(start);
351  *start2=c;
352  if (divisor.isZero())
353  {
354  WerrorS(nDivBy0);
355  }
356  else
357  (**(gmp_float**)a) /= divisor;
358  }
359 
360  return s;
361 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
void WerrorS(const char *s)
Definition: feFopen.cc:24
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
complex floating point (GMP) numbers
Definition: coeffs.h:42
static char * ngfEatFloatNExp(char *s)
Definition: gnumpfl.cc:278
const char *const nDivBy0
Definition: numbers.h:88
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define NULL
Definition: omList.c:12
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ ngfSetChar()

static void ngfSetChar ( const coeffs  r)
static

Definition at line 397 of file gnumpfl.cc.

398 {
399  setGMPFloatDigits(r->float_len, r->float_len2);
400 }
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...
Definition: mpr_complex.cc:60

◆ ngfSetMap()

static nMapFunc ngfSetMap ( const coeffs  src,
const coeffs  dst 
)
static

Definition at line 471 of file gnumpfl.cc.

472 {
473  assume( getCoeffType(dst) == n_long_R );
474 
475  if (src->rep==n_rep_gap_rat) /*Q, Z*/
476  {
477  return ngfMapQ;
478  }
479  if (src->rep==n_rep_gap_gmp) /*Q, Z*/
480  {
481  return ngfMapZ;
482  }
483  if ((src->rep==n_rep_gmp_float) && nCoeff_is_long_R(src))
484  {
485  return ndCopyMap; //ngfCopyMap;
486  }
487  if ((src->rep==n_rep_float) && nCoeff_is_R(src))
488  {
489  return ngfMapR;
490  }
491  if ((src->rep==n_rep_gmp_complex) && nCoeff_is_long_C(src))
492  {
493  return ngfMapC;
494  }
495  if ((src->rep==n_rep_int) && nCoeff_is_Zp(src))
496  {
497  return ngfMapP;
498  }
499  return NULL;
500 }
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition: coeffs.h:822
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:251
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
Definition: coeffs.h:913
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
Definition: coeffs.h:858
(), see rinteger.h, new impl.
Definition: coeffs.h:112
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
Definition: coeffs.h:916
static number ngfMapC(number from, const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:462
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:390
(gmp_complex), see gnumpc.h
Definition: coeffs.h:118
static number ngfMapR(number from, const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:445
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static number ngfMapP(number from, const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:454
(number), see longrat.h
Definition: coeffs.h:111
static number ngfMapZ(number from, const coeffs aRing, const coeffs r)
Definition: gnumpfl.cc:424
#define NULL
Definition: omList.c:12
(gmp_float), see
Definition: coeffs.h:117
static number ngfMapQ(number from, const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:416
(int), see modulop.h
Definition: coeffs.h:110
(float), see shortfl.h
Definition: coeffs.h:116

◆ ngfSize()

static int ngfSize ( number  n,
const coeffs  r 
)
static

Definition at line 68 of file gnumpfl.cc.

69 {
70  long i = ngfInt(n, r);
71  /* basically return the largest integer in n;
72  only if this happens to be zero although n != 0,
73  return 1;
74  (this code ensures that zero has the size zero) */
75  if ((i == 0) && (ngfIsZero(n,r) == FALSE)) i = 1;
76  return ABS(i);
77 }
#define FALSE
Definition: auxiliary.h:96
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:61
static long ngfInt(number &i, const coeffs r)
Definition: gnumpfl.cc:50
int i
Definition: cfEzgcd.cc:125
static int ABS(int v)
Definition: auxiliary.h:112

◆ ngfSub()

static number ngfSub ( number  a,
number  b,
const coeffs  R 
)
static

Definition at line 163 of file gnumpfl.cc.

164 {
165  assume( getCoeffType(R) == n_long_R );
166 
167  gmp_float* r= new gmp_float( (*(gmp_float*)a) - (*(gmp_float*)b) );
168  return (number)r;
169 }
real floating point (GMP) numbers
Definition: coeffs.h:34
CanonicalForm b
Definition: cfModGcd.cc:4044
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421

◆ ngfWrite()

static void ngfWrite ( number  a,
const coeffs  r 
)
static

Definition at line 366 of file gnumpfl.cc.

367 {
368  assume( getCoeffType(r) == n_long_R );
369 
370  char *out;
371  if ( a != NULL )
372  {
373  out= floatToStr(*(gmp_float*)a, r->float_len);
374  StringAppendS(out);
375  //omFreeSize((void *)out, (strlen(out)+1)* sizeof(char) );
376  omFree( (void *)out );
377  }
378  else
379  {
380  StringAppendS("0");
381  }
382 }
real floating point (GMP) numbers
Definition: coeffs.h:34
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
void StringAppendS(const char *st)
Definition: reporter.cc:107
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define NULL
Definition: omList.c:12
char * floatToStr(const gmp_float &r, const unsigned int oprec)
Definition: mpr_complex.cc:578