My Project  debian-1:4.1.1-p2+ds-4build1
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 507 of file gnumpfl.cc.

509 {
510  assume( getCoeffType(n) == n_long_R );
511 
512  n->is_field=TRUE;
513  n->is_domain=TRUE;
514  n->rep=n_rep_gmp_float;
515 
516  //n->cfKillChar = ndKillChar; /* dummy */
517 
518  n->cfSetChar = ngfSetChar;
519  n->ch = 0;
520  n->cfCoeffString=ngfCoeffString;
521  n->cfCoeffName=ngfCoeffName;
522 
523  n->cfDelete = ngfDelete;
524  //n->cfNormalize=ndNormalize;
525  n->cfInit = ngfInit;
526  n->cfInt = ngfInt;
527  n->cfAdd = ngfAdd;
528  n->cfSub = ngfSub;
529  n->cfMult = ngfMult;
530  n->cfDiv = ngfDiv;
531  n->cfExactDiv= ngfDiv;
532  n->cfInpNeg = ngfNeg;
533  n->cfInvers = ngfInvers;
534  n->cfCopy = ngfCopy;
535  n->cfGreater = ngfGreater;
536  n->cfEqual = ngfEqual;
537  n->cfIsZero = ngfIsZero;
538  n->cfIsOne = ngfIsOne;
539  n->cfIsMOne = ngfIsMOne;
540  n->cfGreaterZero = ngfGreaterZero;
541  n->cfWriteLong = ngfWrite;
542  n->cfRead = ngfRead;
543  n->cfPower = ngfPower;
544  n->cfSetMap = ngfSetMap;
545  n->cfCoeffWrite = ngfCoeffWrite;
546 #ifdef LDEBUG
547  //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
548 #endif
549 
550  n->nCoeffIsEqual = ngfCoeffIsEqual;
551 
552  if( parameter != NULL)
553  {
554  LongComplexInfo* p = (LongComplexInfo*)parameter;
555 
556  n->float_len = p->float_len;
557  n->float_len2 = p->float_len2;
558  } else // default values, just for testing!
559  {
560  n->float_len = SHORT_REAL_LENGTH;
561  n->float_len2 = SHORT_REAL_LENGTH;
562  }
563 
564  assume( n->float_len2 >= SHORT_REAL_LENGTH );
565 
566  assume( n_NumberOfParameters(n) == 0 );
567  assume( n_ParameterNames(n) == NULL );
568 
569  return FALSE;

◆ ngfRead()

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

Definition at line 307 of file gnumpfl.cc.

309 {
311 
312  char *s= (char *)start;
313 
314  //Print("%s\n",s);
315 
316  s= ngfEatFloatNExp( s );
317 
318  if (*s=='\0') // 0
319  {
320  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
321  (*(gmp_float**)a)->setFromStr(start);
322  }
323  else if (s==start) // 1
324  {
325  if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
326  (*(gmp_float**)a)= new gmp_float(1);
327  }
328  else
329  {
330  gmp_float divisor(1.0);
331  char *start2=s;
332  if ( *s == '/' )
333  {
334  s++;
335  s= ngfEatFloatNExp( (char *)s );
336  if (s!= start2+1)
337  {
338  char tmp_c=*s;
339  *s='\0';
340  divisor.setFromStr(start2+1);
341  *s=tmp_c;
342  }
343  else
344  {
345  Werror("wrong long real format: %s",start2);
346  }
347  }
348  char c=*start2;
349  *start2='\0';
350  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
351  (*(gmp_float**)a)->setFromStr(start);
352  *start2=c;
353  if (divisor.isZero())
354  {
355  WerrorS(nDivBy0);
356  }
357  else
358  (**(gmp_float**)a) /= divisor;
359  }
360 
361  return s;
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
FALSE
#define FALSE
Definition: auxiliary.h:94
ngfRead
const char * ngfRead(const char *s, number *a, const coeffs r)
Definition: gnumpfl.cc:307
LongComplexInfo
Definition: coeffs.h:99
ngfSub
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:163
ngfEatFloatNExp
static char * ngfEatFloatNExp(char *s)
Definition: gnumpfl.cc:278
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition: numbers.h:57
n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:41
ngfCoeffWrite
static void ngfCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpfl.cc:502
ngfDiv
static number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:185
ngfCopy
static number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:96
ngfInvers
static number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:133
n_NumberOfParameters
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:804
n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:33
ngfAdd
static number ngfAdd(number a, number b, const coeffs R)
Definition: gnumpfl.cc:152
ngfDelete
static void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:82
TRUE
#define TRUE
Definition: auxiliary.h:98
nDivBy0
const char *const nDivBy0
Definition: numbers.h:88
ngfWrite
static void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:366
ngfEqual
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:251
ngfCoeffIsEqual
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:384
ngfMult
static number ngfMult(number a, number b, const coeffs R)
Definition: gnumpfl.cc:174
ngfIsZero
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:61
ngfPower
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:202
n_ParameterNames
static FORCE_INLINE const char ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:808
n_rep_gmp_float
(gmp_float), see
Definition: coeffs.h:117
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:188
ngfIsOne
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:261
ngfInt
static long ngfInt(number &i, const coeffs r)
Definition: gnumpfl.cc:50
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
ngfNeg
static number ngfNeg(number a, const coeffs r)
Definition: gnumpfl.cc:122
assume
#define assume(x)
Definition: mod2.h:384
ngfSetMap
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:471
NULL
#define NULL
Definition: omList.c:9
ngfGreaterZero
static BOOLEAN ngfGreaterZero(number a, const coeffs r)
Definition: gnumpfl.cc:231
ngfInit
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:39
p
int p
Definition: cfModGcd.cc:4019
ngfCoeffString
static char * ngfCoeffString(const coeffs r)
Definition: gnumpfl.cc:402
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
ngfIsMOne
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:271
ngfSetChar
static void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:397
ngfGreater
static BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:241
gmp_float
Definition: mpr_complex.h:30
ngfCoeffName
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:409