◆ cosd()

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

This function object returns the cosine of the input in degree: \(\cos(\pi x/180)\).

Header <boost/simd/function/cosd.hpp>
Note
  • The semantics of the function are similar to cos ones.
See also
sincosd, cos, cospi
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::cosd(pf) = " << bs::cosd(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::cosd(xf) = " << bs::cosd(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::cosd(pf) = (0.999848, 0.999391, 0.999848, 0.999962)
---- scalar
<- xf = 2
-> bs::cosd(xf) = 0.999391