From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | draft patch for strtof() |
Date: | 2019-01-16 14:17:52 |
Message-ID: | 87d0owlqpv.fsf@news-spur.riddles.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
As discussed in the Ryu thread, herewith a draft of a patch to use
strtof() for float4 input (rather than using strtod() with its
double-rounding issue).
An exhaustive search shows that this does not change the resulting
bit-pattern for any input string that could have been generated by PG
with extra_float_digits=3 set. The risk is that values generated by
other software, especially code that uses shortest-exact float output
(as a number of languages seem to do, and which PG will do if the Ryu
patch goes in) will be incorrectly input; though it appears that only
one value (7.038531e-26) is both a possible shortest-exact
representation and a rounding error (though a number of other values
round incorrectly, they are not shortest representations).
This includes a fallback to use strtod() the old way if the platform
lacks strtof(). A variant file for the new regression tests is needed
for such platforms; I've taken a stab at setting this up for the one
platform we know will need it (if there are others, the buildfarm will
let us know in due course).
--
Andrew (irc:RhodiumToad)
Attachment | Content-Type | Size |
---|---|---|
strtof.patch | text/x-patch | 20.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | James Coleman | 2019-01-16 14:49:23 | Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's |
Previous Message | M.Atıf CEYLAN | 2019-01-16 14:11:08 | PostgreSQL-XL shared disk development question |