Binomial Coefficient

Doug Stewart dastew at sympatico.ca
Wed Jan 14 12:44:34 CST 2009


Pascal Bauer wrote:
> Hi List,
>
> it seems to me, that the routine which calculate the binomial 
> coefficient has a problem (it gives wrong answers).
>
> octave:1> printf("%i\n",nchoosek(81, 27))
> 2306279447501836648448
>
> But the correct value is
>
> 2306279447501851002720
>
> Cheers
>
> Pasci
> ------------------------------------------------------------------------
>
> _______________________________________________
> Bug-octave mailing list
> Bug-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave
>   
octave:4> nchoosek(81, 27)
warning: nchoosek: possible loss of precision
ans =  2.30627944750185e+21

Did you see the warning????

Doug


More information about the Bug-octave mailing list