E.V.E  0.1-beta

◆ is_odd

eve::is_odd = {}
inlineconstexpr

Callable object computing the is_odd logical value.

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

Members Functions

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

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

Parameters

x: value.

Return value

The call:

constexpr callable_is_odd_ is_odd
Callable object computing the is_odd logical value.
Definition: is_odd.hpp:84
Wrapper for SIMD compatible logical types.
Definition: logical.hpp:36

is semantically equivalent to:

if constexpr(floating_real_value<T>) r = (a != dec(a)) && is_even(dec(a));
else constexpr(integral_real_value<T>) r = is_equal(x, (x/2)*2);
Definition: value.hpp:103
Definition: value.hpp:113
constexpr callable_is_equal_ is_equal
Callable object computing the equality predicate.
Definition: is_equal.hpp:98
constexpr callable_dec_ dec
Callable object computing the dec unary operation.
Definition: dec.hpp:84
constexpr callable_is_even_ is_even
Callable object computing the is_even logical value.
Definition: is_even.hpp:84

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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/is_odd.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.5f, -2.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> is_odd(pf) = " << eve::is_odd(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> is_odd(xf) = " << eve::is_odd(xf) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65