results.reserve(n/2);
for (unsigned p=next_r; p<=n; p+=2) {
cln::cl_I c = 1; // seed for binonmial coefficients
- cln::cl_RA b = cln::cl_RA(1-p)/2;
+ cln::cl_RA b = cln::cl_RA(p-1)/-2;
const unsigned p3 = p+3;
const unsigned pm = p-2;
unsigned i, k, p_2;
throw(std::runtime_error("I told you not to do instantiate me!"));
too_late = true;
cln::default_float_format = cln::float_format(17);
+
+ // add callbacks for built-in functions
+ // like ... add_callback(Li_lookuptable);
}
/** Assign a native long to global Digits object. */
_numeric_digits& _numeric_digits::operator=(long prec)
{
+ long digitsdiff = prec - digits;
digits = prec;
- cln::default_float_format = cln::float_format(prec);
+ cln::default_float_format = cln::float_format(prec);
+
+ // call registered callbacks
+ std::vector<digits_changed_callback>::const_iterator it = callbacklist.begin(), end = callbacklist.end();
+ for (; it != end; ++it) {
+ (*it)(digitsdiff);
+ }
+
return *this;
}
}
+/** Add a new callback function. */
+void _numeric_digits::add_callback(digits_changed_callback callback)
+{
+ callbacklist.push_back(callback);
+}
+
+
std::ostream& operator<<(std::ostream &os, const _numeric_digits &e)
{
e.print(os);