Template Function librapid::hypot(T, T)#

Function Documentation#

template<typename T, typename std::enable_if_t<std::is_fundamental_v<T>, int> = 0>
constexpr auto librapid::hypot(T leg1, T leg2)#

Return the hypotenuse of a right triangle given the lengths of the two legs. Note that, for integer values, this function will cast the input values to a floating point type before calculating the hypotenuse.

Template Parameters

T – Data type

Parameters
  • leg1 – Length of the first leg

  • leg2 – Length of the second leg

Returns

Hypotenuse of the right triangle