From: Richard Kreckel Date: Mon, 19 Dec 2005 01:03:48 +0000 (+0000) Subject: * Simplify bernoulli. The orginal was somewhat overoptimized. X-Git-Tag: release_1-4-0~121 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=4f87021ee5736f9bd9571dfbe455cf02a380c7d2 * Simplify bernoulli. The orginal was somewhat overoptimized. --- diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 9f7968ea..96536862 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -1709,19 +1709,19 @@ const numeric bernoulli(const numeric &nn) 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(p-1)/-2; - const unsigned p3 = p+3; - const unsigned pm = p-2; - unsigned i, k, p_2; - // test if intermediate unsigned int can be represented by immediate - // objects by CLN (i.e. < 2^29 for 32 Bit machines, see ) + // The CLN manual says: "The conversion from `unsigned int' works only + // if the argument is < 2^29" (This is for 32 Bit machines. More + // generally, cl_value_len is the limiting exponent of 2. We must make + // sure that no intermediates are created which exceed this value. The + // largest intermediate is (p+3-2*k)*(p/2-k+1) <= (p^2+p)/2. if (p < (1UL<