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
3#ifndef TETL_COMPLEX_IMAG_HPP
4#define TETL_COMPLEX_IMAG_HPP
5
9
10namespace etl {
11
13template <typename T>
14[[nodiscard]] constexpr auto imag(complex<T> const& z) noexcept(noexcept(z.imag())) -> T
15{
16 return z.imag();
17}
18
20template <floating_point Float>
21[[nodiscard]] constexpr auto imag(Float /*f*/) noexcept -> Float
22{
23 return Float{};
24}
25
27template <integral Integer>
28[[nodiscard]] constexpr auto imag(Integer /*i*/) noexcept -> double
29{
30 return 0.0;
31}
32
33} // namespace etl
34
35#endif // TETL_COMPLEX_IMAG_HPP
constexpr auto imag(complex< T > const &z) noexcept(noexcept(z.imag())) -> T
Definition imag.hpp:14
Definition adjacent_find.hpp:8
A complex number.
Definition complex.hpp:19