Bruce Momjian <pgman@candle.pha.pa.us> writes: > Sorry, I am confused. If our computational range is that high, why does > SELECT factorial(4000) and SELECT factorial(6000) produce the same > number of digits on my screen.
Are you counting correctly? regression=# select log(factorial(4000)); log ------------------------ 12673.2621666764869773 (1 row) regression=# select log(factorial(6000)); log -------------------- 20065.428782473590 (1 row) regression=# select factorial(4000) regression-# \g z4000 regression=# select factorial(6000) regression-# \g z6000 regression=# \q $ wc z4000 z6000 5 5 38039 z4000 5 5 60215 z6000 The actual representation limit at the moment (with int16 weights in the storable format) is 10^128K, as you can soon prove with pow(): regression=# select pow(10::numeric, 131071); << lots o zeroes >> regression=# select pow(10::numeric, 131072); ERROR: value overflows numeric format I don't recall what factorial that might correspond to, but it's considerably above 6000. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq