Re: Numeric numbers

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Francisco Olarte <folarte(at)peoplecall(dot)com>, Олег Самойлов <olleg(at)mipt(dot)ru>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Numeric numbers
Date: 2017-09-02 16:31:22
Message-ID: CAOR=d=1_3C=-j2p=H5dE75YzO7iBWFd6kVU1jgnmfRfPOHgNKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Sep 2, 2017 at 10:10 AM, Melvin Davidson <melvin6925(at)gmail(dot)com> wrote:
>
>
> On Sat, Sep 2, 2017 at 11:54 AM, Francisco Olarte <folarte(at)peoplecall(dot)com> wrote:
>>
>> On Sat, Sep 2, 2017 at 4:16 PM, Олег Самойлов <olleg(at)mipt(dot)ru> wrote:
>> > Hi all. I have silly question. Look at "numeric" type. According to
>> > docs it must be "up to 131072 digits before the decimal point; up to
>> > 16383 digits after the decimal point". Well, lets see.
>> >
>> > => select 1::numeric/3;
>> > ?column?
>> > ------------------------
>> > 0.33333333333333333333
>>
>> => select 1::numeric(100,90)/3;
>> ?column?
>> ----------------------------------------------------------------------------------------------
>> 0.333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
>> (1 row)
>>
>> It's probably doing 1(integer) => double precioson => numeric(20) or
>> something similar if you do not specify.
>>
>> Francisco Olarte.
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>
>
> Franciso,
>
> Per the docs, is is not "must be', it is "up to 131072 digits before the decimal point; up to 16383 digits after the decimal point".
> https://www.postgresql.org/docs/9.6/static/datatype-numeric.html#DATATYPE-NUMERIC-TABLE
>
> YOU have specified a precision of numeric(100,90), which means 90 decimals and that is exactly what you got!
> The result is correct, so what is your question?
>
>

Huh. I'm guessing that the cast is the limit here:

smarlowe=# select 1::numeric(1001,500);
ERROR: NUMERIC precision 1001 must be between 1 and 1000
LINE 1: select 1::numeric(1001,500);

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Олег Самойлов 2017-09-02 16:39:02 Re: Numeric numbers
Previous Message Vincenzo Romano 2017-09-02 16:20:55 Re: Numeric numbers