◆ eps()

Value boost::simd::eps ( Value const &  x)

This object function computes the distance between its argument and the next representable value of its argument type.

See also
ulp, ulpdist, Eps
Header <boost/simd/function/eps.hpp>
Example:
#include <boost/simd/ieee.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, 1.0e17f};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::eps(pf) = " << bs::eps(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::eps(xf) = " << bs::eps(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 1e+17)
-> bs::eps(pf) = (1.19209e-07, 2.38419e-07, 1.19209e-07, 8.58993e+09)
---- scalar
<- xf = 2
-> bs::eps(xf) = 2.38419e-07