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 sin, cos, tan in non-default rounding modes (bug 3976)


On 03/02/2012 12:58 PM, Joseph S. Myers wrote:
> On Fri, 2 Mar 2012, Richard Henderson wrote:
> 
>> On 03/02/2012 09:39 AM, Joseph S. Myers wrote:
>>> +  fenv_t env;
>>> +  double retval;
>>> +
>>>    int __branred(double, double *, double *);
>>>    int __mpranred(double, mp_no *, int);
>>>  
>>> +  libc_feholdexcept_setround (&env, FE_TONEAREST);
>>
>> Might it be easier to set up a macro in an internal header,
>>
>> #define WRAP_ROUND_TO_NEAREST \
>>   fenv_t env __attribute__((cleanup(libc_feupdateenv))); \
>>   libc_feholdexcept_setround (&env, FE_TONEAREST)
>>
>> and letting the compiler insert the cleanup?
> 
> libc_feupdateenv is a macro, not a function, so I don't think that will 
> work as-is.

Yeah, well, turning it into an always_inline static function
should be trivial, right?


r~


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