◆ bitinteger()

as_integer_t<Value> boost::simd::bitinteger ( Value const &  x)

This function object transforms a floating point value in an integer with a preserving order formula.

This function is the converse of bitfloating.

Header <boost/simd/function/bitinteger.hpp>
Note:
This function is related to the computation of floating successors or predecessors as the ordering of the integers obtained by bifloating is the same as the original order on the floating elements, an increment can be used to find the successor.
See also
next, prev, successor, predecessor, nextafter, bitfloating
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, 0.5f};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::bitinteger(pf) = " << bs::bitinteger(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::bitinteger(xf) = " << bs::bitinteger(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::bitinteger(pf) = (1065353216, 1073741824, -1065353216, 1056964608)
---- scalar
<- xf = 2
-> bs::bitinteger(xf) = 1073741824