diff --git a/doc/sf/powers.qbk b/doc/sf/powers.qbk index 363c9d90e..0f2055039 100644 --- a/doc/sf/powers.qbk +++ b/doc/sf/powers.qbk @@ -310,11 +310,17 @@ calculated using NTL::RR at 1000-bit precision. template ``__sf_result`` hypot(T1 x, T2 y, const ``__Policy``&); + template + ``__sf_result`` hypot(T1 x, T2 y, T3 z); + + template + ``__sf_result`` hypot(T1 x, T2 y, T3 z, const ``__Policy``&); + __effects computes [equation hypot] in such a way as to avoid undue underflow and overflow. The return type of this function is computed using the __arg_promotion_rules -when T1 and T2 are of different types. +when T1 and T2 (and or T3) are of different types. [optional_policy] @@ -328,6 +334,11 @@ The function is even and symmetric in /x/ and /y/, so first take assume Then if ['x * [epsilon] >= y] we can simply return /x/. +In the 3-arg case the approach is to scale by the largest argument, and then calculate + +const auto a = max(max(x, y), z); +return a == 0 ? 0 : a * sqrt(x/a * x/a + y/a * y/a + z/a * z/a); + Otherwise the result is given by: [equation hypot2]