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


On 02/27/2013 06:08 PM, Adhemerval Zanella wrote:
> On 02/27/2013 06:17 PM, Carlos O'Donell wrote:
>> On 02/27/2013 03:11 PM, Adhemerval Zanella wrote:
>>> This patch fixes the spurious underflow exceptions triggered by cacos,
>>> casin, and casinh test for IBM long double. This is in fact an issue with
>>> __ieee754_logl implementation: in the domain reduction phase, where
>>> the algorithm transform log(u) -> log(t) + log(u/t) and log(u/t) -> log(1+(u-t)/t),
>>> if the input is high enough the calculation '1+(u-t)/t' might generate
>>> subnormal numbers.
>>>
>>> The patch I propose tests if the resulting coefficient used in the series
>>> expansion might trigger a subnormal multiplication and if it is the case,
>>> just set the expansion to 0. Since it is denormal multiplications and the
>>> expect result is orders of magnitude higher than the series expansion, I
>>> believe the loss of precision is acceptable.
>>>
>>> I also added the ulps update for remaining cacos tests.
>>>
>>> Any tips, comments, advices?
>>>
>>> --
>>>
>>> 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. 
>> Where is the test case addition that triggers the spurious underflow?
>>
>> Cheers,
>> Carlos.
>>
>>
> I forgot to the spurious underflow is being triggered by already existing
> cacos, casin, and casin testcases:
> 
> cacos (0x1p500 + 1.0 i)
> cacos (0x1p500 - 1.0 i)
> cacos (-0x1p500 + 1.0 i)
> cacos (-0x1p500 - 1.0 i)
> cacos (1.0 + 0x1p500 i)
> cacos (-1.0 + 0x1p500 i)
> cacos (1.0 - 0x1p500 i)
> cacos (-1.0 - 0x1p500 i)
> casin (0x1p500 + 1.0 i)
> casin (0x1p500 - 1.0 i)
> casin (-0x1p500 + 1.0 i)
> casin (-0x1p500 - 1.0 i)
> casin (1.0 + 0x1p500 i)
> casin (-1.0 + 0x1p500 i)
> casin (1.0 - 0x1p500 i)
> casin (-1.0 - 0x1p500 i)
> casinh (0x1p500 + 1.0 i)
> casinh (0x1p500 - 1.0 i)
> casinh (-0x1p500 + 1.0 i)
> casinh (-0x1p500 - 1.0 i)
> casinh (1.0 + 0x1p500 i)
> casinh (-1.0 + 0x1p500 i)
> casinh (1.0 - 0x1p500 i) 
> casinh (-1.0 - 0x1p500 i)
> 
> Which call __ieee754_logl with argument 3.2733906078961418700131896968275992e+150. I can add
> the logl testcase, but I think it is redundant.

If the existing tests consistently trigger the spurious underflow
then you don't need to add anything. I was just asking because you
didn't make it clear that it was *our* test case that triggers
the underflow.

Cheers,
Carlos.
 


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