This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: testsuite fixes for small doubles
On Fri, 24 Apr 2009, DJ Delorie wrote:
> The fp-int-convert-long-double test does this:
>
> static volatile signed long long ivin, ivout;
> static volatile long double fv1, fv2;
> ivin = ((signed long long) (((unsigned long long) ~(unsigned long long) 0) >> 1));
> fv1 = ((signed long long) (((unsigned long long) ~(unsigned long long) 0) >> 1));
> fv2 = ivin;
> ivout = fv2;
>
> When sizeof(long double) <= sizeof(long long), it cannot store that
> ~0 value in a long double.
But it doesn't need to store it *exactly*; it only tests that the
conversion reverses if PREC_OK (argument to TEST_I_F_VAL) is true, and
TEST_I_F sets PREC_OK to what should be an appropriate value (based on the
types involved, LDBL_MANT_DIG, etc.) in each case. The other tests are
applicable even when the conversion is inexact (and even if it overflows
to infinity): the compile-time conversions should agree with the runtime
ones since the results of converting integers to floating-point are
well-defined by IEEE.
--
Joseph S. Myers
joseph@codesourcery.com