[PATCH 4/4] Use copysign instead of ternary for some sin/cos input ranges

Carlos O'Donell carlos@redhat.com
Wed Sep 28 20:04:00 GMT 2016


On 09/28/2016 08:59 AM, Manfred wrote:
> 
> 
> On 9/27/2016 7:49 PM, Siddhesh Poyarekar wrote:
>> @@ -479,7 +479,7 @@ __sin (double x)
>>      {
>>        res = do_sin (x, 0, &cor);
>>        retval = (res == res + 1.096 * cor) ? res : slow1 (x);
>> -      retval = m > 0 ? retval : -retval;
>> +      retval = __copysign (retval, x);
>>      }                /*   else  if (k < 0x3feb6000)    */
>>
> The ternary uses m, __copysign uses x. It could be correct (I didn't check the full context), but just in case...

In both those cases X < pi, and therefore the result has the same sign as X.

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list