Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCNYv-00047b-S1 for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Oct 2018 11:30:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gCNYr-000162-QO for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Oct 2018 11:30:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCNYr-00015v-Eh for pgsql-bugs@lists.postgresql.org; Tue, 16 Oct 2018 11:30:53 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCNYo-0000kD-Ie for pgsql-bugs@lists.postgresql.org; Tue, 16 Oct 2018 11:30:52 +0000 Received: from [192.168.127.1] (port=30772 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gCNYk-0009MR-Gx; Tue, 16 Oct 2018 11:30:46 +0000 Received: from [127.0.0.1] (port=52450 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gCNYj-000B3k-Jt; Tue, 16 Oct 2018 11:30:45 +0000 From: Andrew Gierth To: pgsql-bugs@lists.postgresql.org, parihaaraka@gmail.com Subject: Re: BUG #15434: NUMERIC without any precision or scale truncates scale to 16 digits In-Reply-To: <15434-ced1c3ccf8209dc5@postgresql.org> (PG Bug reporting form's message of "Tue, 16 Oct 2018 09:35:28 +0000") Message-ID: <87a7ne879r.fsf@news-spur.riddles.org.uk> References: <15434-ced1c3ccf8209dc5@postgresql.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Tue, 16 Oct 2018 12:30:44 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "PG" == PG Bug reporting form 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)