◆ sincospi()

std::pair<IEEEValue, IEEEValue> boost::simd::sincospi ( IEEEValue const &  x)

This function object computes simultaneously and at lower cost the sine and cosine of the input in \(\pi\) multiples.

Header <boost/simd/function/sincospi.hpp>
See also
sincosd, sincos
Example:
#include <boost/simd/trigonometric.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack <float, 4>;
int main()
{
pack_ft pf = {1.0f, 2.0f, -1.0f, 0.5f};
pack_ft ps, pc;
std::tie(ps, pc) = bs::sincospi(pf);
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> std::tie(ps, pc) = bs::sincospi(pf) " << '\n'
<< "-> ps = " << ps << '\n'
<< "-> pc = " << pc << '\n';
float xf = 2.0f;
float s, c;
std::tie(s, c) = bs::sincospi(xf);
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> std::tie(s, c) = bs::sincospi(xf) = " << '\n'
<< "-> s = " << s << '\n'
<< "-> c = " << c << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> std::tie(ps, pc) = bs::sincospi(pf)
-> ps = (-0, 0, 0, 1)
-> pc = (-1, 1, -1, -0)
---- scalar
<- xf = 2
-> std::tie(s, c) = bs::sincospi(xf) =
-> s = 0
-> c = 1