Loading...
Searching...
No Matches
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.
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 511 of file gnumpfl.cc.

{
assume( getCoeffType(n) == n_long_R );
n->is_field=TRUE;
n->is_domain=TRUE;
n->rep=n_rep_gmp_float;
//n->cfKillChar = ndKillChar; /* dummy */
n->cfSetChar = ngfSetChar;
n->ch = 0;
n->cfCoeffName=ngfCoeffName;
n->cfDelete = ngfDelete;
//n->cfNormalize=ndNormalize;
n->cfInit = ngfInit;
n->cfInitMPZ = ngfInitMPZ;
n->cfInt = ngfInt;
n->cfAdd = ngfAdd;
n->cfInpAdd = ngfInpAdd;
n->cfSub = ngfSub;
n->cfMult = ngfMult;
n->cfInpMult = ngfInpMult;
n->cfDiv = ngfDiv;
n->cfExactDiv= ngfDiv;
n->cfInpNeg = ngfNeg;
n->cfInvers = ngfInvers;
n->cfCopy = ngfCopy;
n->cfGreater = ngfGreater;
n->cfEqual = ngfEqual;
n->cfIsZero = ngfIsZero;
n->cfIsOne = ngfIsOne;
n->cfIsMOne = ngfIsMOne;
n->cfGreaterZero = ngfGreaterZero;
n->cfWriteLong = ngfWrite;
n->cfRead = ngfRead;
n->cfPower = ngfPower;
n->cfSetMap = ngfSetMap;
n->cfSize = ngfSize;
#ifdef LDEBUG
//n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
#endif
n->nCoeffIsEqual = ngfCoeffIsEqual;
if( parameter != NULL)
{
LongComplexInfo* p = (LongComplexInfo*)parameter;
n->float_len = p->float_len;
n->float_len2 = p->float_len2;
} else // default values, just for testing!
{
n->float_len = SHORT_REAL_LENGTH;
n->float_len2 = SHORT_REAL_LENGTH;
}
assume( n->float_len2 >= SHORT_REAL_LENGTH );
assume( n_NumberOfParameters(n) == 0 );
assume( n_ParameterNames(n) == NULL );
return FALSE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
p
int p
Definition cfModGcd.cc:4086
n_long_R
@ n_long_R
real floating point (GMP) numbers
Definition coeffs.h:33
n_ParameterNames
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition coeffs.h:773
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
n_NumberOfParameters
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition coeffs.h:769
n_rep_gmp_float
@ n_rep_gmp_float
(gmp_float), see
Definition coeffs.h:124
LongComplexInfo
Definition coeffs.h:107
ngfInit
static number ngfInit(long i, const coeffs r)
Definition gnumpfl.cc:37
ngfCopy
static number ngfCopy(number a, const coeffs r)
Definition gnumpfl.cc:94
ngfGreater
static BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition gnumpfl.cc:258
ngfSetChar
static void ngfSetChar(const coeffs r)
Definition gnumpfl.cc:414
ngfInpAdd
static void ngfInpAdd(number &a, number b, const coeffs R)
Definition gnumpfl.cc:159
ngfInvers
static number ngfInvers(number a, const coeffs r)
Definition gnumpfl.cc:131
ngfInt
static long ngfInt(number &i, const coeffs r)
Definition gnumpfl.cc:48
ngfInitMPZ
static number ngfInitMPZ(mpz_t m, const coeffs)
Definition gnumpfl.cc:470
ngfDiv
static number ngfDiv(number a, number b, const coeffs r)
Definition gnumpfl.cc:198
ngfAdd
static number ngfAdd(number a, number b, const coeffs R)
Definition gnumpfl.cc:151
ngfRead
const char * ngfRead(const char *start, number *a, const coeffs r)
Definition gnumpfl.cc:324
ngfGreaterZero
static BOOLEAN ngfGreaterZero(number a, const coeffs r)
Definition gnumpfl.cc:248
ngfIsMOne
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition gnumpfl.cc:288
ngfIsZero
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition gnumpfl.cc:59
ngfWrite
static void ngfWrite(number a, const coeffs r)
Definition gnumpfl.cc:383
ngfPower
static number ngfPower(number x, int exp, const coeffs r)
Definition gnumpfl.cc:219
ngfEqual
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition gnumpfl.cc:268
ngfSize
static int ngfSize(number n, const coeffs r)
Definition gnumpfl.cc:66
ngfDelete
static void ngfDelete(number *a, const coeffs r)
Definition gnumpfl.cc:80
ngfCoeffIsEqual
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition gnumpfl.cc:401
ngfNeg
static number ngfNeg(number a, const coeffs r)
Definition gnumpfl.cc:120
ngfInpMult
static void ngfInpMult(number &a, number b, const coeffs R)
Definition gnumpfl.cc:188
ngfIsOne
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition gnumpfl.cc:278
ngfMult
static number ngfMult(number a, number b, const coeffs R)
Definition gnumpfl.cc:180
ngfSetMap
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition gnumpfl.cc:476
ngfCoeffName
static char * ngfCoeffName(const coeffs r)
Definition gnumpfl.cc:419
ngfSub
static number ngfSub(number a, number b, const coeffs R)
Definition gnumpfl.cc:169
assume
#define assume(x)
Definition mod2.h:389
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition numbers.h:57
NULL
#define NULL
Definition omList.c:12

## ngfRead()

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

Definition at line 324 of file gnumpfl.cc.

{
assume( getCoeffType(r) == n_long_R or getCoeffType(r) == n_long_C);
char *s= (char *)start;
//Print("%s\n",s);
s= ngfEatFloatNExp( s );
if (*s=='\0') // 0
{
if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
(*(gmp_float**)a)->setFromStr(start);
}
else if (s==start) // 1
{
if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
(*(gmp_float**)a)= new gmp_float(1);
}
else
{
gmp_float divisor(1.0);
char *start2=s;
if ( *s == '/' )
{
s++;
s= ngfEatFloatNExp( (char *)s );
if (s!= start2+1)
{
char tmp_c=*s;
*s='\0';
divisor.setFromStr(start2+1);
*s=tmp_c;
}
else
{
Werror("wrong long real format: %s",start2);
}
}
char c=*start2;
*start2='\0';
if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
(*(gmp_float**)a)->setFromStr(start);
*start2=c;
if (divisor.isZero())
{
WerrorS(nDivBy0);
}
else
(**(gmp_float**)a) /= divisor;
}
return s;
}
gmp_float
Definition mpr_complex.h:32
n_long_C
@ n_long_C
complex floating point (GMP) numbers
Definition coeffs.h:41
s
const CanonicalForm int s
Definition facAbsFact.cc:51
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
ngfEatFloatNExp
static char * ngfEatFloatNExp(char *s)
Definition gnumpfl.cc:295
nDivBy0
const char *const nDivBy0
Definition numbers.h:90
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189