Functions
gnumpfl.h File Reference
#include <misc/auxiliary.h>

Go to the source code of this file.

Functions

BOOLEAN ngfInitChar (coeffs r, void *)
 Initialize r. More...
 
const char * ngfRead (const char *s, number *a, const coeffs r)
 

Function Documentation

BOOLEAN ngfInitChar ( coeffs  r,
void *   
)

Initialize r.

Definition at line 443 of file gnumpfl.cc.

444 {
445  assume( getCoeffType(n) == ID );
446 
447  n->is_field=TRUE;
448  n->is_domain=TRUE;
449  n->rep=n_rep_gmp_float;
450 
451  //n->cfKillChar = ndKillChar; /* dummy */
452 
453  n->cfSetChar = ngfSetChar;
454  n->ch = 0;
455  n->cfCoeffString=ngfCoeffString;
456 
457  n->cfDelete = ngfDelete;
458  //n->cfNormalize=ndNormalize;
459  n->cfInit = ngfInit;
460  n->cfInt = ngfInt;
461  n->cfAdd = ngfAdd;
462  n->cfSub = ngfSub;
463  n->cfMult = ngfMult;
464  n->cfDiv = ngfDiv;
465  n->cfExactDiv= ngfDiv;
466  n->cfInpNeg = ngfNeg;
467  n->cfInvers = ngfInvers;
468  n->cfCopy = ngfCopy;
469  n->cfGreater = ngfGreater;
470  n->cfEqual = ngfEqual;
471  n->cfIsZero = ngfIsZero;
472  n->cfIsOne = ngfIsOne;
473  n->cfIsMOne = ngfIsMOne;
474  n->cfGreaterZero = ngfGreaterZero;
475  n->cfWriteLong = ngfWrite;
476  n->cfRead = ngfRead;
477  n->cfPower = ngfPower;
478  n->cfSetMap = ngfSetMap;
479  n->cfCoeffWrite = ngfCoeffWrite;
480 #ifdef LDEBUG
481  //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
482 #endif
483 
484  n->nCoeffIsEqual = ngfCoeffIsEqual;
485 
486  if( parameter != NULL)
487  {
488  LongComplexInfo* p = (LongComplexInfo*)parameter;
489 
490  n->float_len = p->float_len;
491  n->float_len2 = p->float_len2;
492  } else // default values, just for testing!
493  {
494  n->float_len = SHORT_REAL_LENGTH;
495  n->float_len2 = SHORT_REAL_LENGTH;
496  }
497 
498  assume( n->float_len2 >= SHORT_REAL_LENGTH );
499 
500  assume( n_NumberOfParameters(n) == 0 );
501  assume( n_ParameterNames(n) == NULL );
502 
503  return FALSE;
504 }
BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:418
static char * ngfCoeffString(const coeffs r)
Definition: gnumpfl.cc:436
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:796
number ngfAdd(number la, number li, const coeffs r)
Definition: gnumpfl.cc:179
#define SHORT_REAL_LENGTH
Definition: numbers.h:54
BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:285
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
void ngfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: gnumpfl.cc:593
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:160
number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:212
void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:109
short float_len2
additional char-flags, rInit
Definition: coeffs.h:101
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:792
short float_len
additional char-flags, rInit
Definition: coeffs.h:100
BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:305
#define assume(x)
Definition: mod2.h:405
nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Get a mapping function from src into the domain of this type:
Definition: gnumpfl.cc:562
const char * ngfRead(const char *s, number *a, const coeffs r)
Definition: gnumpfl.cc:341
void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:400
BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:275
BOOLEAN ngfGreaterZero(number za, const coeffs r)
Note: MAY NOT WORK AS EXPECTED!
Definition: gnumpfl.cc:265
BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:295
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:123
number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:73
#define NULL
Definition: omList.c:10
(gmp_float), see
Definition: coeffs.h:116
void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:431
number ngfMult(number a, number b, const coeffs r)
Definition: gnumpfl.cc:201
number ngfSub(number la, number li, const coeffs r)
Definition: gnumpfl.cc:190
static const n_coeffType ID
Our Type!
Definition: gnumpfl.cc:27
void ngfPower(number x, int exp, number *lu, const coeffs r)
Definition: gnumpfl.cc:250
BOOLEAN ngfIsZero(number za, const coeffs r)
Definition: gnumpfl.cc:255
long ngfInt(number &n, const coeffs r)
Definition: gnumpfl.cc:84
number ngfNeg(number za, const coeffs r)
Definition: gnumpfl.cc:149
const char* ngfRead ( const char *  s,
number *  a,
const coeffs  r 
)

Definition at line 341 of file gnumpfl.cc.

342 {
343  assume( getCoeffType(r) == ID or getCoeffType(r) == n_long_C);
344 
345  char *s= (char *)start;
346 
347  //Print("%s\n",s);
348 
349  s= ngfEatFloatNExp( s );
350 
351  if (*s=='\0') // 0
352  {
353  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
354  (*(gmp_float**)a)->setFromStr(start);
355  }
356  else if (s==start) // 1
357  {
358  if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
359  (*(gmp_float**)a)= new gmp_float(1);
360  }
361  else
362  {
363  gmp_float divisor(1.0);
364  char *start2=s;
365  if ( *s == '/' )
366  {
367  s++;
368  s= ngfEatFloatNExp( (char *)s );
369  if (s!= start2+1)
370  {
371  char tmp_c=*s;
372  *s='\0';
373  divisor.setFromStr(start2+1);
374  *s=tmp_c;
375  }
376  else
377  {
378  Werror("wrong long real format: %s",start2);
379  }
380  }
381  char c=*start2;
382  *start2='\0';
383  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
384  (*(gmp_float**)a)->setFromStr(start);
385  *start2=c;
386  if (divisor.isZero())
387  {
388  WerrorS(nDivBy0);
389  }
390  else
391  (**(gmp_float**)a) /= divisor;
392  }
393 
394  return s;
395 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define assume(x)
Definition: mod2.h:405
complex floating point (GMP) numbers
Definition: coeffs.h:41
static char * ngfEatFloatNExp(char *s)
Definition: gnumpfl.cc:312
const char *const nDivBy0
Definition: numbers.h:83
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
#define NULL
Definition: omList.c:10
static const n_coeffType ID
Our Type!
Definition: gnumpfl.cc:27
void Werror(const char *fmt,...)
Definition: reporter.cc:199