E.V.E
v2022.09.01

◆ is_negative

eve::is_negative = {}
inlineconstexpr

Returns a logical true if and only if the element value is signed and has its sign bit set.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
eve::as_logical<T> is_negative(T x) noexcept;
}
constexpr callable_is_negative_ is_negative
Returns a logical true if and only if the element value is signed and has its sign bit set.
Definition: is_negative.hpp:69
Definition: all_of.hpp:22

Parameters

Return value

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

Note
this function coincides with is_ltz on integral real values, but for floating values T, is_negative(mzero<T>) is true and if n is a Nan the result depends of the bit of sign of n which can be out of control although not undefined.

Example

#include <eve/module/core.hpp>
#include <eve/wide.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_negative(pf) = " << eve::is_negative(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> is_negative(xf) = " << eve::is_negative(xf) << '\n';
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr callable_minf_ minf
Computes the -infinity ieee value.
Definition: minf.hpp:60
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers