E.V.E
v2022.03.00

◆ mhalf

eve::mhalf = {}
inlineconstexpr

Computes the constant \(-1/2\).

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
T mhalf(as<T> x) noexcept;
}
constexpr callable_mhalf_ mhalf
Computes the constant .
Definition: mhalf.hpp:56
Definition: all_of.hpp:22
Lightweight type-wrapper.
Definition: as.hpp:29

Parameters

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

Return value

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

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> mhalf(as<wide_ft>()) = " << eve::mhalf(eve::as<wide_ft>()) << std::endl
<< "-> mhalf(as(wxf)) = " << eve::mhalf(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> mhalf(as<float>()) = " << eve::mhalf(eve::as(float())) << std::endl
<< "-> mhalf(as<xf)) = " << eve::mhalf(eve::as(xf)) << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65