This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] |
On 27/09/16 23:28 +0000, Joseph Myers wrote:
On Tue, 27 Sep 2016, Jonathan Wakely wrote:This adds the new 3D std::hypot() functions. This implementation seems to be faster than the naïve sqrt(x*x + y*y + z*z) implementation, or hypot(hypot(x, y), z), and should be a bit more accurate at very large or very small values due to reducing the arguments by the largest one. Improvements welcome though, as this is not my forte.Should I take it from this implementation that C++ is not concerned by certain considerations that would arise for C: spurious underflow exceptions from the scaling when some arguments much larger than others; spurious "invalid" exceptions from the comparisons when any argument is (quiet) NaN; handling of mixed (quiet) NaN and Inf arguments (where ISO C Annex F has Inf returned, not NaN)?
The entire spec from the C++ draft is: Returns: √ x^2 + y^2 + z^2 It doesn't mention "without undue overflow or underflow" as the C standard does for hypot(x, y). Handling those conditions would of course be nice, but I'm not capable of doing so, and I'd rather have a poor implementation than none. Again, improvements are welcome. I'm not the right person to do that.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |