◆ saturate
Callable object computing the saturation of a value in a type. Required header: Members Functions
template< real_value T, real_scalar_value Target>
auto operator()( T const& x, as_<Target> const& t) const noexcept;
Parameters
Return value For an T r = saturate(x, as_<Target>{});
constexpr callable_saturate_ saturate Callable object computing the saturation of a value in a type. Definition: saturate.hpp:94 is semantically equivalent to: T vmin=static_cast<T>(Valmin<Target>());
T vmax=static_cast<T>(Valmax<Target>());
constexpr callable_clamp_ clamp Callable object clamping a value between two others. Definition: clamp.hpp:104 constexpr callable_convert_ convert Callable object converting a value to another type. Definition: convert.hpp:87
auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::saturate Parameters
Return value A Callable object so that the expression Supported decoratorsno decorators are supported ExampleSee it live on Compiler Explorer #include <eve/function/saturate.hpp>
#include <eve/constant/valmax.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float, eve::fixed<4>>;
using wide_it = eve::wide<std::int64_t, eve::fixed<4>>;
using int_16 = eve::as<std::int16_t>;
using int_64 = eve::as<std::int64_t>;
int main()
{
wide_ft pf = {-1.0f, 2.3f, 45000.7f, -64768.6f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
double xf = -64768.4f;
std::int64_t xi = -64768;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- xi = " << xi << '\n'
return 0;
}
constexpr callable_valmax_ valmax Callable object computing the greatest representable value. Definition: valmax.hpp:53 |