◆ sign
Callable object computing the sign operation. Required header: Members Functions
template< value T > auto operator()( T x ) const noexcept;
Parameters
Return value Computes elementwise the sign of For real value
Moreover for floating real value if x is auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::sign Parameters
Return value A Callable object so that the expression Supported decorators
ExampleSee it live on Compiler Explorer #include <eve/function/sign.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float, eve::fixed<8>>;
using wide_it = eve::wide<std::int16_t, eve::fixed<4>>;
int main()
{
wide_ft pf = {-0.0f, 2.0f, -3.0f, -32768.0f,
0.0f, -2.0f, 3.0f, 32768.0f};
wide_it pi = { 0, 2, -3, -32768};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
float xf = -327.68f;
std::int16_t xi = -328;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- xi = " << xi << '\n'
return 0;
}
constexpr callable_sign_ sign Callable object computing the sign operation. Definition: sign.hpp:84 |