## ◆ modf()

 Value boost::simd::modf ( Value const & x, Value const & y )

This function object returns the integral and fractional parts of the input.

Decorators
• std_ calls std::modf to compute the pair of outputs.
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 px = {1.0f, 2.0f, -1.0f, 0.5f};
pack_ft pe, pf;
std::tie(pe, pf) = bs::modf(pf);
std::cout
<< "---- simd" << '\n'
<< "<- px = " << px << '\n'
<< "-> std::tie(pe, pf) = bs::modf(px) = " << '\n'
<< "-> pe = " << pe << '\n'
<< "-> pf = " << pf << '\n';
float x = 2.0f;
float e, f;
std::tie(e, f) = bs::modf(x);
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << x << '\n'
<< "-> std::tie(e, f) = bs::modf(x) = " << '\n'
<< "-> e = " << e << '\n'
<< "-> f = " << f << '\n';
return 0;
}
Possible output:
---- simd
<- px = (1, 2, -1, 0.5)
-> std::tie(pe, pf) = bs::modf(px) =
-> pe = (5.88308e-39, 0, 5.88243e-39, 0)
-> pf = (0, 0, 0, 0)
---- scalar
<- xf = 2
-> std::tie(e, f) = bs::modf(x) =
-> e = 0
-> f = 2