Re: Ryu floating point output patch

Andrew Gierth <andrew@tao11.riddles.org.uk>

From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: "pgsql-hackers\@postgresql.org" <pgsql-hackers@postgresql.org>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Donald Dong <xdong@csumb.edu>, Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Chapman Flack <chap@anastigmatix.net>
Date: 2019-01-18T10:03:29Z
Lists: pgsql-hackers

Attachments

Next version.

Changes since previous patch:

1. Remove "ryu_" from the name of interface functions; it seems better
to name them according to functionality rather than enshrining the
algorithm name. double_to_shortest_decimal*() and
float_to_shortest_decimal*() are the new names. common/ryu.h renamed
to common/shortest_dec.h accordingly.

2. Revert the removal of upstream's declaration-after-statements, and
add makefile foo to compile without warning about same. Other style
aspects (indentation, comments) still follow our style rather than
upstream's.

3. This patch _includes_ the strtof() patch that was also posted
separately; this is because we need accurate float4in in order to get
round-trip conversions to work for the edge case.

4. Passes regression tests (existing tests either by changing the
output, where the result is reasonably expected to be bit-exact; or by
locally setting extra_float_digits=0 to restore the old output, where
the output is not expected to be bit-exact).

Still to be done: docs, which are still waiting on final decisions on
the questions I asked upthread.

-- 
Andrew (irc:RhodiumToad)

Commits

  1. Provide an extra-float-digits setting for pg_dump / pg_dumpall

  2. Change floating-point output format for improved performance.

  3. Use strtof() and not strtod() for float4 input.