◆ signnz
Callable object computing the signnz function. Required header: Members Functions
template< value T > auto operator()( T x ) const noexcept;
Parameters
Return value Computes elementwise the never zero sign of For real value
For floating real value the positivity is only here based on the bit of sign. In particular -0.0 is negative and +0.0 is positive. auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::signn Parameters
Return value A Callable object so that the expression Supported decorators
ExampleSee it live on Compiler Explorer #include <eve/function/signnz.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_signnz_ signnz Callable object computing the signnz function. Definition: signnz.hpp:84 |