Re: numeric precision when raising one numeric to

Поиск
Список
Период
Сортировка
От Claudio Succa
Тема Re: numeric precision when raising one numeric to
Дата
Msg-id 200505201919.51164.claudio.succa.ml@pertel.it
обсуждение исходный текст
Ответ на Re: numeric precision when raising one numeric to  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: numeric precision when raising one numeric to  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
17:28, venerdì 20 maggio 2005 - Tom Lane scrive:
|>   Has anyone bothered to actually look into the code?
|>
|>   regression=# select power(2::numeric,1000);
|>
|>      power
|> --------------------------------------------------------------------------
|>---------------------------------------------------------------------------
|>---------------------------------------------------------------------------
|>---------------------------------------------------------------------------
|>----------------------
|> 10715086071862673209484250490600018105614048117055336074437503883703510511
|>249361224931983788156958581275946729175531468251871452856923140435984577574
|>698574803934567774824230985421074605062371141877954182153046474983581941267
|>398767559165543946077062914571196477686542167660429831652624386837205668069
|>376.0000000000000000 (1 row)

Just for curiosity.

With PostgreSQL 7.4.7 on Linux/Debian platform I had a different result so I
made the subtraction of your figure:

                                   
psql -h s1 -d rapp-test -c "select power(2::numeric,1000) -
10715086071862673209484250490600018105614048117055336074437503883703510511
249361224931983788156958581275946729175531468251871452856923140435984577574
698574803934567774824230985421074605062371141877954182153046474983581941267
398767559165543946077062914571196477686542167660429831652624386837205668069
376.0000000000000000"

the difference seems to be more than some decimals:

                                                       ?column?
                                                                          
----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------------------------------
 -12930966888749171763979711252782126059745074561323490485649902084788364060
8509196350026606450797474300013235449638255271591657519292725441403643666323
4303290336621701615570133781468903988395214925377190448567739467132002913627
731843776737159303888471.0573553374557744
(1 row)

Why I did not get some error message? And how can I be aware of exeeding the
system capacity?

(what am I wrong about?)

Claudio

--
Claudio Succa
PERTEL - Torino - Italy
+39-011-437.4141
http://www.pertel.it
http://www.uniassist.it
http://www.progettocapolinea36.it

В списке pgsql-general по дате отправления:

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: How can I write trigger on a columns insert/update?
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: numeric precision when raising one numeric to another.