X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fnumeric.cpp;h=582bfdcfb5be19229c56e7239217c3a3c0ff93b0;hp=b8170e716ff3220685cb490d1a9ccf6473c23947;hb=a9909685b1ea5014a81a2d2e5963203637bdb3ce;hpb=c6f0a081d186de96b8832e284f8436657b6a4508;ds=sidebyside diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index b8170e71..582bfdcf 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -92,10 +92,16 @@ numeric::numeric(int i) : basic(&numeric::tinfo_static) // emphasizes efficiency. However, if the integer is small enough // we save space and dereferences by using an immediate type. // (C.f. ) + // The #if clause prevents compiler warnings on 64bit machines where the + // comparision is always true. +#if cl_value_len >= 32 + value = cln::cl_I(i); +#else if (i < (1L << (cl_value_len-1)) && i >= -(1L << (cl_value_len-1))) value = cln::cl_I(i); else value = cln::cl_I(static_cast(i)); +#endif setflag(status_flags::evaluated | status_flags::expanded); } @@ -107,10 +113,16 @@ numeric::numeric(unsigned int i) : basic(&numeric::tinfo_static) // emphasizes efficiency. However, if the integer is small enough // we save space and dereferences by using an immediate type. // (C.f. ) + // The #if clause prevents compiler warnings on 64bit machines where the + // comparision is always true. +#if cl_value_len >= 32 + value = cln::cl_I(i); +#else if (i < (1UL << (cl_value_len-1))) value = cln::cl_I(i); else value = cln::cl_I(static_cast(i)); +#endif setflag(status_flags::evaluated | status_flags::expanded); } @@ -603,6 +615,11 @@ bool numeric::info(unsigned inf) const return false; } +bool numeric::is_polynomial(const ex & var) const +{ + return true; +} + int numeric::degree(const ex & s) const { return 0; @@ -682,6 +699,16 @@ ex numeric::conjugate() const return numeric(cln::conjugate(this->value)); } +ex numeric::real_part() const +{ + return numeric(cln::realpart(value)); +} + +ex numeric::imag_part() const +{ + return numeric(cln::imagpart(value)); +} + // protected int numeric::compare_same_type(const basic &other) const