Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group