◆ restricted_()

template<typename T >
auto boost::simd::restricted_ ( T const &  x)

restricts the range of validity of some functors (thus avoiding tests and branching), but ensures an as accurate though speedier version on the limited range.

Header <boost/simd/function/restricted.hpp>

For example if you are sure that all input angles are between \(-\pi/4\) and \(\pi/4\), then this may be used be used with cos : restricted_(cos) (or with the other direct trigonometric functions).

  • the simd gain will be at least 5 for floats on an sse4.2 sytem
  • the result will be Nan outside the limited interval...