Why does not my program is not running?

Dominikus Dittes Scherkl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 21 00:16:35 PDT 2015


On Thursday, 20 August 2015 at 21:15:36 UTC, anonymous2 wrote:
> On Thursday, 20 August 2015 at 21:11:07 UTC, anonymous wrote:
>> I severely limited the range of integer. I don't know off the 
>> top of my head how large you can make it without hitting 
>> overflow.
>>
>> I removed the file writing, because I'm not sure if you want 
>> to write it only when it doesn't exist, or only overwrite when 
>> it does exist.
>
> with integer == 66 the factorial overflows and becomes 0 (on my 
> machine) => integer division by 0...
> The overflow happens at lower values, too.

66! has 2 64times as prime-factor, so a long becomes zero at that 
point. The overflow occures long ago (at 21!), but with 66! if 
becomes obvious, because you get a division by zero error.


More information about the Digitalmars-d-learn mailing list