Re: draft patch for strtof()

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: draft patch for strtof()
Date: 2019-01-16 15:46:23
Message-ID: 878szklj7v.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

>> 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).

Tom> The errno handling in strtof seems bizarrely overcomplex; why do
Tom> you need the separate caller_errno variable?

Eh. I was preserving the conventional behaviour of setting errno only on
errors and not resetting it to 0, but I suppose you could argue that
that is overkill given that the function is called only in one place
that's supposed to have already set errno to 0.

(And yes, I missed a couple of files and the windows build breaks,
working on those)

>> 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).

Tom> I'm not that much on board with introducing test cases that we
Tom> know, beyond question, are going to be portability headaches. What
Tom> will we actually gain with this, compared to just not having the
Tom> test case?

The purpose of the test case is to ensure that we're getting the right
values on input. If these values fail on any platform that anyone
actually cares about, then I think we need to know about it.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-01-16 16:02:48 Re: Making WAL receiver startup rely on GUC context for primary_conninfo and primary_slot_name
Previous Message Tom Lane 2019-01-16 15:20:59 Re: draft patch for strtof()