My Project  debian-1:4.1.2-p1+ds-2
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 506 of file gnumpfl.cc.

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

◆ ngfRead()

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

Definition at line 306 of file gnumpfl.cc.

308 {
310 
311  char *s= (char *)start;
312 
313  //Print("%s\n",s);
314 
315  s= ngfEatFloatNExp( s );
316 
317  if (*s=='\0') // 0
318  {
319  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
320  (*(gmp_float**)a)->setFromStr(start);
321  }
322  else if (s==start) // 1
323  {
324  if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
325  (*(gmp_float**)a)= new gmp_float(1);
326  }
327  else
328  {
329  gmp_float divisor(1.0);
330  char *start2=s;
331  if ( *s == '/' )
332  {
333  s++;
334  s= ngfEatFloatNExp( (char *)s );
335  if (s!= start2+1)
336  {
337  char tmp_c=*s;
338  *s='\0';
339  divisor.setFromStr(start2+1);
340  *s=tmp_c;
341  }
342  else
343  {
344  Werror("wrong long real format: %s",start2);
345  }
346  }
347  char c=*start2;
348  *start2='\0';
349  if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
350  (*(gmp_float**)a)->setFromStr(start);
351  *start2=c;
352  if (divisor.isZero())
353  {
354  WerrorS(nDivBy0);
355  }
356  else
357  (**(gmp_float**)a) /= divisor;
358  }
359 
360  return s;
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:420
FALSE
#define FALSE
Definition: auxiliary.h:96
ngfRead
const char * ngfRead(const char *s, number *a, const coeffs r)
Definition: gnumpfl.cc:306
LongComplexInfo
Definition: coeffs.h:98
ngfSub
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:162
ngfEatFloatNExp
static char * ngfEatFloatNExp(char *s)
Definition: gnumpfl.cc:277
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition: numbers.h:56
n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:41
ngfCoeffWrite
static void ngfCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpfl.cc:501
ngfDiv
static number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:184
ngfCopy
static number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:95
ngfInvers
static number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:132
n_NumberOfParameters
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:795
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:151
ngfDelete
static void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:81
TRUE
#define TRUE
Definition: auxiliary.h:100
nDivBy0
const char *const nDivBy0
Definition: numbers.h:87
ngfWrite
static void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:365
ngfEqual
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:250
ngfCoeffIsEqual
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:383
ngfMult
static number ngfMult(number a, number b, const coeffs R)
Definition: gnumpfl.cc:173
ngfIsZero
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:60
ngfPower
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:201
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:799
n_rep_gmp_float
(gmp_float), see
Definition: coeffs.h:116
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:188
ngfIsOne
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:260
ngfInt
static long ngfInt(number &i, const coeffs r)
Definition: gnumpfl.cc:49
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
ngfNeg
static number ngfNeg(number a, const coeffs r)
Definition: gnumpfl.cc:121
assume
#define assume(x)
Definition: mod2.h:384
ngfSetMap
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:470
NULL
#define NULL
Definition: omList.c:11
ngfGreaterZero
static BOOLEAN ngfGreaterZero(number a, const coeffs r)
Definition: gnumpfl.cc:230
ngfInit
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:38
p
int p
Definition: cfModGcd.cc:4019
ngfCoeffString
static char * ngfCoeffString(const coeffs r)
Definition: gnumpfl.cc:401
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
ngfIsMOne
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:270
ngfSetChar
static void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:396
ngfGreater
static BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:240
gmp_float
Definition: mpr_complex.h:30
ngfCoeffName
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:408