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

◆ smallestposval

auto eve::smallestposval = functor<smallestposval_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T smallestposval(as<T> x) noexcept;
}
constexpr auto smallestposval
Computes the smallest normal positive value.
Definition smallestposval.hpp:70
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::smallestposval(as<T>()) is semantically equivalent to:

  • T(1) if eve::element_type_t<T> is integral
  • T(1.1754944e-38f) if eve::element_type_t<T> is float
  • T(2.225073858507201e-308) if eve::element_type_t<T> is double

Example

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