tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
imag.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_COMPLEX_IMAG_HPP
5#define TETL_COMPLEX_IMAG_HPP
6
7#include <etl/_complex/complex.hpp>
8#include <etl/_concepts/floating_point.hpp>
9#include <etl/_concepts/integral.hpp>
10
11namespace etl {
12
13/// \ingroup complex
14template <typename T>
15[[nodiscard]] constexpr auto imag(complex<T> const& z) noexcept(noexcept(z.imag())) -> T
16{
17 return z.imag();
18}
19
20/// \ingroup complex
21template <floating_point Float>
22[[nodiscard]] constexpr auto imag(Float /*f*/) noexcept -> Float
23{
24 return Float{};
25}
26
27/// \ingroup complex
28template <integral Integer>
29[[nodiscard]] constexpr auto imag(Integer /*i*/) noexcept -> double
30{
31 return 0.0;
32}
33
34} // namespace etl
35
36#endif // TETL_COMPLEX_IMAG_HPP
constexpr auto imag(Integer) noexcept -> double
Definition imag.hpp:29
constexpr auto imag(Float) noexcept -> Float
Definition imag.hpp:22
constexpr auto imag(complex< T > const &z) noexcept(noexcept(z.imag())) -> T
Definition imag.hpp:15
Definition adjacent_find.hpp:9
A complex number.
Definition complex.hpp:20