[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-libunistring] Early Darwin and FAIL: test-float
From: |
Jeffrey Walton |
Subject: |
Re: [bug-libunistring] Early Darwin and FAIL: test-float |
Date: |
Sun, 5 May 2019 06:11:53 -0400 |
On Sun, May 5, 2019 at 4:42 AM Bruno Haible <address@hidden> wrote:
>...
> >
> > Unistring 0.9.10 is failing one self test during 'make check'. The
> > other 500+ tests are OK.
> >
> > PASS: test-fdopen
> > PASS: test-fgetc
> > ../build-aux/test-driver: line 107: 85873 Abort trap "$@"
> > > $log_file 2>&1
> > FAIL: test-float
>
> Thanks for the report.
>
> This platform (Mac OS X 10.5) is quite old [1], and already Mac OS X 10.11
> is end-of-life. This test-float failure indicates a problem only with
> 'long double's, which are hardly used in libunistring (only in the *printf
> routines). Therefore I won't spend time investigating it or providing a
> workaround (most likely: define LDBL_MAX differently).
The PowerMac long double characteristics look very similar to 32-bit
machines except for LDBL_MANT_DIG and sizeof. LDBL_MANT_DIG is twice
as large as expected. Other 32-bit machines use 53, and 64-bit
machines use 64. 106 looks unusual to me.
$ ./test.exe
sizeof(long double): 16
LDBL_MANT_DIG: 106
LDBL_MIN_EXP: -968
LDBL_MAX_EXP: 1024
LDBL_DIG: 31
LDBL_MIN_10_EXP: -291
LDBL_MAX_10_EXP: 308
That's causing this loop to fail:
volatile long double m = LDBL_MAX;
for (n = 0; n <= 2 * LDBL_MANT_DIG; n++)
{
volatile long double pow2_n = pow2l (n); /* 2^n */
volatile long double x = m + (m / pow2_n);
if (x > m)
ASSERT (x + x == x); <= Eventually fail here
else
ASSERT (!(x + x == x));
}
What do you recommend?
Jeff