Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org, parihaaraka(at)gmail(dot)com
Subject: Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits
Date: 2018-10-16 11:30:44
Message-ID: 87a7ne879r.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>>>>> "PG" == PG Bug reporting form <noreply(at)postgresql(dot)org> writes:

PG> 1800000000000000001::numeric / (10^18)::numeric truncated, --
PG> truncates to 16 digits after decimal point

It has to truncate it _somewhere_, because otherwise 1::numeric / 3
would be infinitely long...

The choice that numeric division actually makes is to produce a result
with at least 16 significant figures, but also with at least as many
decimal places as the display scale of either of the inputs.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey 2018-10-16 12:25:18 Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits
Previous Message Andrey 2018-10-16 10:04:47 Re: NOTIFY does not work as expected