[Cfp-interest 2702] Re: Floating point rounding modes

Vincent Lefevre vincent at vinc17.net
Wed Feb 22 02:38:44 PST 2023


On 2023-02-22 09:58:28 +0100, Paul Zimmermann wrote:
>        Dear Hans,
> 
> > Could you say more about what CORE-MATH is trying to do? Or give us a
> > pointer to a good paper to read?
> 
> the reference article is available at https://hal.inria.fr/hal-03721525.
> The code and other references are at https://core-math.gitlabpages.inria.fr/.

A question: The code is designed to work in all rounding modes.
But couldn't it be made simpler/faster if the rounding mode is
known to be rounding to nearest (assuming that the processor
has static rounding modes)?

> > The idea is that you would have a single routine for each of these
> > functions, independent of rounding mode?
> 
> yes exactly, for example we compute a double-double approximation hi + lo
> of sin(x), where hi, lo are binary64 values, and obtain the correctly
> rounded value by returning hi + lo, where hi + lo is rounded according
> to the current rounding mode (defined using fesetround).
> 
> If the rounding mode is given explicitly to the function as in
> cr_sin (x, FE_TOWARDZERO), we would need to replace hi + lo by
> cr_add (hi, lo, FE_TOWARDZERO) for example.
> 
> And in all other internal operations of the cr_sin() function, what
> would be the rounding mode used? Should we add an explicit rounding mode
> to all operations?

IMHO, if the rounding mode is not explicitly given, it should be
rounding to nearest.

> adding explicit rounding mode parameters would make the code much
> more complex, and would require to refactor completely the code.

But how is the code used currently? With GCC, it is known that
changing the rounding mode is not supported. I don't know about
the other compilers. Another question is: Will future processors
support static rounding modes, knowing that the current situation
is rather bad (changing the rounding mode is very slow, and
dynamic rounding modes also make optimization more difficult
and partly impossible)?

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Cfp-interest mailing list