[fpc-pascal] representation of a number

Marco van de Voort marcov at stack.nl
Sun Apr 1 19:17:02 CEST 2007


> I'm having some fun solving some programming problems in SPOJ
> (www.spoj.pl, very very cool, check it out). The thing is that is need
> to calculate some big fatorials (~100!). With FPC and the standard
> integer types I was unable to perform the correct calculations because
> 100! is bigger than the largest number which can be represented with
> those types. So I moved to the extended type and it worked quite well,
> performing correct calculations and giving correct results. I started
> wondering is this was a smart decision or if it is completely stupid
> (i'm new to programming competitions and stuff like that).

Keep in mind that the extended type has limited precision. It can contain
large values, but does so by only "remembering" the upper +/- 18 digits,
sign and exponent.

If it is a content, I think  they want you to calculate a number larger than
the size of normal types is to force you to deal with it, and define your
own arithmetic for very large numbers.




More information about the fpc-pascal mailing list