[Cfp-interest 3147] Re: midpoint function

Vincent Lefevre vincent at vinc17.net
Thu Jul 18 16:47:07 PDT 2024


On 2024-07-18 12:34:40 -0700, David Hough CFP wrote:
> C++ has adopted a midpoint function; what about C?

This should probably be discussed in the stds-754 list first.

> The picture for decimal floating point is not so cheerful. Thinking
> of (5*a+5*b)/10, correct rounding would require two extra precise
> products of 5*a and 5*b - needing an extra digit of precision, and
> an extra exponent digit (digits?), for those products - and then the
> addition of those extra-precise products, followed by rounding to
> the original precision. Again an exponent bias of -1 is needed, this
> time representing a division by 10.

There may be a better way to compute the midpoint: a normal addition
with some extra information about the trailing part needed for the
division by 2 and rounding.

Note that midpoint would be useful for interval arithmetic.
This function is required by IEEE 1788-2015.

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