4#ifndef TETL_CMATH_HYPOT_HPP
5#define TETL_CMATH_HYPOT_HPP
7#include <etl/_config/all.hpp>
9#include <etl/_cmath/isinf.hpp>
10#include <etl/_cmath/isnan.hpp>
11#include <etl/_cmath/sqrt.hpp>
12#include <etl/_limits/numeric_limits.hpp>
18inline constexpr struct hypot {
19 template <
typename Float>
20 [[nodiscard]]
constexpr auto operator()(Float x, Float y)
const noexcept -> Float
22 if (
etl::isinf(x)
or etl::isinf(y)) {
25 if (
etl::isnan(x)
or etl::isnan(y)) {
28 return etl::sqrt(x * x + y * y);
31 template <
typename Float>
32 [[nodiscard]]
constexpr auto operator()(Float x, Float y, Float z)
const noexcept -> Float
34 if (
etl::isinf(x)
or etl::isinf(y)
or etl::isinf(z)) {
37 if (
etl::isnan(x)
or etl::isnan(y)
or etl::isnan(z)) {
40 return etl::sqrt(x * x + y * y + z * z);
60 return etl::detail::hypot(x, y);
65 return etl::detail::hypot(x, y);
70 return etl::detail::hypot(x, y);
73[[
nodiscard]]
constexpr auto hypot(
long double x,
long double y)
noexcept ->
long double
75 return etl::detail::hypot(x, y);
78[[
nodiscard]]
constexpr auto hypotl(
long double x,
long double y)
noexcept ->
long double
80 return etl::detail::hypot(x, y);
83[[
nodiscard]]
constexpr auto hypot(
float x,
float y,
float z)
noexcept ->
float
85 return etl::detail::hypot(x, y, z);
88[[
nodiscard]]
constexpr auto hypot(
double x,
double y,
double z)
noexcept ->
double
90 return etl::detail::hypot(x, y, z);
93[[
nodiscard]]
constexpr auto hypot(
long double x,
long double y,
long double z)
noexcept ->
long double
95 return etl::detail::hypot(x, y, z);
constexpr auto hypot(long double x, long double y, long double z) noexcept -> long double
Definition hypot.hpp:93
constexpr auto hypot(double x, double y, double z) noexcept -> double
Definition hypot.hpp:88
constexpr auto hypotf(float x, float y) noexcept -> float
Definition hypot.hpp:63
constexpr auto hypot(long double x, long double y) noexcept -> long double
Definition hypot.hpp:73
constexpr auto hypot(double x, double y) noexcept -> double
Definition hypot.hpp:68
constexpr auto hypotl(long double x, long double y) noexcept -> long double
Definition hypot.hpp:78
constexpr auto hypot(float x, float y, float z) noexcept -> float
Definition hypot.hpp:83
constexpr auto hypot(float x, float y) noexcept -> float
Definition hypot.hpp:58
Definition adjacent_find.hpp:9
Definition numeric_limits.hpp:18