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

◆ maxrepint

eve::maxrepint = functor<maxrepint_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T maxrepint(as<T> x) noexcept;
}
constexpr auto maxrepint
Computes the maximum representable integer value. Same as maxflint for floating types and valmax for ...
Definition maxrepint.hpp:71
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition translation.hpp:107
EVE Main Namespace.
Definition abi.hpp:19

Parameters

  • x : Type wrapper instance embedding the type of the constant.

Return value

The call eve::maxrepint(as<T>{}) is semantically equivalent to:

  • eve::maxflint(as<T>{}) if eve::element_type_t<T> is a floating point type.
  • eve::valmax(as<T>{}) if eve::element_type_t<T> is an integral type.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
template<typename T>
consteval auto constexpr_maxrepint() { return eve::maxrepint(eve::as<T>{}); }
int main()
{
std::cout << "---- simd" << std::endl
<< "-> maxrepint(as<wide<float>>()) = " << eve::maxrepint(eve::as<eve::wide<float>>()) << std::endl
<< "-> maxrepint(as<wide<int>>()) = " << eve::maxrepint(eve::as<eve::wide<int>>()) << std::endl;
std::cout << "---- scalar" << std::endl
<< "-> maxrepint(as<float>()) = " << std::setprecision(17) << eve::maxrepint(eve::as<float>{}) << std::endl
<< "-> maxrepint(as<int>()) = " << std::setprecision(17) << eve::maxrepint(eve::as<int>{}) << std::endl;
std::cout << "-> constexpr maxrepint = " << constexpr_maxrepint<float>() << std::endl;
}
Lightweight type-wrapper.
Definition as.hpp:29