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

Vincent Lefevre vincent at vinc17.net
Fri Jan 27 07:15:26 PST 2023


On 2023-01-05 12:00:39 -0800, Hans Boehm wrote:
> In the explicit rounding mode case, I agree the syntax is not beautiful.
> On the other hand, for an isolated instance, in the best (AFAICT,
> not yet implemented?) case, I think we currently have something
> like:
> 
> {
>   #pragma STDC FENV_ROUND FE_TOWARDZERO;
>   z = x + y;
> }
> 
> I would prefer
> 
> z = cr_add (x, y, FE_TOWARDZERO);
> 
> unless lots of consecutive operations use the same rounding mode, for which
> I haven't seen a particularly strong use case.

However, you could define an inline function cr_add_rz using the
former syntax.

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