My Project
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 *  parameter 
)

Initialize r.

Definition at line 506 of file gnumpfl.cc.

507 {
508  assume( getCoeffType(n) == n_long_R );
509 
510  n->is_field=TRUE;
511  n->is_domain=TRUE;
512  n->rep=n_rep_gmp_float;
513 
514  //n->cfKillChar = ndKillChar; /* dummy */
515 
516  n->cfSetChar = ngfSetChar;
517  n->ch = 0;
518  n->cfCoeffName=ngfCoeffName;
519 
520  n->cfDelete = ngfDelete;
521  //n->cfNormalize=ndNormalize;
522  n->cfInit = ngfInit;
523  n->cfInitMPZ = ngfInitMPZ;
524  n->cfInt = ngfInt;
525  n->cfAdd = ngfAdd;
526  n->cfSub = ngfSub;
527  n->cfMult = ngfMult;
528  n->cfDiv = ngfDiv;
529  n->cfExactDiv= ngfDiv;
530  n->cfInpNeg = ngfNeg;
531  n->cfInvers = ngfInvers;
532  n->cfCopy = ngfCopy;
533  n->cfGreater = ngfGreater;
534  n->cfEqual = ngfEqual;
535  n->cfIsZero = ngfIsZero;
536  n->cfIsOne = ngfIsOne;
537  n->cfIsMOne = ngfIsMOne;
538  n->cfGreaterZero = ngfGreaterZero;
539  n->cfWriteLong = ngfWrite;
540  n->cfRead = ngfRead;
541  n->cfPower = ngfPower;
542  n->cfSetMap = ngfSetMap;
543 #ifdef LDEBUG
544  //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
545 #endif
546 
547  n->nCoeffIsEqual = ngfCoeffIsEqual;
548 
549  if( parameter != NULL)
550  {
551  LongComplexInfo* p = (LongComplexInfo*)parameter;
552 
553  n->float_len = p->float_len;
554  n->float_len2 = p->float_len2;
555  } else // default values, just for testing!
556  {
557  n->float_len = SHORT_REAL_LENGTH;
558  n->float_len2 = SHORT_REAL_LENGTH;
559  }
560 
561  assume( n->float_len2 >= SHORT_REAL_LENGTH );
562 
563  assume( n_NumberOfParameters(n) == 0 );
564  assume( n_ParameterNames(n) == NULL );
565 
566  return FALSE;
567 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4080
@ n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:34
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:802
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:798
@ n_rep_gmp_float
(gmp_float), see
Definition: coeffs.h:118
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:39
static number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:96
static BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:246
static void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:402
static number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:133
static long ngfInt(number &i, const coeffs r)
Definition: gnumpfl.cc:50
static number ngfInitMPZ(mpz_t m, const coeffs)
Definition: gnumpfl.cc:469
static number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:186
static number ngfAdd(number a, number b, const coeffs R)
Definition: gnumpfl.cc:153
static BOOLEAN ngfGreaterZero(number a, const coeffs r)
Definition: gnumpfl.cc:236
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:276
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:61
static void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:371
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:207
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:256
static void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:82
const char * ngfRead(const char *s, number *a, const coeffs r)
Definition: gnumpfl.cc:312
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:389
static number ngfNeg(number a, const coeffs r)
Definition: gnumpfl.cc:122
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:266
static number ngfMult(number a, number b, const coeffs R)
Definition: gnumpfl.cc:175
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:475
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:164
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:407
#define assume(x)
Definition: mod2.h:387
#define SHORT_REAL_LENGTH
Definition: numbers.h:57
#define NULL
Definition: omList.c:12

◆ ngfRead()

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

Definition at line 312 of file gnumpfl.cc.

313 {
315 
316  char *s= (char *)start;
317 
318  //Print("%s\n",s);
319 
320  s= ngfEatFloatNExp( s );
321 
322  if (*s=='\0') // 0
323  {
324  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
325  (*(gmp_float**)a)->setFromStr(start);
326  }
327  else if (s==start) // 1
328  {
329  if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
330  (*(gmp_float**)a)= new gmp_float(1);
331  }
332  else
333  {
334  gmp_float divisor(1.0);
335  char *start2=s;
336  if ( *s == '/' )
337  {
338  s++;
339  s= ngfEatFloatNExp( (char *)s );
340  if (s!= start2+1)
341  {
342  char tmp_c=*s;
343  *s='\0';
344  divisor.setFromStr(start2+1);
345  *s=tmp_c;
346  }
347  else
348  {
349  Werror("wrong long real format: %s",start2);
350  }
351  }
352  char c=*start2;
353  *start2='\0';
354  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
355  (*(gmp_float**)a)->setFromStr(start);
356  *start2=c;
357  if (divisor.isZero())
358  {
359  WerrorS(nDivBy0);
360  }
361  else
362  (**(gmp_float**)a) /= divisor;
363  }
364 
365  return s;
366 }
@ n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:42
const CanonicalForm int s
Definition: facAbsFact.cc:51
void WerrorS(const char *s)
Definition: feFopen.cc:24
static char * ngfEatFloatNExp(char *s)
Definition: gnumpfl.cc:283
const char *const nDivBy0
Definition: numbers.h:87
void Werror(const char *fmt,...)
Definition: reporter.cc:189