E.V.E
v2023.02.15

◆ minmax

eve::minmax = {}
inlineconstexpr

Computes the minimum and maximum of its arguments.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::value T, eve::value... Ts >
auto minmax(T x, Ts ... xs) noexcept;
}
Definition: value.hpp:31
constexpr callable_minmax_ minmax
Computes the minimum and maximum of its arguments.
Definition: minmax.hpp:66
Definition: abi.hpp:18

Parameters

Return value

A tuple containing the value of the minimum and the maximum of the arguments.

Note
  • If any element of the inputs is a Nan, the corresponding output element is system-dependent.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f, -2.0f, 2.0f,
wide_ft qf = {4.0f, 1.0f, -1.0f, 0.0f, eve::nan(eve::as<float>()),
-0.0f, eve::nan(eve::as<float>()), -2.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> minmax(pf, qf) = " << eve::minmax(pf, qf) << '\n';
float xf = 1.0f;
float yf = eve::nan(eve::as<float>());
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> minmax(xf, yf) = = " << eve::minmax(xf, yf) << '\n';
auto k = kumi::tuple{pf, qf, pf+qf, 1};
std::cout << "---- multi parameters" << '\n'
<< " -> minmax(k) = " << eve::minmax(k) << '\n'
<< " -> minmax(kumi::tuple{pf, pf, 1}) = " << eve::minmax( kumi::tuple{pf, qf, 1}) << '\n'
<< " -> minmax(kumi::tuple{1, pf, pf}) = " << eve::minmax( kumi::tuple{1, pf, qf}) << '\n'
<< " -> minmax(kumi::tuple{pf, 1.0f) = " << eve::minmax( kumi::tuple{pf, 1.0f}) << '\n'
<< " -> minmax(kumi::tuple{1.0f, pf) = " << eve::minmax( kumi::tuple{1.0f, pf}) << '\n';
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr callable_minf_ minf
Computes the -infinity ieee value.
Definition: minf.hpp:60
constexpr callable_inf_ inf
Computes the infinity ieee value.
Definition: inf.hpp:58
constexpr pedantic_type const pedantic
Higher-order Callable Object imbuing more standard semantic onto other Callable Objects.
Definition: pedantic.hpp:56
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers