float values at the extreme... when did things change?

Sean Chittenden sean at chittenden.org
Wed May 7 16:06:32 PDT 2003


> > Small values were considered zero.  Now, however, small values are out
> > of range:
> >
> >   INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
> >   ERROR:  Input '-10e400' is out of range for float8
> >   INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
> >   ERROR:  Input '10e-400' is out of range for float8
> >   INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
> >   ERROR:  Input '-10e-400' is out of range for float8
> >
> > No doubt that things are more correct in their current
> > incarnation, however, when did this change (not sure where to
> > look) and was there a __FreeBSD_version bump regarding this?  -sc
> 
> Some LDBL_* constants, especially ones related to small values, were
> broken in rev.1.7 of the i386 <float.h>, but this problem seems to
> be just a bug in the regression tests combined with a change in the
> implementation-defined behaviour of strtod().
> 
> strtod("10e-400", NULL) now sets errno to ERANGE.  It apparently now
> detects underflow when it didn't before, or decides to report this
> by setting errno to ERANGE when it didn't before.  Whether errno is
> set to ERANGE on underflow is implementation-defined, so it is a bug
> in the regression tests for them to not expect this error.  Whether
> it is actually an error depends on whether the application cares
> about underflow.
> 
> gdtoa has a knob for changing this behaviour (see the README), but
> this should never be used since it breaks the standard behaviour of
> setting errno to ERANGE on overflow in strtod().
> 
> In RELENG_4, strtod() attempts to set errno to ERANGE on underflow.
> It has no knob to control this, but its underflow detection is
> broken unless the library is compiled with -O0.  This might be a
> compiler bug (mishandling of extra precision could easily break
> underflow checks).

Hrm, considering Peter's recent post regarding gdtoa, can I count on
this to continue to work even if gdtoa gets ripped out or isn't in use
on a system (isn't gdtoa GPL-ware?  Why'd we even bother importing it
anyway)?  How about the base system's old version of strtod, will it
be fixed at some point for higher optimization levels?  -sc

-- 
Sean Chittenden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 202 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-standards/attachments/20030507/495b3053/attachment.bin


More information about the freebsd-standards mailing list