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: Math functions and rounding mode


On Tue, 2 Jan 2018, Wilco Dijkstra wrote:

> None of the basic math functions require switching of rounding mode as 
> non-nearest rounding modes don't have unacceptable rounding errors. If 
> we check rounding mode only in infrequently used (and expensive) math 
> functions then the overhead will be so small it's not worth worrying 
> about.

Temporarily changing rounding mode inside a libm function has at least 
three uses:

(a) Functions using precision-extension techniques that only work 
correctly in round-to-nearest (x + y or x * y -> high and low parts of the 
sum or product).

(b) Reducing error accumulation in non-default rounding modes, where the 
total error accumulation is otherwise excessive.

(c) Setting round-to-zero temporarily in implementations based on 
round-to-odd (currently fma on systems that don't have it in hardware; in 
future the narrowing functions from TS 18661-1 as well, on systems which 
don't have hardware support for those operations).

-- 
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]