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

514{
516
517 n->is_field=TRUE;
518 n->is_domain=TRUE;
519 n->rep=n_rep_gmp_float;
520
521 //n->cfKillChar = ndKillChar; /* dummy */
522
523 n->cfSetChar = ngfSetChar;
524 n->ch = 0;
525 n->cfCoeffName=ngfCoeffName;
526
527 n->cfDelete = ngfDelete;
528 //n->cfNormalize=ndNormalize;
529 n->cfInit = ngfInit;
530 n->cfInitMPZ = ngfInitMPZ;
531 n->cfInt = ngfInt;
532 n->cfAdd = ngfAdd;
533 n->cfInpAdd = ngfInpAdd;
534 n->cfSub = ngfSub;
535 n->cfMult = ngfMult;
536 n->cfInpMult = ngfInpMult;
537 n->cfDiv = ngfDiv;
538 n->cfExactDiv= ngfDiv;
539 n->cfInpNeg = ngfNeg;
540 n->cfInvers = ngfInvers;
541 n->cfCopy = ngfCopy;
542 n->cfGreater = ngfGreater;
543 n->cfEqual = ngfEqual;
544 n->cfIsZero = ngfIsZero;
545 n->cfIsOne = ngfIsOne;
546 n->cfIsMOne = ngfIsMOne;
547 n->cfGreaterZero = ngfGreaterZero;
548 n->cfWriteLong = ngfWrite;
549 n->cfRead = ngfRead;
550 n->cfPower = ngfPower;
551 n->cfSetMap = ngfSetMap;
552#ifdef LDEBUG
553 //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
554#endif
555
556 n->nCoeffIsEqual = ngfCoeffIsEqual;
557
558 if( parameter != NULL)
559 {
560 LongComplexInfo* p = (LongComplexInfo*)parameter;
561
562 n->float_len = p->float_len;
563 n->float_len2 = p->float_len2;
564 } else // default values, just for testing!
565 {
566 n->float_len = SHORT_REAL_LENGTH;
567 n->float_len2 = SHORT_REAL_LENGTH;
568 }
569
570 assume( n->float_len2 >= SHORT_REAL_LENGTH );
571
572 assume( n_NumberOfParameters(n) == 0 );
574
575 return FALSE;
576}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4077
@ 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:260
static void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:416
static void ngfInpAdd(number &a, number b, const coeffs R)
Definition: gnumpfl.cc:161
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:472
static number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:200
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:250
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:290
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:61
static void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:385
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:221
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:270
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:326
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:403
static number ngfNeg(number a, const coeffs r)
Definition: gnumpfl.cc:122
static void ngfInpMult(number &a, number b, const coeffs R)
Definition: gnumpfl.cc:190
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:280
static number ngfMult(number a, number b, const coeffs R)
Definition: gnumpfl.cc:182
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:478
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:421
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:171
#define assume(x)
Definition: mod2.h:389
#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 326 of file gnumpfl.cc.

327{
329
330 char *s= (char *)start;
331
332 //Print("%s\n",s);
333
334 s= ngfEatFloatNExp( s );
335
336 if (*s=='\0') // 0
337 {
338 if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
339 (*(gmp_float**)a)->setFromStr(start);
340 }
341 else if (s==start) // 1
342 {
343 if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a);
344 (*(gmp_float**)a)= new gmp_float(1);
345 }
346 else
347 {
348 gmp_float divisor(1.0);
349 char *start2=s;
350 if ( *s == '/' )
351 {
352 s++;
353 s= ngfEatFloatNExp( (char *)s );
354 if (s!= start2+1)
355 {
356 char tmp_c=*s;
357 *s='\0';
358 divisor.setFromStr(start2+1);
359 *s=tmp_c;
360 }
361 else
362 {
363 Werror("wrong long real format: %s",start2);
364 }
365 }
366 char c=*start2;
367 *start2='\0';
368 if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float();
369 (*(gmp_float**)a)->setFromStr(start);
370 *start2=c;
371 if (divisor.isZero())
372 {
374 }
375 else
376 (**(gmp_float**)a) /= divisor;
377 }
378
379 return s;
380}
@ 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:297
const char *const nDivBy0
Definition: numbers.h:88
void Werror(const char *fmt,...)
Definition: reporter.cc:189