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

500{
502
503 n->is_field=TRUE;
504 n->is_domain=TRUE;
505 n->rep=n_rep_gmp_float;
506
507 //n->cfKillChar = ndKillChar; /* dummy */
508
509 n->cfSetChar = ngfSetChar;
510 n->ch = 0;
511 n->cfCoeffName=ngfCoeffName;
512
513 n->cfDelete = ngfDelete;
514 //n->cfNormalize=ndNormalize;
515 n->cfInit = ngfInit;
516 n->cfInitMPZ = ngfInitMPZ;
517 n->cfInt = ngfInt;
518 n->cfAdd = ngfAdd;
519 n->cfSub = ngfSub;
520 n->cfMult = ngfMult;
521 n->cfDiv = ngfDiv;
522 n->cfExactDiv= ngfDiv;
523 n->cfInpNeg = ngfNeg;
524 n->cfInvers = ngfInvers;
525 n->cfCopy = ngfCopy;
526 n->cfGreater = ngfGreater;
527 n->cfEqual = ngfEqual;
528 n->cfIsZero = ngfIsZero;
529 n->cfIsOne = ngfIsOne;
530 n->cfIsMOne = ngfIsMOne;
531 n->cfGreaterZero = ngfGreaterZero;
532 n->cfWriteLong = ngfWrite;
533 n->cfRead = ngfRead;
534 n->cfPower = ngfPower;
535 n->cfSetMap = ngfSetMap;
536#ifdef LDEBUG
537 //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
538#endif
539
540 n->nCoeffIsEqual = ngfCoeffIsEqual;
541
542 if( parameter != NULL)
543 {
544 LongComplexInfo* p = (LongComplexInfo*)parameter;
545
546 n->float_len = p->float_len;
547 n->float_len2 = p->float_len2;
548 } else // default values, just for testing!
549 {
550 n->float_len = SHORT_REAL_LENGTH;
551 n->float_len2 = SHORT_REAL_LENGTH;
552 }
553
554 assume( n->float_len2 >= SHORT_REAL_LENGTH );
555
556 assume( n_NumberOfParameters(n) == 0 );
558
559 return FALSE;
560}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
@ n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:33
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:778
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:774
@ n_rep_gmp_float
(gmp_float), see
Definition: coeffs.h:117
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:458
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:464
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:407
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:164
#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 {
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:41
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