This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix sin, cos, tan in non-default rounding modes (bug 3976)
On Sat, 3 Mar 2012, Richard Henderson wrote:
> >> 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?
Feel free to do this if you think it makes the code clearer (without
making the generated code any worse) (I think these functions are rather a
mess generally, but probably aren't worth that much cleanup that isn't
actually fixing bugs given that hopefully they'll end up replaced by a
more modern, faster set of automatically generated correctly rounding
functions). Or file an issue in Bugzilla for the cleanup since that's now
the preferred approach for bugs and cleanups someone notices but isn't
immediately planning to work in.
--
Joseph S. Myers
joseph@codesourcery.com