◆ sincosd()

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

This function object computes simultaneously and at lower cost the sind and cosd of the input.

Header <boost/simd/function/sincosd.hpp>
See also
sincos, 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::sincosd(pf);
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> std::tie(ps, pc) = bs::sincosd(pf) " << '\n'
<< "-> ps = " << ps << '\n'
<< "-> pc = " << pc << '\n';
float xf = 2.0f;
float s, c;
std::tie(s, c) = bs::sincosd(xf);
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> std::tie(s, c) = bs::sincosd(xf) = " << '\n'
<< "-> s = " << s << '\n'
<< "-> c = " << c << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> std::tie(ps, pc) = bs::sincosd(pf)
-> ps = (0.0174524, 0.0348995, -0.0174524, 0.00872654)
-> pc = (0.999848, 0.999391, 0.999848, 0.999962)
---- scalar
<- xf = 2
-> std::tie(s, c) = bs::sincosd(xf) =
-> s = 0.0348995
-> c = 0.999391