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 exp in non-default rounding modes (bug 3976)


On Tue, 28 Feb 2012, David Miller wrote:

> I don't think we need to be so accomodating.
> 
> Calling libm functions in any rounding mode other than
> round-to-nearest is completely undefined.

No, it's not undefined; see the discussion in that bug.  The functions may 
(mostly) ignore the rounding direction, but that's not permission to 
return completely wild results.

Some functions have algorithms that return approximately correct results 
whatever the mode; those don't need to change.  Some have algorithms that 
depend on round-to-nearest; those do need to save and restore the rounding 
mode.

The libc_* macros I used for this purpose are special ones already defined 
for the purpose of changing and restoring the rounding mode for functions 
that are known to operate on one type only (exp only deals with double, 
not float or long double), and already used that way in various functions.  
This allows them on x86_64 to change the rounding mode for SSE but not for 
the x87 floating-point unit; see sysdeps/x86_64/fpu/math_private.h.

-- 
Joseph S. Myers
joseph@codesourcery.com


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