E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ mzero

auto eve::mzero = functor<mzero_t>
inlineconstexpr

For integral type there is no difference between eve::zero and eve::mzero, but for floating ones the bit of sign differs.

However, eve::mzero always satisfies the equality predicate with eve::zero and eve::mzero satisfies the predicate is_negative, but not the predicate is_ltz.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T mzero(as<T> x) noexcept;
}
constexpr auto mzero
Computes the negative zero value.
Definition mzero.hpp:73
EVE Main Namespace.
Definition abi.hpp:18
Lightweight type-wrapper.
Definition as.hpp:29

Parameters

  • x : Type wrapper instance embedding the type of the constant.

Return value

The call eve::mzero(as<T>()) is semantically equivalent to T(-0.0).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_mzero() { return eve::mzero(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> mzero(as<wide_ft>()) = " << eve::mzero(eve::as<wide_ft>()) << std::endl
<< "-> mzero(as<wide_it>()) = " << eve::mzero(eve::as<wide_it>()) << std::endl
<< "-> mzero(as(wxf)) = " << eve::mzero(eve::as(wxf)) << std::endl
<< "-> mzero(as(wxi)) = " << eve::mzero(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> mzero(as<float>()) = " << eve::mzero(eve::as(float())) << std::endl
<< "-> mzero(as<std::int16_t>()) = " << eve::mzero(eve::as(std::int16_t())) << std::endl
<< "-> mzero(as<xf)) = " << eve::mzero(eve::as(xf)) << std::endl
<< "-> mzero(as<xi)) = " << eve::mzero(eve::as(xi)) << std::endl;
std::cout << "-> constexpr mzero = " << constexpr_mzero<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:86