E.V.E  0.1-beta

◆ mhalf

eve::mhalf = {}
inlineconstexpr

Callable object computing the value negated half value.

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

Member Effect
operator() Computes the mhalf constant

tempate < floating_value T > T operator()( as<T> const & t) const noexcept;
Lightweight type-wrapper.
Definition: as.hpp:29

Parameters

t: 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

See it live on Compiler Explorer

#include <eve/constant/mhalf.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;
}
constexpr callable_mhalf_ mhalf
Callable object computing the value negated half value.
Definition: mhalf.hpp:53
Wrapper for SIMD registers.
Definition: wide.hpp:65