E.V.E
v2022.03.00

◆ min

eve::min = {}
inlineconstexpr

Computes the minimum of its arguments.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T, eve::value... Ts >
eve::common_compatible_t<T, Ts...> min(T x, Ts ... xs) noexcept;
}
Definition: value.hpp:31
constexpr callable_min_ min
Computes the minimum of its arguments.
Definition: min.hpp:84
Definition: all_of.hpp:22

Parameters

Return value

The value of the minimum of the arguments is returned.

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'
<< "-> min(pf, qf) = " << eve::min(pf, qf) << '\n';
float xf = 1.0f;
float yf = eve::nan(eve::as<float>());
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> min(xf, yf) = = " << eve::min(xf, yf) << '\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:95
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

  • Masked Call

    The call eve::min[mask](x, ...) provides a masked version of min which is equivalent to if_else(mask, min(x, ...), x)

    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'
    << "-> min[pf < 0](pf, qf) = " << eve::min[pf < 0](pf, qf) << '\n';
    return 0;
    }
  • eve::pedantic, eve::numeric

    • The call pedantic(min)(x,args,...) ensures the conformity to the standard behaviour, that is for two parameters (on an elementwise basis) to be semantically equivalent to: (x < y) ? x : y and this behaviour is also ensured on n parameters calls as if this scheme was recursively used.
    • The call numeric(min)(x,args,...) ensures that if any element of the inputs is not a Nan, the corresponding output element will not be a Nan.

    Example