BigInt Bug or just me?
Tyro[17]
nospam at home.com
Sat Apr 21 07:42:06 PDT 2012
On Saturday, 21 April 2012 at 14:30:49 UTC, Jordi Sayol wrote:
> Al 21/04/12 16:07, En/na Tyro[17] ha escrit:
>> Why does the following implementation of the binomial
>> coefficient yield two different answers?
>>
>
> Only happens when compiling to 32-bit.
>
> 32-bit:
> (40 20) = 137846528820
> (40 20) = 68923264410
>
> 64-bit:
> (40 20) = 137846528820
> (40 20) = 137846528820
Actually, in that case it only happens when compiling to 64-bit.
Note: comb1(BigInt(40), BigInt(20))/2; The the BigInt version is
being divided by two (on MAC OS X) in order to yield the
correct result.
More information about the Digitalmars-d-learn
mailing list