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

◆ valmax

auto eve::valmax = functor<valmax_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T valmax(as<T> x) noexcept;
}
constexpr auto valmax
Computes the the greatest representable value.
Definition valmax.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::valmax(as<T>()) is semantically equivalent to T(std::numeric_limits<element_type_t<T>>::max())

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
template<typename T>
consteval auto constexpr_valmax() { return eve::valmax(eve::as<T>{}); }
int main()
{
wide_ft x{-1, -2, 3, 4};
wide_it y;
std::cout << "---- simd" << '\n'
<< "-> valmax(as<wide_ft>() = " << eve::valmax(eve::as<wide_ft>()) << '\n'
<< "-> valmax(as<wide_it>() = " << eve::valmax(eve::as<wide_it>()) << '\n'
<< "-> valmax(as(x)) = " << eve::valmax(eve::as(x)) << '\n'
<< "-> valmax(as(y)) = " << eve::valmax(eve::as(y)) << '\n'
<< "-> valmax[x > 0] = " << eve::valmax[x > 0](eve::as(x))<< '\n';
float xf;
std::int16_t xi;
std::cout << "---- scalar" << '\n'
<< "-> valmax(as<float>() = " << eve::valmax(eve::as<float>()) << '\n'
<< "-> valmax(as<std::int16_t>() = " << eve::valmax(eve::as<std::int16_t>()) << '\n'
<< "-> valmax(as(xf)) = " << eve::valmax(eve::as(xf)) << '\n'
<< "-> valmax(as(xi)) = " << eve::valmax(eve::as(xi)) << '\n';
std::cout << "-> constexpr valmax = " << constexpr_valmax<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:86