57 static const float nrEps = 1.0e-3;
68 inline float F()
const {
return _f;}
69 inline number
N()
const {
return _n;}
92 return nf(
k).
F() >= 0.0;
137 if ((
f != 0.0) & (
i == 0))
i = 1;
209 return (0.0 ==
nf(
a).F());
216 float aa=
nf(
a).
F()-1.0;
225 float aa=
nf(
a).
F()+1.0;
238 return nf((
float)0.0).
N();
241 return nf(
nf(
a).F() / n).
N();
252 return nf((
float)0.0).
N();
254 return nf(1.0 / n).
N();
261 return nf(-
nf(c).F()).
N();
276 return nf(
x).
F() ==
nf((
float)0.0).
F();
284 int n = sprintf(ch,
"%9.3e",
nf(
a).F());
287 char* chbr =
new char[n+3];
288 memcpy(&chbr[2],&ch[1],n-1);
321 static const char* nrEatr(
const char *
s,
float *
r)
325 if (*
s >=
'0' && *
s <=
'9')
334 while (*
s >=
'0' && *
s <=
'9');
346 static const char *nIllegalChar=
"illegal character in number";
356 if (
s==start) {
WerrorS(nIllegalChar);
return s; }
366 if (
s==start) {
WerrorS(nIllegalChar);
return s; }
369 while (*t >=
'0' && *t <=
'9')
375 z1 = (z1*n + z2) / n;
382 else if (*
s==
'-') {
s++; si=-1; }
383 while (*
s >=
'0' && *
s <=
'9')
390 while (e>0) {z1*=10.0; e--; }
394 while (e>0) {z1/=10.0; e--; }
411 #pragma GCC diagnostic ignored "-Wunused-parameter" 425 int i = (int)((
long)from);
435 float t =(float)mpf_get_d((mpf_srcptr)from);
445 float t =(float)mpf_get_d((mpf_srcptr)&
h);
456 #define SR_HDL(A) ((long)(A)) 457 #define IS_INT(A) ((A)->s==3) 458 #define IS_IMM(A) (SR_HDL(A) & SR_INT) 459 #define GET_NOM(A) ((A)->z) 460 #define GET_DENOM(A) ((A)->n) 469 zz=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
483 int sign= mpf_sgn(e);
501 basis = mpf_get_d_2exp(&
exp, e);
527 basis = mpf_get_d_2exp(&
exp, q);
544 zz=(mpz_ptr)
omAlloc(
sizeof(mpz_t));
558 int sign= mpf_sgn(e);
573 basis = mpf_get_d_2exp(&
exp, e);
750 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.
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)
const CanonicalForm CFMap CFMap & N
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)