E.V.E  0.1-beta

◆ is_positive

eve::is_positive = {}
inlineconstexpr

Callable object computing the is_positive logical value.

Required header: #include <eve/function/is_positive.hpp>

Members Functions

Member Effect
operator() the computation of the is_positive logical value
operator[] Construct a conditional version of current function object

auto operator()( value auto x ) const noexcept;
Definition: value.hpp:31

Parameters

x: value.

Return value

For signed types The call is_positive(x) elementwise returns true if and only if the bit of sign (most significant bit) is unset.

Warning
this function coincides with is_gez on integral real values, but for floating real values T, is_positive(Mzero<T>) is false and if x is a Nan the result depends of the bit of sign of x which can be out of control although not undefined.

auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::is_positive

Parameters

cond : conditional expression

Return value

A Callable object so that the expression is_positive[cond](x) is equivalent to if_else(cond,is_positive(x),false(as(is_positive(x))))


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/is_positive.hpp>
#include <eve/wide.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.5f, -2.0f, eve::nan(eve::as<float>()),
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> is_positive(pf) = " << eve::is_positive(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> is_positive(xf) = " << eve::is_positive(xf) << '\n';
return 0;
}
constexpr callable_nan_ nan
Callable object computing the nan value.
Definition: nan.hpp:52
constexpr callable_minf_ minf
Callable object computing the negative infinity value.
Definition: minf.hpp:55
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
constexpr callable_is_positive_ is_positive
Callable object computing the is_positive logical value.
Definition: is_positive.hpp:80
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65