Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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
In response to
Responses
pgsql-hackers by date
| Next: | From: Joshua D. Drake | Date: 2005-12-02 19:01:05 |
| Subject: Re: [HACKERS] Should libedit be preferred to libreadline? |
| Previous: | From: Bruce Momjian | Date: 2005-12-02 18:52:07 |
| Subject: Re: [HACKERS] Should libedit be preferred to libreadline? |
pgsql-patches by date
| Next: | From: Joshua D. Drake | Date: 2005-12-02 19:01:05 |
| Subject: Re: [HACKERS] Should libedit be preferred to libreadline? |
| Previous: | From: Bruce Momjian | Date: 2005-12-02 18:52:07 |
| Subject: Re: [HACKERS] Should libedit be preferred to libreadline? |
pgsql-general by date
| Next: | From: Jaime Casanova | Date: 2005-12-02 19:02:27 |
| Subject: Re: Slow COUNT |
| Previous: | From: Bruce Momjian | Date: 2005-12-02 18:42:40 |
| Subject: Re: Numeric 508 datatype |