Re: computing Bernoulli numbers



On 2008-01-31, dpb <none@xxxxxxx> wrote:

Sorta', but seeing is better than describing -- you're looking for a
detail but only presenting parts of the puzzle...more than likely the
problem is in what you haven't shown.

...

Looking at the numbers I get and how they differ from what I
must expect, it looks like i'm switching from double precision
to single precision somewhere, but I do not see where that
happens in my code :-(

Perhaps it's a figment of where it is you make the comparison/output,
not where it's being calculated? Again, what you've posted isn't the
whole thing. I didn't see anything obvious, either, but I'd think you
could post a complete working example in not much more than you've
already posted.

OK. It took me some time, but i managed to get to write a
trimmed down example with the two methods.

It's online at
http://www.cs.kuleuven.be/~bartv/stuff/f95_bernoulli/bernoulli_stuff.f95

When you compile and run it, you will see that the results with
the series approach are a lot more inaccurate. My question is if
that is due to a programming mistake or does that way of
evaluating simply leads to results with such roundoff errors
(contradicting what I have found on google, see earlier in this
thread).

I just find it strange that the results with the series approach
are much more inaccurate than the ones with the recurrence...

Regards,
Bart

--
"Share what you know. Learn what you don't."
.