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

512{
514
515 n->is_field=TRUE;
516 n->is_domain=TRUE;
517 n->rep=n_rep_gmp_float;
518
519 //n->cfKillChar = ndKillChar; /* dummy */
520
521 n->cfSetChar = ngfSetChar;
522 n->ch = 0;
523 n->cfCoeffName=ngfCoeffName;
524
525 n->cfDelete = ngfDelete;
526 //n->cfNormalize=ndNormalize;
527 n->cfInit = ngfInit;
528 n->cfInitMPZ = ngfInitMPZ;
529 n->cfInt = ngfInt;
530 n->cfAdd = ngfAdd;
531 n->cfInpAdd = ngfInpAdd;
532 n->cfSub = ngfSub;
533 n->cfMult = ngfMult;
534 n->cfInpMult = ngfInpMult;
535 n->cfDiv = ngfDiv;
536 n->cfExactDiv= ngfDiv;
537 n->cfInpNeg = ngfNeg;
538 n->cfInvers = ngfInvers;
539 n->cfCopy = ngfCopy;
540 n->cfGreater = ngfGreater;
541 n->cfEqual = ngfEqual;
542 n->cfIsZero = ngfIsZero;
543 n->cfIsOne = ngfIsOne;
544 n->cfIsMOne = ngfIsMOne;
545 n->cfGreaterZero = ngfGreaterZero;
546 n->cfWriteLong = ngfWrite;
547 n->cfRead = ngfRead;
548 n->cfPower = ngfPower;
549 n->cfSetMap = ngfSetMap;
550 n->cfSize = ngfSize;
551#ifdef LDEBUG
552 //n->cfDBTest = ndDBTest; // not yet implemented: ngfDBTest
553#endif
554
555 n->nCoeffIsEqual = ngfCoeffIsEqual;
556
557 if( parameter != NULL)
558 {
559 LongComplexInfo* p = (LongComplexInfo*)parameter;
560
561 n->float_len = p->float_len;
562 n->float_len2 = p->float_len2;
563 } else // default values, just for testing!
564 {
565 n->float_len = SHORT_REAL_LENGTH;
566 n->float_len2 = SHORT_REAL_LENGTH;
567 }
568
569 assume( n->float_len2 >= SHORT_REAL_LENGTH );
570
571 assume( n_NumberOfParameters(n) == 0 );
573
574 return FALSE;
575}
#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:775
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:771
@ n_rep_gmp_float
(gmp_float), see
Definition: coeffs.h:117
static number ngfInit(long i, const coeffs r)
Definition: gnumpfl.cc:37
static number ngfCopy(number a, const coeffs r)
Definition: gnumpfl.cc:94
static BOOLEAN ngfGreater(number a, number b, const coeffs r)
Definition: gnumpfl.cc:258
static void ngfSetChar(const coeffs r)
Definition: gnumpfl.cc:414
static void ngfInpAdd(number &a, number b, const coeffs R)
Definition: gnumpfl.cc:159
static number ngfInvers(number a, const coeffs r)
Definition: gnumpfl.cc:131
static long ngfInt(number &i, const coeffs r)
Definition: gnumpfl.cc:48
static number ngfInitMPZ(mpz_t m, const coeffs)
Definition: gnumpfl.cc:470
static number ngfDiv(number a, number b, const coeffs r)
Definition: gnumpfl.cc:198
static number ngfAdd(number a, number b, const coeffs R)
Definition: gnumpfl.cc:151
const char * ngfRead(const char *start, number *a, const coeffs r)
Definition: gnumpfl.cc:324
static BOOLEAN ngfGreaterZero(number a, const coeffs r)
Definition: gnumpfl.cc:248
static BOOLEAN ngfIsMOne(number a, const coeffs r)
Definition: gnumpfl.cc:288
static BOOLEAN ngfIsZero(number a, const coeffs r)
Definition: gnumpfl.cc:59
static void ngfWrite(number a, const coeffs r)
Definition: gnumpfl.cc:383
static number ngfPower(number x, int exp, const coeffs r)
Definition: gnumpfl.cc:219
static BOOLEAN ngfEqual(number a, number b, const coeffs r)
Definition: gnumpfl.cc:268
static int ngfSize(number n, const coeffs r)
Definition: gnumpfl.cc:66
static void ngfDelete(number *a, const coeffs r)
Definition: gnumpfl.cc:80
static BOOLEAN ngfCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpfl.cc:401
static number ngfNeg(number a, const coeffs r)
Definition: gnumpfl.cc:120
static void ngfInpMult(number &a, number b, const coeffs R)
Definition: gnumpfl.cc:188
static BOOLEAN ngfIsOne(number a, const coeffs r)
Definition: gnumpfl.cc:278
static number ngfMult(number a, number b, const coeffs R)
Definition: gnumpfl.cc:180
static nMapFunc ngfSetMap(const coeffs src, const coeffs dst)
Definition: gnumpfl.cc:476
static char * ngfCoeffName(const coeffs r)
Definition: gnumpfl.cc:419
static number ngfSub(number a, number b, const coeffs R)
Definition: gnumpfl.cc:169
#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 324 of file gnumpfl.cc.

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