[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] gsl_sum (potential division by zero?)

From: Brian Gough
Subject: Re: [Help-gsl] gsl_sum (potential division by zero?)
Date: Thu, 04 Jan 2007 05:48:46 +0000
User-agent: Wanderlust/2.14.0 (Africa) Emacs/21.3 Mule/5.0 (SAKAKI)

At Sun, 24 Dec 2006 13:35:14 +0100,
Michel Van den Bergh wrote:
> I was looking at the code for gsl_sum. I have not completely
> understood it yet, but I noticed that whereas levin_utrunc.c
> explicitly tests for terms that are zero, this is not the case for
> levin_u.c. As one divides by such terms, it seems that one may
> potentially divide by zero this way. Am I wrong?


Thanks for your email.  I think the original code that the routine was
translated from assumes that all terms passed in are non-zero since
any others would not contribute to the sum.

> The documentation does not seem to mention that terms should be
> different from zero.

Yes, I will add a note about that.

> I am not a numerical analyst (IANANA) but it seems to me that even in
> levin_utrunc.c no motivation is given for discarding zero terms.
> Wouldn't it be more natural to add a bit of noise to the remainder
> estimates to reduce the risk of division by zero? 

Generally in GSL we just implement what is published in the
literature, so far I have not seen any newer algorithms published.

best regards,

Brian Gough
(GSL Maintainer)

Network Theory Ltd,
Publishing the GSL Manual -

reply via email to

[Prev in Thread] Current Thread [Next in Thread]