bug-gsl
[Top][All Lists]
Advanced

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

Re: [Bug-gsl] cdf_poisson_P


From: Rhys Ulerich
Subject: Re: [Bug-gsl] cdf_poisson_P
Date: Thu, 18 Oct 2012 12:06:02 -0500

> "Passing negative values to the function is impossible because the
> first argument is unsigned."
> "impossible" is evidently an overstatement; perhaps "not allowed"?
> It seems there is a data typing problem.  If the restriction is not
> going to flagged/enforced by the compiler then a check should be made at
> run-time.  Either setting an error or returning zero.

Impossible.  The implementation cannot "see" a negative input because
the value is unsigned by the time it hits the GSL routine.  There is
no way for this function to return an error message on negative
input-- all inputs are non-negative as far as the function can tell.

Such signed/unsigned mismatches should be flagged by your compiler on
-Wall and break compilation with -Werror.  If you do not always turn
on at least -Wall in your project, it's a good habit to get into.

- Rhys



reply via email to

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