Re: draft patch for strtof() - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: draft patch for strtof()
Date
Msg-id 878szklj7v.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: draft patch for strtof()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: draft patch for strtof()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.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)


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: draft patch for strtof()
Next
From: Robert Haas
Date:
Subject: Re: Making WAL receiver startup rely on GUC context forprimary_conninfo and primary_slot_name