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

◆ majorant

eve::majorant = functor<majorant_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T majorant(as<T> x) noexcept;
}
constexpr auto majorant
Computes a value x such that for any value y of the same type, is_not_greater(y, x) is true.
Definition majorant.hpp:69
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::majorant(as<T>()) is semantically equivalent to valmax for integral types and inf for floating-point types.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
template<typename T>
consteval auto constexpr_majorant() { return eve::majorant(eve::as<T>{}); }
int main()
{
std::cout << "---- simd" << '\n'
<< "-> majorant(as<wide_ft>() = " << eve::majorant(eve::as<wide_ft>()) << '\n'
<< "-> majorant(as<wide_it>() = " << eve::majorant(eve::as<wide_it>()) << '\n'
<< "-> majorant(as(x)) = " << eve::majorant(eve::as(x)) << '\n'
<< "-> majorant(as(y)) = " << eve::majorant(eve::as(y)) << '\n';
float xf;
std::int64_t xi;
std::cout << "---- scalar" << '\n'
<< "-> majorant(as<float>() = " << eve::majorant(eve::as<float>()) << '\n'
<< "-> majorant(as<std::int16_t>() = " << eve::majorant(eve::as<std::int16_t>()) << '\n'
<< "-> majorant(as(xf)) = " << eve::majorant(eve::as(xf)) << '\n'
<< "-> majorant(as(xi)) = " << eve::majorant(eve::as(xi)) << '\n';
std::cout << "-> constexpr majorant = " << constexpr_majorant<float>() << std::endl;
return 0;
}
Lightweight type-wrapper.
Definition as.hpp:29