Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2003 16:06:28 -0700
From:      Sean Chittenden <sean@chittenden.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-standards@freebsd.org
Subject:   Re: float values at the extreme... when did things change?
Message-ID:  <20030507230627.GQ49916@perrin.int.nxad.com>
In-Reply-To: <20030508080005.D4073@gamplex.bde.org>
References:  <20030507175740.GM49916@perrin.int.nxad.com> <20030508080005.D4073@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--//IivP0gvsAy3Can
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> > 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
>=20
> 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().
>=20
> 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.
>=20
> 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().
>=20
> 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

--=20
Sean Chittenden

--//IivP0gvsAy3Can
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Comment: Sean Chittenden <sean@chittenden.org>

iD8DBQE+uZFz3ZnjH7yEs0ERAhYTAJwO0FoJop3ZFQ2rCihtxJ1Rq+y8wwCfSECQ
kq66ezDG085B72ua6SlX3qU=
=da1L
-----END PGP SIGNATURE-----

--//IivP0gvsAy3Can--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030507230627.GQ49916>