◆ bitfloating()

as_floating_t<Value> boost::simd::bitfloating ( Value const &  x)

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

This function is the converse of bitinteger.

Header <boost/simd/function/bitfloating.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, bitinteger
Example:
#include <boost/simd/ieee.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
int main()
{
pack_ft pf = {1, 2, -1, 5};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::bitfloating(pf) = " << bs::bitfloating(pf) << '\n';
std::int32_t xf = 2;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::bitfloating(xf) = " << bs::bitfloating(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 5)
-> bs::bitfloating(pf) = (1.4013e-45, 2.8026e-45, -1.4013e-45, 7.00649e-45)
---- scalar
<- xf = 2
-> bs::bitfloating(xf) = 2.8026e-45