tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
abs.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_COMPLEX_ABS_HPP
5#define TETL_COMPLEX_ABS_HPP
6
7#include <etl/_cmath/hypot.hpp>
8#include <etl/_complex/complex.hpp>
9
10namespace etl {
11
12/// \ingroup complex
13template <typename T>
14[[nodiscard]] constexpr auto abs(complex<T> const& z) -> T
15{
16 return hypot(z.real(), z.imag());
17}
18
19} // namespace etl
20
21#endif // TETL_COMPLEX_ABS_HPP
constexpr auto abs(complex< T > const &z) -> T
Definition abs.hpp:14
Definition adjacent_find.hpp:9
A complex number.
Definition complex.hpp:20