◆ mantissa()

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

This function object returns the signed mantissa of the input argument.

Header <boost/simd/function/mantissa.hpp>
Note
The exponent e and signed mantissa m of a floating point entry x are related by \(x = m\times 2^e\), with |m| \(\in[1, 2[\). (Except for zero, for which \(m = 0\)).
See also
frexp, pow, exponent
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::mantissa(pf) = " << bs::mantissa(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::mantissa(xf) = " << bs::mantissa(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::mantissa(pf) = (1, 1, -1, 1)
---- scalar
<- xf = 2
-> bs::mantissa(xf) = 1