[Bug libstdc++/77776] C++17 std::hypot implementation is poor

emsr at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 10 20:18:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77776

--- Comment #8 from emsr at gcc dot gnu.org ---
(In reply to Matthias Kretz from comment #6)

> > How precise is hypot supposed to be? I know it is supposed to try and avoid
> > spurious overflow/underflow, but I am not convinced that it should aim for
> > correct rounding.
> 
> That's a good question for all of <cmath> / <math.h>. Any normative wording
> on that question would be (welcome) news to me. AFAIK precision is left
> completely as QoI. So, except for the Annex F requirements (which we can
> drop with -ffast-math), let's implement all of <cmath> as `return 0;`. ;-)
> 

It looks like C is trying to incorporate ISO/IEC TS 18661-1 Floating-point
extensions for C — Part 1: Binary floating-point arithmetic, etc.

This adds a lot of rounding control but it looks like correcly rounded
transcendentals are still merely a recommendation.


More information about the Gcc-bugs mailing list