Re: [BUG] Denormal float values break backup/restore - Mailing list pgsql-hackers

From Jeroen Vermeulen
Subject Re: [BUG] Denormal float values break backup/restore
Date
Msg-id 4DF3BD2D.5020800@xs4all.nl
Whole thread Raw
In response to Re: [BUG] Denormal float values break backup/restore  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUG] Denormal float values break backup/restore
List pgsql-hackers
On 2011-06-11 01:57, Tom Lane wrote:

> (5) Lobby your libc providers to make strtod accept denormals without
> throwing ERANGE.  There is no obvious reason why it shouldn't.  (On at
> least one of my boxes, it does.)

The standard either explicitly allows or requires this behaviour 
(depending on which text I look at) for underflow.

AIUI that is defined to be a little vague, but includes denormalized 
numbers that would undergo any rounding at all.  It says that on 
overflow the conversion should return the appropriate HUGE_VAL variant, 
and set ERANGE.  On underflow it returns a reasonably appropriate value 
(and either may or must set ERANGE, which is the part that isn't clear 
to me).

ISTM the appropriate response to ERANGE combined with a "small" return 
value is to either ignore or report the rounding error, but accept the 
return value.  The current code in float.c doesn't check the return 
value at all and treats all ERANGE conditions as equal.


Jeroen


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Identifying no-op length coercions
Next
From: Jeff Janes
Date:
Subject: Re: pgbench--new transaction type