E.V.E
v2022.09.01

◆ half

eve::half = {}
inlineconstexpr

Computes the constant \(1/2\).

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::floating_value T >
T half(as<T> x) noexcept;
}
constexpr callable_half_ half
Computes the constant .
Definition: half.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::half(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
<< "-> half(as<wide_ft>()) = " << eve::half(eve::as<wide_ft>()) << std::endl
<< "-> half(as(wxf)) = " << eve::half(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> half(as<float>()) = " << eve::half(eve::as(float())) << std::endl
<< "-> half(as<xf)) = " << eve::half(eve::as(xf)) << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65