[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gsl] cdf_poisson_P
From: |
Raymond Rogers |
Subject: |
Re: [Bug-gsl] cdf_poisson_P |
Date: |
Thu, 18 Oct 2012 10:46:45 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
"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.
Ray
On 10/18/2012 09:52 AM, Georgios wrote:
> OK, that makes sense. Thanks!
>
> Personally, however, I do not see a reason why the first argument must
> be unsigned int, as opposed to int. The reason why I say that is that
> the Poisson distribution is a distribution that gives positive
> probability to non negative integers and zero to the negative ones. So
> for negative int the 2 functions should return zero. That is just my
> opinion though.
>
> Thanks again!
>
> On 18/10/12 14:31, Rhys Ulerich wrote:
>> Hi Georgios,
>>
>>> Just to clarify: the function I am talking about is
>>> gsl_cdf_poisson_P, Not
>>> gsl_ran_poisson_pdf that I mistakenly mentioned below. The function
>>> gsl_ran_poisson_pdf (unsigned int k, double mu) is fine, and
>>> gsl_ran_poisson_pdf(-1,5) returns the expected zero.
>> According to
>> http://www.gnu.org/software/gsl/manual/html_node/The-Poisson-Distribution.html
>>
>> gsl_cdf_poisson_P also takes an unsigned int as the first argument.
>> Passing negative values to the function is impossible because the
>> first argument is unsigned.
>>
>> That "gsl_ran_poisson_pdf(-1,5) returns the expected zero" is mere
>> happenstance. Somehow feeding the function "(unsigned) -1" ==
>> 4294967295 (according to my current system) is producing the zero.
>>
>> - Rhys
>
>
--
My wife says I can be irritating at times.
As I remember I have heard similar things from:
parents, Grade school teachers, High school
teachers, College Professors, College classmates,
Navy supervisors, Business associates. and my children.
Pshaw: what do they know?