Re: [PATCH] Fix float8 parsing of denormal values (on some platforms?)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marti Raudsepp <marti@juffo.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Jeroen Vermeulen <jtv@xs4all.nl>
Date: 2012-02-01T18:17:46Z
Lists: pgsql-hackers
Marti Raudsepp <marti@juffo.org> writes: > On Wed, Dec 21, 2011 at 18:21, Marti Raudsepp <marti@juffo.org> wrote: >> I think the least invasive fix, as proposed by Jeroen, is to fail only >> when ERANGE is set *and* the return value is 0.0 or +/-HUGE_VAL. >> Reading relevant specifications, this seems to be a fairly safe >> assumption. That's what the attached patch does. > Oops, now attached the patch too. Applied with minor revisions. Notably, after staring at the code a bit I got uncomfortable with its assumption that pg_strncasecmp() cannot change errno, so I fixed it to not assume that. Also, on some platforms HUGE_VAL isn't infinity but the largest finite value, so I made the range tests be like ">= HUGE_VAL" not just "== HUGE_VAL". I know the man page for strtod() specifies it should return exactly HUGE_VAL for overflow, but who's to say that <math.h> is on the same page as the actual function? regards, tom lane