◆ sin()

IEEEValue boost::simd::sin ( IEEEValue const &  x)

This function object returns the sine of the input in radians.

Header <boost/simd/function/sin.hpp>
Note

As most other trigonometric function sin may be called with a second optional parameter which is a tag on speed and accuracy (see cos for further details)

See also
sincos, sind, sinpi
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};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::sin(pf) = " << bs::sin(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::sin(xf) = " << bs::sin(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::sin(pf) = (0.841471, 0.909297, -0.841471, 0.479426)
---- scalar
<- xf = 2
-> bs::sin(xf) = 0.909297