Alternative bernoulli(const numeric &)

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Fri Jan 18 21:03:44 CET 2002


On Fri, 18 Jan 2002, Markus Nullmeier wrote:
> 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).

Sure, they are notoriously untractable.  But was there really such a
limit in the old code?  I was under the impression that I once had it
compute B_{30000} but I might be wrong...

> Thus I think things could be left as they are, since the CLN manual
> hints that conversions from `long' are less efficient. 

They involve a function call and the constructed number isn't immiediate
any more but heap-allocated instead.  But I doubt you'll see the differnce
in this case.

>                                                        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.

I do not think the difference in times will be worth the effort, but I
haven't tried.  Making it safe such that somebody who wants to see it
break down would have to let it run for a week or so is more important.

Regards
     -richy.
-- 
Richard B. Kreckel
<Richard.Kreckel at Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>





More information about the GiNaC-devel mailing list