From: Tom Lane <tgl@sss.pgh.pa.us>
To: hisanori.kobayashi.bp@nttdata.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16755: A specification or a bug? Digit drop on CAST from DOUBLE PRECISION to NUMERIC.
Date: Tue, 01 Dec 2020 10:24:51 -0500
Message-ID: <1394962.1606836291@sss.pgh.pa.us> (raw)
In-Reply-To: <16755-9889c3ce84f837e3@postgresql.org>
References: <16755-9889c3ce84f837e3@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> It would be understandable if the CAST from NUMERIC to DOUBLE PRECISION
> would digit drop, but I don't know if it's a specification or a bug to digit
> drop on CAST from DOUBLE PRECISION to NUMERIC. (translated by DeepL)
float8_numeric() only converts DBL_DIG decimal digits. We have had
discussions in the past about changing that, but so far the answer
has been "no". You have to remember that digits beyond DBL_DIG
are unreliable ... so sometimes this would make things better, but
other times it would make things worse.
If you want something that behaves like the textual display
of float8, you can always do float8value::text::numeric.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, hisanori.kobayashi.bp@nttdata.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16755: A specification or a bug? Digit drop on CAST from DOUBLE PRECISION to NUMERIC.
In-Reply-To: <1394962.1606836291@sss.pgh.pa.us>
* 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