E.V.E
v2023.02.15

◆ sincos

eve::sincos = {}
inlineconstexpr

Callable object computing the simultaneous computation of sine an cosine.

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
kumi::tuple<T, T> sincos(T x) noexcept; //1
template< eve::floating_value T >
as_complex_t<T> sincos(as_complex_t<T> z) noexcept; //2
}
constexpr callable_sincos_ sincos
Callable object computing the simultaneous computation of sine an cosine.
Definition: sincos.hpp:69
Definition: abi.hpp:18

Parameters

Return value

The computation returns a pair and is semantically equivalent to {sin(x), cos(x)}

Example

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {1.0f, 0.0f, eve::inf(eve::as<float>()), eve::pi(eve::as<float>())};
auto [s, c] = eve::sincos(pf);
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> sincos(pf) = [" << '\n'
<< " " << s << ", \n"
<< " " << c << '\n'
<< " ]\n";
float xf = 2.3;
auto [ss, sc] = eve::sincos(xf);
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> sincos(xf) = [" << ss << ", " << sc << "]\n";
return 0;
}
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
constexpr callable_pi_ pi
Callable object computing the constant .
Definition: pi.hpp:49
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers