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


_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl

Reply via email to