◆ cot()

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

This function object returns the cotangent of the input in radian: \(\cos(x)/\sin(x)\).

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

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

See also
cos, sin, tan, cotd, cotpi
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::cot(pf) = " << bs::cot(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::cot(xf) = " << bs::cot(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::cot(pf) = (0.642093, -0.457658, -0.642093, 1.83049)
---- scalar
<- xf = 2
-> bs::cot(xf) = -0.457658