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 509 of file gnumpfl.cc.

510 {
511  assume( getCoeffType(n) == n_long_R );
512 
513  n->is_field=TRUE;
514  n->is_domain=TRUE;
515  n->rep=n_rep_gmp_float;
516 
517  //n->cfKillChar = ndKillChar; /* dummy */
518 
519  n->cfSetChar = ngfSetChar;
520  n->ch = 0;
521  n->cfCoeffString=ngfCoeffString;
522  n->cfCoeffName=ngfCoeffName;
523 
524  n->cfDelete = ngfDelete;
525  //n->cfNormalize=ndNormalize;
526  n->cfInit = ngfInit;
527  n->cfInt = ngfInt;
528  n->cfAdd = ngfAdd;
529  n->cfSub = ngfSub;
530  n->cfMult = ngfMult;
531  n->cfDiv = ngfDiv;
532  n->cfExactDiv= ngfDiv;
533  n->cfInpNeg = ngfNeg;
534  n->cfInvers = ngfInvers;
535  n->cfCopy = ngfCopy;
536  n->cfGreater = ngfGreater;
537  n->cfEqual = ngfEqual;
538  n->cfIsZero = ngfIsZero;
539  n->cfIsOne = ngfIsOne;
540  n->cfIsMOne = ngfIsMOne;
541  n->cfGreaterZero = ngfGreaterZero;
542  n->cfWriteLong = ngfWrite;
543  n->cfRead = ngfRead;
544  n->cfPower = ngfPower;
545  n->cfSetMap = ngfSetMap;
546  n->cfCoeffWrite = ngfCoeffWrite;
547 #ifdef LDEBUG
548  //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
549 #endif
550 
551  n->nCoeffIsEqual = ngfCoeffIsEqual;
552 
553  if( parameter != NULL)
554  {
555  LongComplexInfo* p = (LongComplexInfo*)parameter;
556 
557  n->float_len = p->float_len;
558  n->float_len2 = p->float_len2;
559  } else // default values, just for testing!
560  {
561  n->float_len = SHORT_REAL_LENGTH;
562  n->float_len2 = SHORT_REAL_LENGTH;
563  }
564 
565  assume( n->float_len2 >= SHORT_REAL_LENGTH );
566 
567  assume( n_NumberOfParameters(n) == 0 );
568  assume( n_ParameterNames(n) == NULL );
569 
570  return FALSE;
571 }
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:252
static char * ngfCoeffString(const coeffs r)
Definition: gnumpfl.cc:403
static void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:398
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:812
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:385
static number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:134
#define SHORT_REAL_LENGTH
Definition: numbers.h:54
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:203
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:62
static long ngfInt(number &i, const coeffs r)
Definition: gnumpfl.cc:51
#define TRUE
Definition: auxiliary.h:98
static number ngfNeg(number a, const coeffs r)
Definition: gnumpfl.cc:123
static void ngfCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpfl.cc:503
static BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:242
real floating point (GMP) numbers
Definition: coeffs.h:34
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:808
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:40
#define assume(x)
Definition: mod2.h:394
const char * ngfRead(const char *s, number *a, const coeffs r)
Definition: gnumpfl.cc:308
static void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:367
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:425
static number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:186
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:272
static BOOLEAN ngfGreaterZero(number a, const coeffs r)
Definition: gnumpfl.cc:232
#define NULL
Definition: omList.c:10
static number ngfMult(number a, number b, const coeffs R)
Definition: gnumpfl.cc:175
static number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:97
(gmp_float), see
Definition: coeffs.h:117
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:410
static void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:83
static number ngfAdd(number a, number b, const coeffs R)
Definition: gnumpfl.cc:153
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:262
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:164
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:472

◆ ngfRead()

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

Definition at line 308 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;
362 }
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
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
complex floating point (GMP) numbers
Definition: coeffs.h:42
static char * ngfEatFloatNExp(char *s)
Definition: gnumpfl.cc:279
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