60 static const float nrEps = 1.0e-3;
69 nf(number n): _n(n){};
71 inline float F()
const {
return _f;}
72 inline number
N()
const {
return _n;}
87 PrintS(
"// characteristic : 0 (real)\n");
95 return nf(k).F() >= 0.0;
102 return nf(
nf(a).
F() *
nf(b).
F()).N();
113 return nf(
nf(f).
F()).N();
140 if ((f != 0.0) & (i == 0)) i = 1;
212 return (0.0 ==
nf(a).
F());
219 float aa=
nf(a).F()-1.0;
228 float aa=
nf(a).F()+1.0;
241 return nf((
float)0.0).N();
244 return nf(
nf(a).
F() / n).N();
255 return nf((
float)0.0).N();
257 return nf(1.0 / n).N();
264 return nf(-
nf(c).
F()).N();
271 return nf(a).F() >
nf(b).F();
279 return nf(x).F() ==
nf((
float)0.0).F();
287 int n = sprintf(ch,
"%9.3e",
nf(a).
F());
290 char* chbr =
new char[n+3];
291 memcpy(&chbr[2],&ch[1],n-1);
324 static const char* nrEatr(
const char *
s,
float *r)
328 if (*s >=
'0' && *s <=
'9')
337 while (*s >=
'0' && *s <=
'9');
349 static const char *nIllegalChar=
"illegal character in number";
359 if (s==start) {
WerrorS(nIllegalChar);
return s; }
369 if (s==start) {
WerrorS(nIllegalChar);
return s; }
372 while (*t >=
'0' && *t <=
'9')
378 z1 = (z1*n + z2) / n;
385 else if (*s==
'-') {s++; si=-1; }
386 while (*s >=
'0' && *s <=
'9')
393 while (e>0) {z1*=10.0; e--; }
397 while (e>0) {z1/=10.0; e--; }
414 #pragma GCC diagnostic ignored "-Wunused-parameter" 428 int i = (int)((
long)from);
438 float t =(float)mpf_get_d((mpf_srcptr)from);
448 float t =(float)mpf_get_d((mpf_srcptr)&
h);
459 #define SR_HDL(A) ((long)(A)) 460 #define IS_INT(A) ((A)->s==3) 461 #define IS_IMM(A) (SR_HDL(A) & SR_INT) 462 #define GET_NOM(A) ((A)->z) 463 #define GET_DENOM(A) ((A)->n) 472 zz=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
486 int sign= mpf_sgn(e);
504 basis = mpf_get_d_2exp(&exp, e);
505 float f= sign*ldexp(basis,exp);
530 basis = mpf_get_d_2exp(&exp, q);
531 float f = sign*ldexp(basis,exp);
547 zz=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
561 int sign= mpf_sgn(e);
576 basis = mpf_get_d_2exp(&exp, e);
577 float f= sign*ldexp(basis,exp);
753 n->cfExactDiv=
nrDiv;
static number nrMapP(number from, const coeffs aRing, const coeffs r)
number nrMapZ(number from, const coeffs aRing, const coeffs r)
BOOLEAN nrInitChar(coeffs n, void *p)
Initialize r.
static const n_coeffType ID
Our Type!
const CanonicalForm int s
BOOLEAN nrGreaterZero(number k, const coeffs r)
number nrMult(number a, number b, const coeffs r)
const CanonicalForm int const CFList const Variable & y
static number nrMapLongR(number from, const coeffs aRing, const coeffs r)
BOOLEAN nrEqual(number a, number b, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
#define SHORT_REAL_LENGTH
number nrSub(number a, number b, const coeffs r)
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
#define omFreeSize(addr, size)
(), see rinteger.h, new impl.
int nrSize(number n, const coeffs)
void WerrorS(const char *s)
gmp_complex numbers based on
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
void nrPower(number a, int i, number *result, const coeffs r)
number nrDiv(number a, number b, const coeffs r)
real floating point (GMP) numbers
single prescision (6,6) real numbers
const char * nrRead(const char *s, number *a, const coeffs r)
number nrAdd(number a, number b, const coeffs r)
float nrFloat(number n)
Converts a n_R number into a float. Needed by Maps.
Coefficient rings, fields and other domains suitable for Singular polynomials.
static number nrMapC(number from, const coeffs aRing, const coeffs r)
void nrWrite(number a, const coeffs r)
The main handler for Singular numbers which are suitable for Singular polynomials.
void StringAppendS(const char *st)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
complex floating point (GMP) numbers
(gmp_complex), see gnumpc.h
BOOLEAN nrIsMOne(number a, const coeffs r)
number nrInvers(number c, const coeffs r)
BOOLEAN nrDBTest(number a, const coeffs r, const char *f, const int l)
const char *const nDivBy0
void PrintS(const char *s)
nMapFunc nrSetMap(const coeffs src, const coeffs dst)
Get a mapping function from src into the domain of this type: n_R.
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
number nrInit(long i, const coeffs r)
number nrMapQ(number from, const coeffs r, const coeffs aRing)
void nrCoeffWrite(const coeffs r, BOOLEAN)
BOOLEAN nrIsOne(number a, const coeffs r)
static char * nrCoeffString(const coeffs r)
number nrNeg(number c, const coeffs r)
long nrInt(number &n, const coeffs r)
BOOLEAN nrIsZero(number a, const coeffs r)
BOOLEAN nrGreater(number a, number b, const coeffs r)