[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gsl] bug in gsl_ran_binomial (GSL 1.14)
From: |
Brian Gough |
Subject: |
Re: [Bug-gsl] bug in gsl_ran_binomial (GSL 1.14) |
Date: |
Tue, 12 Oct 2010 16:09:46 +0100 |
User-agent: |
Wanderlust/2.15.6 (Almost Unreal) Emacs/23.2 Mule/6.0 (HANACHIRUSATO) |
At Mon, 27 Sep 2010 11:49:36 +0100,
Sam Mason wrote:
> Just been having a play and it looks as though it's because gsl_pow_int
> assumes that "-n" will remove the sign when n < 0. This appears not to
> be the case for n = 1<<31, where -n is the identity function.
>
> I've changed the function to store the result in an unsigned variable
> and the function terminates now.
Thanks for the patch. You are right that there is a bug in
gsl_pow_int for n=INT_MIN, I've applied your patch.
There was also a problem that gsl_ran_binomial calls gsl_pow_int with
an unsigned int instead of a signed int in the first place, which
allows the overflow to happen.
I've added a new function gsl_pow_uint to handle that problem as well.
--
Brian Gough
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Bug-gsl] bug in gsl_ran_binomial (GSL 1.14),
Brian Gough <=