◆ tan()

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

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

Header <boost/simd/function/tan.hpp>
Note
  • As most other trigonometric function tan can be called with a second optional parameter which is a tag on speed and accuracy (see cos for further details)
See also
tand, tanpi
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::tan(pf) = " << bs::tan(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::tan(xf) = " << bs::tan(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::tan(pf) = (1.55741, -2.18504, -1.55741, 0.546302)
---- scalar
<- xf = 2
-> bs::tan(xf) = -2.18504