views:

238

answers:

1

I run the AWK code and I get

The factorial of 200 is inf

This suggests me that AWK does not use the same int IEEE-standard -module as Python. It seems that AWK's limit is 170!.

How can you make AWK understand as large integers as Python?

+1  A: 

From here:

The internal representation of all numbers, including integers, uses double-precision floating-point numbers. On most modern systems, these are in IEEE 754 standard format.

Python can have integers of any length, depending on available memory. This is independent of IEEE 754. BTW, that standard gives the limit of a double precision float at about 10^(+/-308). The value of log10(factorial(171)) is > 309. See also Double Precision and What Every Scientist Should Know About Floating-Point Arithmetic.

Dennis Williamson
@Dennis: IEEE 754 seems to be the same format which Python uses. -- I use the newest OS/X. It may the reason why AWK cannot calculate 200!, but Python can.
Masi
I've add some information to my answer.
Dennis Williamson
Thank you for your answer!
Masi