This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] BZ#15536: Fix ulp(0x0.0p0) for 128-bit IBM long double.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Andreas Schwab <schwab at suse dot de>, Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Fri, 31 May 2013 11:14:33 -0400
- Subject: Re: [PATCH] BZ#15536: Fix ulp(0x0.0p0) for 128-bit IBM long double.
- References: <51A84400 dot 80005 at redhat dot com> <87bo7rfrzb dot fsf at hase dot home>
On 05/31/2013 04:55 AM, Andreas Schwab wrote:
> "Carlos O'Donell" <carlos@redhat.com> writes:
>
>> diff --git a/math/libm-test.inc b/math/libm-test.inc
>> index 7a6bf09..0b0b0d3 100644
>> --- a/math/libm-test.inc
>> +++ b/math/libm-test.inc
>> @@ -680,7 +680,13 @@ ulp (FLOAT value)
>> /* Fall through... */
>> case FP_SUBNORMAL:
>> /* The next closest subnormal value is a constant distance away. */
>> +#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
>> + /* In 128-bit IBM long double the precision of the type degenerates
>> + to double when we use subnormals. */
>> + ulp = FUNC(ldexp) (1.0, 1 - (MAX_EXP + (__DBL_MANT_DIG__ - 1)));
>
> Why do you need to use an internal identifier?
I don't. I should have used DBL_MANT_DIG.
OK?
Cheers,
Carlos.
v2
- Use DBL_MANT_DIG.
2013-05-31 Carlos O'Donell <carlos@redhat.com>
* math/libm-test.inc [TEST_LDOUBLE && LDBL_MANT_DIG == 106]
(ulp): Use (DBL_MANT_DIG - 1).
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 7a6bf09..0c5a6df 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -680,7 +680,13 @@ ulp (FLOAT value)
/* Fall through... */
case FP_SUBNORMAL:
/* The next closest subnormal value is a constant distance away. */
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
+ /* In 128-bit IBM long double the precision of the type degenerates
+ to double when we use subnormals. */
+ ulp = FUNC(ldexp) (1.0, 1 - (MAX_EXP + (DBL_MANT_DIG - 1)));
+#else
ulp = FUNC(ldexp) (1.0, 1 - (MAX_EXP + MANT_DIG));
+#endif
break;
case FP_NORMAL:
---
Cheers,
Carlos.