Skip to content

mp_units::hypot

Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation

Synopsis

Declared in <mp-units/math.h>

template<auto R1, typename Rep1, auto R2, typename Rep2>
  requires detail::QuantitiesOfTheSameKind<quantity<R1, Rep1>, quantity<R2, Rep2>> &&
           requires(Rep1 v1, Rep2 v2) {
             mp_units::detail::find_common_reference(R1, R2);
             requires requires { hypot(v1, v2); }
#if MP_UNITS_HOSTED
                        || requires { std::hypot(v1, v2); }
#endif
                        ;
           }
[[nodiscard]] constexpr QuantityOf<
  decltype(std::declval<quantity<R1, Rep1>>() +
           std::declval<quantity<R2, Rep2>>())::quantity_spec> auto
hypot(quantity<R1, Rep1> const& x, quantity<R2, Rep2> const& y) noexcept;

Return Value

Note

The return value should not be discarded.

Parameters

NameDescription
xA quantity
yA quantity