◆ fracscale
Callable object computing the fractional scaled part. Required header: Members Functions
Definition: value.hpp:83 Parameters
Return value Returns the elementwise reduced part of the scaled input. The number of fraction bits retained is specified by scale. By default the internal rounding after scaling is done to nearest integer. The call is equivalent to auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::fracscale Parameters
Return value A Callable object so that the expression Supported decorators
ExampleSee it live on Compiler Explorer #include <eve/function/fracscale.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float, eve::fixed<4>>;
int main()
{
wide_ft pf( [](auto i, auto) { return 1.2345678+i; } );
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
float xf = 0x1.fffffep0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << std::hexfloat << xf << '\n';
for (int i = 0; i < 16; ++i)
std::cout << "-> toward_zero(fracscale)(xf," << std::setw(2) << i << ") = " << std::hexfloat << eve::toward_zero(eve::fracscale)(xf, i) << '\n';
return 0;
}
constexpr callable_fracscale_ fracscale Callable object computing the fractional scaled part. Definition: fracscale.hpp:100 constexpr toward_zero_type const toward_zero Higher-order Callable Object imbuing rounding toward zero semantic onto other Callable Objects. Definition: roundings.hpp:163 |