This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] BZ#15536: Fix ulp(0x0.0p0) for 128-bit IBM long double.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]