Re: Ryu floating point output patch

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Ryu floating point output patch
Date: 2019-01-12 02:53:14
Message-ID: 87y37qmwee.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Andres" == Andres Freund <andres(at)anarazel(dot)de> writes:

>> 3. Do we need to do anything about how conversions from floats to
>> numeric work? At present they _ignore_ extra_float_digits
>> (presumably on immutability grounds) and convert using only DBL_DIG
>> digits of precision.
>>
>> I have no very strong position on this but incline to keeping the
>> existing behavior, though possibly it would be good to add functions
>> to get the round-trip value and possibly even the true exact value.
>> (It would be sort of nice if CAST(floatval AS numeric(400,18)) or
>> similar could work as you'd expect, but currently we treat that as
>> floatval::numeric::numeric(400,18) so the cast function doesn't know
>> about the eventual typmod.)

Andres> Hm. What's the argument to not just always use roundtrip-safe
Andres> conversion here?

Hmm.

I was thinking that the fact that the existing conversion didn't respect
extra_float_digits probably meant that people didn't care. But
searching, I do find some complaints about it, though mostly they get
brushed off with some variant of "you're doing it wrong". (Arguably any
float to numeric conversion is a fairly dubious practice.)

But I guess the case could be made for using the shortest-roundtrip-safe
value here too.

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2019-01-12 04:15:54 Re: Checksum errors in pg_stat_database
Previous Message Amit Kapila 2019-01-12 02:15:18 Re: unnecessary creation of FSM files during bootstrap mode