[PATCH 1/4] alpha: fix ceil on sNaN input [committed/2.23]

Richard Henderson rth@twiddle.net
Fri Dec 9 04:14:00 GMT 2016


On 12/08/2016 08:11 PM, Mike Frysinger wrote:
> On 08 Dec 2016 20:01, Richard Henderson wrote:
>> On 12/08/2016 10:51 AM, Mike Frysinger wrote:
>>>  __ceil (double x)
>>>  {
>>> +  if (isnan (x))
>>> +    return x + x;
>>> +
>>>    if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
>>>      {
>>>        double tmp1, new_x;
>>
>> Probably better to test for nan in the else of this if, since the isless is
>> surely more likely than the nan.
>>
>> That goes for all of the changes.
>
> i guess fabs(NaN) and isless(NaN, ...) isn't a problem ?

No, that's fine.

> would it be equiv to do ?
> 	if (__glibc_unlikely (isnan (x)))

No, since that test would still happen first.  I think that

   if (isless(...))
     ...
   else if (isnan(x))
     return x + x;

is better for the average case.


r~



More information about the Libc-alpha mailing list