Re: [PATCH] Fix float8 parsing of denormal values (on some platforms?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marti Raudsepp <marti(at)juffo(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Jeroen Vermeulen <jtv(at)xs4all(dot)nl>
Subject: Re: [PATCH] Fix float8 parsing of denormal values (on some platforms?)
Date: 2012-02-01 18:17:46
Message-ID: 21278.1328120266@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marti Raudsepp <marti(at)juffo(dot)org> writes:
> On Wed, Dec 21, 2011 at 18:21, Marti Raudsepp <marti(at)juffo(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2012-02-01 18:19:24 Re: psql case preserving completion
Previous Message Peter Eisentraut 2012-02-01 18:13:29 Re: disable prompting by default in createuser