Functions
gnumpfl.h File Reference
#include <singularconfig.h>
#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

§ ngfInitChar()

BOOLEAN ngfInitChar ( coeffs  r,
void *   
)

Initialize r.

Definition at line 440 of file gnumpfl.cc.

441 {
442  assume( getCoeffType(n) == n_long_R );
443 
444  n->is_field=TRUE;
445  n->is_domain=TRUE;
446  n->rep=n_rep_gmp_float;
447 
448  //n->cfKillChar = ndKillChar; /* dummy */
449 
450  n->cfSetChar = ngfSetChar;
451  n->ch = 0;
452  n->cfCoeffString=ngfCoeffString;
453 
454  n->cfDelete = ngfDelete;
455  //n->cfNormalize=ndNormalize;
456  n->cfInit = ngfInit;
457  n->cfInt = ngfInt;
458  n->cfAdd = ngfAdd;
459  n->cfSub = ngfSub;
460  n->cfMult = ngfMult;
461  n->cfDiv = ngfDiv;
462  n->cfExactDiv= ngfDiv;
463  n->cfInpNeg = ngfNeg;
464  n->cfInvers = ngfInvers;
465  n->cfCopy = ngfCopy;
466  n->cfGreater = ngfGreater;
467  n->cfEqual = ngfEqual;
468  n->cfIsZero = ngfIsZero;
469  n->cfIsOne = ngfIsOne;
470  n->cfIsMOne = ngfIsMOne;
471  n->cfGreaterZero = ngfGreaterZero;
472  n->cfWriteLong = ngfWrite;
473  n->cfRead = ngfRead;
474  n->cfPower = ngfPower;
475  n->cfSetMap = ngfSetMap;
476  n->cfCoeffWrite = ngfCoeffWrite;
477 #ifdef LDEBUG
478  //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
479 #endif
480 
481  n->nCoeffIsEqual = ngfCoeffIsEqual;
482 
483  if( parameter != NULL)
484  {
485  LongComplexInfo* p = (LongComplexInfo*)parameter;
486 
487  n->float_len = p->float_len;
488  n->float_len2 = p->float_len2;
489  } else // default values, just for testing!
490  {
491  n->float_len = SHORT_REAL_LENGTH;
492  n->float_len2 = SHORT_REAL_LENGTH;
493  }
494 
495  assume( n->float_len2 >= SHORT_REAL_LENGTH );
496 
497  assume( n_NumberOfParameters(n) == 0 );
498  assume( n_ParameterNames(n) == NULL );
499 
500  return FALSE;
501 }
BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:415
static char * ngfCoeffString(const coeffs r)
Definition: gnumpfl.cc:433
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:812
number ngfAdd(number la, number li, const coeffs r)
Definition: gnumpfl.cc:176
#define SHORT_REAL_LENGTH
Definition: numbers.h:54
BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:282
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
void ngfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: gnumpfl.cc:590
#define TRUE
Definition: auxiliary.h:101
number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:157
number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:209
void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:106
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:808
short float_len
additional char-flags, rInit
Definition: coeffs.h:101
BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:302
#define assume(x)
Definition: mod2.h:403
nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Get a mapping function from src into the domain of this type:
Definition: gnumpfl.cc:559
const char * ngfRead(const char *s, number *a, const coeffs r)
Definition: gnumpfl.cc:338
void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:397
BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:272
BOOLEAN ngfGreaterZero(number za, const coeffs r)
Note: MAY NOT WORK AS EXPECTED!
Definition: gnumpfl.cc:262
BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:292
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:425
number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:120
number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:70
#define NULL
Definition: omList.c:10
(gmp_float), see
Definition: coeffs.h:117
void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:428
number ngfMult(number a, number b, const coeffs r)
Definition: gnumpfl.cc:198
number ngfSub(number la, number li, const coeffs r)
Definition: gnumpfl.cc:187
void ngfPower(number x, int exp, number *lu, const coeffs r)
Definition: gnumpfl.cc:247
BOOLEAN ngfIsZero(number za, const coeffs r)
Definition: gnumpfl.cc:252
long ngfInt(number &n, const coeffs r)
Definition: gnumpfl.cc:81
number ngfNeg(number za, const coeffs r)
Definition: gnumpfl.cc:146

§ ngfRead()

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

Definition at line 338 of file gnumpfl.cc.

339 {
341 
342  char *s= (char *)start;
343 
344  //Print("%s\n",s);
345 
346  s= ngfEatFloatNExp( s );
347 
348  if (*s=='\0') // 0
349  {
350  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
351  (*(gmp_float**)a)->setFromStr(start);
352  }
353  else if (s==start) // 1
354  {
355  if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
356  (*(gmp_float**)a)= new gmp_float(1);
357  }
358  else
359  {
360  gmp_float divisor(1.0);
361  char *start2=s;
362  if ( *s == '/' )
363  {
364  s++;
365  s= ngfEatFloatNExp( (char *)s );
366  if (s!= start2+1)
367  {
368  char tmp_c=*s;
369  *s='\0';
370  divisor.setFromStr(start2+1);
371  *s=tmp_c;
372  }
373  else
374  {
375  Werror("wrong long real format: %s",start2);
376  }
377  }
378  char c=*start2;
379  *start2='\0';
380  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
381  (*(gmp_float**)a)->setFromStr(start);
382  *start2=c;
383  if (divisor.isZero())
384  {
385  WerrorS(nDivBy0);
386  }
387  else
388  (**(gmp_float**)a) /= divisor;
389  }
390 
391  return s;
392 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
void WerrorS(const char *s)
Definition: feFopen.cc:24
real floating point (GMP) numbers
Definition: coeffs.h:34
#define assume(x)
Definition: mod2.h:403
complex floating point (GMP) numbers
Definition: coeffs.h:42
static char * ngfEatFloatNExp(char *s)
Definition: gnumpfl.cc:309
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:425
#define NULL
Definition: omList.c:10
void Werror(const char *fmt,...)
Definition: reporter.cc:189