E.V.E
v2022.03.00

◆ fracscale

eve::fracscale = {}
inlineconstexpr

Computes the reduced part of the scaled input.

The call is equivalent to a0-roundscale(a0,scale)

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T, int scale >
T fracscale(T x, int scale) noexcept;
}
constexpr callable_fracscale_ fracscale
Computes the reduced part of the scaled input.
Definition: fracscale.hpp:112
Definition: all_of.hpp:22

Parameters

  • x: realfloating value.
  • scale : int or std::integral_constant of int type limited to the range [0, 15].

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.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
int main()
{
wide_ft pf( [](auto i, auto) { return 1.2345678+i; } );
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> fracscale(pf, 4) = " << eve::fracscale(pf, 4) << '\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_i_ i
Callable object computing the pure imaginary ( ) value.
Definition: i.hpp:51
constexpr toward_zero_type const toward_zero
Higher-order Callable Object imbuing rounding toward zero semantic onto other Callable Objects.
Definition: roundings.hpp:163
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers