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

◆ half

auto eve::half = functor<half_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T half(as<T> x) noexcept;
}
constexpr auto half
Computes the constant .
Definition half.hpp:66
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::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>;
template<typename T>
consteval auto constexpr_half() { return eve::half(eve::as<T>{}); }
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;
std::cout << "-> constexpr half = " << constexpr_half<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:70