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 4/4] Use copysign instead of ternary for some sin/cos input ranges


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.


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