Alternative bernoulli(const numeric &)

Markus Nullmeier markus.nullmeier at urz.uni-heidelberg.de
Fri Jan 18 20:48:54 CET 2002


From: Richard B. Kreckel <kreckel at thep.physik.uni-mainz.de>
> Hmm, I think a simple cast to long would get the job done, in the same
> manner as the numeric ctors from builtin types work.

Yes, a change to `long' would push the limit for even arguments to
65534. However I think the real problem lies in the "philosophical"
nature of my question. I guess nobody will want to calculate Bernoulli
numbers this big (the limit of the 1.0.3 code seems to be 8190).

Thus I think things could be left as they are, since the CLN manual
hints that conversions from `long' are less efficient. By altogether
abolishing the theoretical limit and letting CLN calculate (p3-i)*(p2-i),
we would slow the procedure down by some per cent without any real gain.
But I suppose this road should be taken if 23168 did become an issue, like
  if (p < 23168) { normal_inner_loop; } else { slow_inner_loop_with_CLN; }
If you like this better I can make a patch.

Markus



More information about the GiNaC-devel mailing list