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

◆ twotonmb

auto eve::twotonmb = functor<twotonmb_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T twotonmb(as<T> x) noexcept;
}
constexpr auto twotonmb
Computes the 2 power of the number of mantissa bits of a floating value.
Definition twotonmb.hpp:67
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::twotonmb(as<T>()) is semantically equivalent to eve::exp2 (T(eve::nbmantissabits (as<eve::element_type_t<T>>())))

Example

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