pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: pgsql-bugs@lists.postgresql.org
To: parihaaraka@gmail.com
Subject: Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits
Date: Tue, 16 Oct 2018 12:30:44 +0100
Message-ID: <87a7ne879r.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <15434-ced1c3ccf8209dc5@postgresql.org>
References: <15434-ced1c3ccf8209dc5@postgresql.org>

>>>>> "PG" == PG Bug reporting form <noreply@postgresql.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)




view thread (3+ messages)  latest in thread

Message-ID: <87a7ne879r.fsf@news-spur.riddles.org.uk>
Permalink:  ../87a7ne879r.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87a7ne879r.fsf@news-spur.riddles.org.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, parihaaraka@gmail.com
  Subject: Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits
  In-Reply-To: <87a7ne879r.fsf@news-spur.riddles.org.uk>
  References: <15434-ced1c3ccf8209dc5@postgresql.org> <87a7ne879r.fsf@news-spur.riddles.org.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox