## ◆ sincos()

 std::pair boost::simd::sincos ( IEEEValue const & x )

This function object computes simultaneouly and at lower cost the sine and cosine of the input.

sincosd, sincospi
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::sincos(pf);
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> std::tie(ps, pc) = bs::sincos(pf) " << '\n'
<< "-> ps = " << ps << '\n'
<< "-> pc = " << pc << '\n';
float xf = 2.0f;
float s, c;
std::tie(s, c) = bs::sincos(xf);
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> std::tie(s, c) = bs::sincos(xf) = " << '\n'
<< "-> s = " << s << '\n'
<< "-> c = " << c << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> std::tie(ps, pc) = bs::sincos(pf)
-> ps = (0.841471, 0.909297, -0.841471, 0.479426)
-> pc = (0.540302, -0.416147, 0.540302, 0.877583)
---- scalar
<- xf = 2
-> std::tie(s, c) = bs::sincos(xf) =
-> s = 0.909297
-> c = -0.416147