// 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);
}
// 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);
}
return false;
}
+bool numeric::is_polynomial(const ex & var) const
+{
+ return true;
+}
+
int numeric::degree(const ex & s) const
{
return 0;
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
* ignored because the step function is generally considered real but
* a numeric may develop a small imaginary part due to rounding errors.
*/
-int numeric::step() const
+numeric numeric::step() const
{ cln::cl_R r = cln::realpart(value);
if(cln::zerop(r))
- return 1;
+ return numeric(1,2);
if(cln::plusp(r))
return 1;
return 0;