]> www.ginac.de Git - ginac.git/blobdiff - ginac/numeric.cpp
Fixed warning on 64bit machines.
[ginac.git] / ginac / numeric.cpp
index b8170e716ff3220685cb490d1a9ccf6473c23947..582bfdcfb5be19229c56e7239217c3a3c0ff93b0 100644 (file)
@@ -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. <cln/object.h>)
+       // 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<long>(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. <cln/object.h>)
+       // 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<unsigned long>(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