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: Fix e_logl (128ibm) spurious underflow


Ping.

On 03/14/2013 09:38 AM, Adhemerval Zanella wrote:
> Ping.
>
> On 11-03-2013 09:27, Adhemerval Zanella wrote:
>> Ping.
>>
>>
>> On 03/07/2013 02:33 PM, Adhemerval Zanella wrote:
>>> Ping.
>>>
>>> On 02/28/2013 02:02 AM, Adhemerval Zanella wrote:
>>>> On 02/27/2013 08:50 PM, Joseph S. Myers wrote:
>>>>> On Wed, 27 Feb 2013, Adhemerval Zanella wrote:
>>>>>
>>>>>> 2013-02-27  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
>>>>>>
>>>>>> 	* sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Fix spurious
>>>>>> 	underflow.
>>>>>> 	* sysdeps/powerpc/fpu/libm-test-ulps: Update. 
>>>>> What is the bug report in Bugzilla for this issue, which presumably is 
>>>>> user-visible in a release so should have a bug report?  If there isn't 
>>>>> one, please file one; in any case, include the [BZ #N] annotation in the 
>>>>> ChangeLog entry (and a commit of a fix should include updating NEWS).  
>>>>> (If the issue isn't user-visible in a release and so doesn't need a bug 
>>>>> report, please explain why not.  But any bug being fixed that was 
>>>>> user-visible in a release should have a corresponding Bugzilla entry.)
>>>>>
>>>>> In my view you should add a testcase for this issue for log to 
>>>>> libm-test.inc, even if there are tests for other functions that show the 
>>>>> problem as well.
>>>>>
>>>> I create BZ #15214 to track this issue. I didn't add the specific testcase yet
>>>> because it is showing some higher ULPs that I'd like to take a look (this is 
>>>> showing without my patch also).
>>>>
>>>> --
>>>>
>>>> 2013-02-28  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
>>>>
>>>> 	[BZ #15214]
>>>> 	* NEWS: Mention BZ #15214.
>>>> 	* sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Fix spurious
>>>> 	underflow.
>>>> 	* sysdeps/powerpc/fpu/libm-test-ulps: Update. 
>>>>
>>>> diff --git a/NEWS b/NEWS
>>>> index a4c5638..945aa9d 100644
>>>> --- a/NEWS
>>>> +++ b/NEWS
>>>> @@ -11,7 +11,7 @@ Version 2.18
>>>>
>>>>    11561, 13951, 14142, 14200, 14317, 14327, 14496, 14920, 14964, 14981,
>>>>    14982, 14985, 14994, 14996, 15003, 15006, 15020, 15023, 15036, 15054,
>>>> -  15062, 15078, 15160.
>>>> +  15062, 15078, 15160, 15214.
>>>>
>>>>  * Add support for calling C++11 thread_local object destructors on thread
>>>>    and program exit.  This needs compiler support for offloading C++11
>>>> diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
>>>> index 14f47eb..15b5edf 100644
>>>> --- a/sysdeps/ieee754/ldbl-128ibm/e_logl.c
>>>> +++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
>>>> @@ -182,6 +182,9 @@ static const long double
>>>>    ln2a = 6.93145751953125e-1L,
>>>>    ln2b = 1.4286068203094172321214581765680755001344E-6L;
>>>>
>>>> +static const long double
>>>> +  ldbl_epsilon = 0x1p-106L;
>>>> +
>>>>  long double
>>>>  __ieee754_logl(long double x)
>>>>  {
>>>> @@ -258,7 +261,12 @@ __ieee754_logl(long double x)
>>>>      }
>>>>    /* Series expansion of log(1+z).  */
>>>>    w = z * z;
>>>> -  y = ((((((((((((l15 * z
>>>> +  /* Avoid spurious underflows.  */
>>>> +  if (__glibc_unlikely(w <= ldbl_epsilon))
>>>> +    y = 0.0L;
>>>> +  else
>>>> +    {
>>>> +      y = ((((((((((((l15 * z
>>>>  		  + l14) * z
>>>>  		 + l13) * z
>>>>  		+ l12) * z
>>>> @@ -271,7 +279,8 @@ __ieee754_logl(long double x)
>>>>  	 + l5) * z
>>>>  	+ l4) * z
>>>>         + l3) * z * w;
>>>> -  y -= 0.5 * w;
>>>> +      y -= 0.5 * w;
>>>> +    }
>>>>    y += e * ln2b;  /* Base 2 exponent offset times ln(2).  */
>>>>    y += z;
>>>>    y += logtbl[k-26]; /* log(t) - (t-1) */
>>>> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
>>>> index 4221967..5072190 100644
>>>> --- a/sysdeps/powerpc/fpu/libm-test-ulps
>>>> +++ b/sysdeps/powerpc/fpu/libm-test-ulps
>>>> @@ -243,9 +243,11 @@ idouble: 1
>>>>  Test "Real part of: cacos (-0.5 + +0 i) == 2.094395102393195492308428922186335256131 - 0 i":
>>>>  double: 1
>>>>  idouble: 1
>>>> +ldouble: 1
>>>>  Test "Real part of: cacos (-0.5 - 0 i) == 2.094395102393195492308428922186335256131 + +0 i":
>>>>  double: 1
>>>>  idouble: 1
>>>> +ldouble: 1
>>>>  Test "Imaginary part of: cacos (-1.5 + +0 i) == pi - 0.9624236501192068949955178268487368462704 i":
>>>>  double: 1
>>>>  float: 1
>>>> @@ -265,6 +267,10 @@ double: 1
>>>>  float: 1
>>>>  idouble: 1
>>>>  ifloat: 1
>>>> +Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i) == 7.853981633974483096156608458198757210493e-1 - 7.107906849659093345062145442726115449315e2 i":
>>>> +ldouble: 1
>>>> +Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i) == 7.853981633974483096156608458198757210493e-1 - 8.973081118419833726837456344608533993585e1 i":
>>>> +ldouble: 1
>>>>
>>>>  # cacosh
>>>>  Test "Real part of: cacosh (+0 + 0.5 i) == 0.4812118250596034474977589134243684231352 + pi/2 i":


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