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

Detailed Description

Builds a floating-point constant from the exact representation it must take in each precision.

Basic useful constants (scalar and SIMD)

All EVE constants can be called in four ways:

  • ct(eve::as<T>()) where T is the wished constant type
  • ct(eve::as(t)) where t is an instance of a type T
  • ct[cond](...) where cond is a conditional expression.
  • upper, lower decorators can also been used (see the note below).

Here ct denotes the constant name.

When the condition is present and evaluate to false the result element default to zero, but this behavior can be changed if the condition is expressed by an if_(...).else_(...) clause.

Note
For mathematic constants whose value is (perhaps) not exactly represented in the floating point type used, the regular call provides the value rounded to nearest even, but the semantic modifiyers upper and lower can be used to provide values guaranteed to be greater or equal (respectively less or equal) to the real mathematical value. For instance the regular nearest values of \(\pi\) for float and double are greater (resp. less) than the mathematical value.

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<auto D, auto F, floating_value T>
constexpr T ieee_constant(as<T> target) noexcept; // 1
template<auto D, auto F, auto F16, floating_value T>
constexpr T ieee_constant(as<T> target) noexcept; // 2
}
EVE Main Namespace.
Definition abi.hpp:19

Template Parameters

  • D: value used when the element type of T is double.
  • F: value used when the element type of T is float.
  • F16: value used when the element type of T is float16.

Parameters

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

Return value

  1. T(D) if the element type of T is double, T(F) otherwise. A float16 result is therefore built from F, which costs a conversion.
  2. T(D), T(F) or T(F16) depending on the element type of T, so float16 gets its own exact value.
Note
Each value is meant to be written in hexadecimal floating-point notation, which pins the bit pattern exactly. A decimal literal would leave the last bits to the compiler's conversion, and the constant would differ between precisions.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
using wide_dt = eve::wide<double>;
int main()
{
auto targetwf = eve::as<wide_ft>{};
auto targetwd = eve::as<wide_dt>{};
std::cout << "---- simd" << std::setprecision(15) << std::endl
<< "-> ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f)(targetwf) " << eve::ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f>(targetwf)<< std::endl
<< "-> ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f>(targetwd) " << eve::ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f>(targetwd)<< std::endl;
auto targetf = eve::as<float>{};
auto targetd = eve::as<double>{};
std::cout << "---- scalar" << std::endl
<< "-> ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f)(targetf) " << eve::ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f>(targetf)<< std::endl
<< "-> ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f>(targetd) " << eve::ieee_constant<0x1.3bd3cc9be45dep-1, 0x1.3bd3ce0p-1f>(targetd)<< std::endl;
return 0;
}
Lightweight type-wrapper.
Definition as.hpp:29
Wrapper for SIMD registers.
Definition wide.hpp:94

Variables

constexpr auto eve::allbits = functor<allbits_t>
 Computes a constant with all bits set.
constexpr auto eve::bitincrement = functor<bitincrement_t>
 Computes a constant with only the least significant bit set.
constexpr auto eve::eps = functor<eps_t>
 Computes a constant to the machine epsilon.
constexpr auto eve::exponentmask = functor<exponentmask_t>
 Computes the exponent bit mask of IEEE float or double.
constexpr auto eve::false_ = functor<false_t>
 Computes the false logical value.
constexpr auto eve::half = functor<half_t>
 Computes the constant \(1/2\).
constexpr auto eve::inf = functor<inf_t>
 Computes the infinity ieee value.
constexpr auto eve::iota = functor<iota_t>
 all numbers from 0 to size() - 1. equivalent to T{ [](int i, int) {return i; } }
constexpr auto eve::logeps = functor<logeps_t>
 Computes the natural logarithm of the machine epsilon.
constexpr auto eve::majorant = functor<majorant_t>
 Computes a value x such that for any value y of the same type, is_not_greater(y, x) is true.
constexpr auto eve::mantissamask = functor<mantissamask_t>
 Computes the mask to extract the mantissa bits of an ieee floating value.
constexpr auto eve::max_safe_integer = functor<max_safe_integer_t>
 Computes the greatest floating point representing an integer such that n != n+1.
constexpr auto eve::maxexponent = functor<maxexponent_t>
 Computes the greatest exponent of a floating point IEEE value.
constexpr auto eve::maxexponentm1 = functor<maxexponentm1_t>
 Computes the greatest exponent of a floating point IEEE value minus one.
constexpr auto eve::maxexponentp1 = functor<maxexponentp1_t>
 Computes the greatest exponent of a floating point IEEE value plus one.
constexpr auto eve::maxflint = functor<maxflint_t>
 Computes the smallest floating point representing an integer such that n == n+1.
constexpr auto eve::maxrepint = functor<maxrepint_t>
 Computes the maximum representable integer value. Same as maxflint for floating types and valmax for integral types.
constexpr auto eve::mhalf = functor<mhalf_t>
 Computes the constant \(-1/2\).
constexpr auto eve::mindenormal = functor<mindenormal_t>
 Computes the smallest denormal positive value.
constexpr auto eve::minexponent = functor<minexponent_t>
 Computes the least exponent of a floating point IEEE value.
constexpr auto eve::minf = functor<minf_t>
 Computes the -infinity ieee value.
constexpr auto eve::minorant = functor<minorant_t>
 Computes a value x such that for any value y of the same type, is_not_less(y, x) is true.
constexpr auto eve::mone = functor<mone_t>
 Computes the constant \(-1\).
constexpr auto eve::mzero = functor<mzero_t>
 Computes the negative zero value.
constexpr auto eve::nan = functor<nan_t>
 Computes the IEEE quiet NaN constant.
constexpr auto eve::nbmantissabits = functor<nbmantissabits_t>
 Returns the number of mantissa bits of a floating point value.
constexpr auto eve::one = functor<one_t>
 Computes the constant \(1\).
constexpr auto eve::oneosqrteps = functor<oneosqrteps_t>
 Computes the inverse of the square root of the machine epsilon.
constexpr auto eve::signmask = functor<signmask_t>
 Computes a value in which the most significant bit is the only bit set.
constexpr auto eve::smallestposval = functor<smallestposval_t>
 Computes the smallest normal positive value.
constexpr auto eve::sqrteps = functor<sqrteps_t>
 Computes the square root of the machine epsilon.
constexpr auto eve::sqrtsmallestposval = functor<sqrtsmallestposval_t>
 Computes the square root of the eve::smallestposval.
constexpr auto eve::sqrtvalmax = functor<sqrtvalmax_t>
 Computes the greatest value less than the square root of eve::valmax.
constexpr auto eve::true_ = functor<true_t>
 Computes the logical true_ value.
constexpr auto eve::twotonmb = functor<twotonmb_t>
 Computes the 2 power of the number of mantissa bits of a floating value.
constexpr auto eve::valmax = functor<valmax_t>
 Computes the greatest representable value.
constexpr auto eve::valmin = functor<valmin_t>
 Computes the lowest representable value.
constexpr auto eve::zero = functor<zero_t>
 Computes the constant 0.
constexpr auto eve::oneotwoeps = functor<oneotwoeps_t>
 Computes a constant to the machine oneotwoepsilon.

Variable Documentation

◆ allbits

auto eve::allbits = functor<allbits_t>
inlineconstexpr

Computes a constant with all bits set.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T allbits(as<T> x) noexcept;
}
constexpr auto allbits
Computes a constant with all bits set.
Definition allbits.hpp:68

Parameters

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

Return value

The call eve::allbits(as<T>()) returns a value of type T with all bits set.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_allbits() { return eve::allbits(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << '\n'
<< "-> allbits(as<wide_ft>()) = " << eve::allbits(eve::as<wide_ft>()) << '\n'
<< "-> allbits(as<wide_it>()) = " << eve::allbits(eve::as<wide_it>()) << '\n'
<< "-> allbits(as(wxf)) = " << eve::allbits(eve::as(wxf)) << '\n'
<< "-> allbits(as(wxi)) = " << eve::allbits(eve::as(wxi)) << '\n';
float xf;
std::int16_t xi;
std::cout << "---- scalar" << '\n'
<< "-> allbits(as<float>()) = " << eve::allbits(eve::as<float>()) << '\n'
<< "-> allbits(as<std::int16_t>()) = " << eve::allbits(eve::as<std::int16_t>()) << '\n'
<< "-> allbits(as<xf)) = " << eve::allbits(eve::as(xf)) << '\n'
<< "-> allbits(as<xi)) = " << eve::allbits(eve::as(xi)) << '\n';
std::cout << "-> constexpr allbits = " << constexpr_allbits<float>() << std::endl;
return 0;
}

◆ bitincrement

auto eve::bitincrement = functor<bitincrement_t>
inlineconstexpr

Computes a constant with only the least significant bit set.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::plain_value T > constexpr T bitincrement(as<T> x) noexcept;
}
constexpr auto bitincrement
Computes a constant with only the least significant bit set.
Definition bitincrement.hpp:69

Parameters

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

Return value

The call eve::bitincrement(as<T>()) returns a value of type T with only the least significant bit set.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_bitincrement() { return eve::bitincrement(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << '\n'
<< "-> bitincrement(as<wide_ft>()) = " << eve::bitincrement(eve::as<wide_ft>()) << '\n'
<< "-> bitincrement(as<wide_it>()) = " << eve::bitincrement(eve::as<wide_it>()) << '\n'
<< "-> bitincrement(as(wxf)) = " << eve::bitincrement(eve::as(wxf)) << '\n'
<< "-> bitincrement(as(wxi)) = " << eve::bitincrement(eve::as(wxi)) << '\n';
float xf;
std::int16_t xi;
std::cout << "---- scalar" << '\n'
<< "-> bitincrement(as<float>()) = " << eve::bitincrement(eve::as<float>()) << '\n'
<< "-> bitincrement(as<std::int16_t>()) = " << eve::bitincrement(eve::as<std::int16_t>()) << '\n'
<< "-> bitincrement(as<xf)) = " << eve::bitincrement(eve::as(xf)) << '\n'
<< "-> bitincrement(as<xi)) = " << eve::bitincrement(eve::as(xi)) << '\n';
std::cout << "-> constexpr bitincrement = " << constexpr_bitincrement<float>() << std::endl;
return 0;
}

◆ eps

auto eve::eps = functor<eps_t>
inlineconstexpr

Computes a constant to the machine epsilon.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T eps(as<T> x) noexcept;
}
constexpr auto eps
Computes a constant to the machine epsilon.
Definition eps.hpp:74

Parameters

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

Return value

The call eve::eps(as<T>()) returns elementwise, the smallest positive value x of the type such that 1+x != x.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_dt = eve::wide<double>;
template<typename T>
consteval auto constexpr_eps() { return eve::eps(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_dt wxi;
std::cout << "---- simd" << '\n'
<< "-> eps(as<wide_ft>()) = " << eve::eps(eve::as<wide_ft>()) << '\n'
<< "-> eps(as<wide_dt>()) = " << eve::eps(eve::as<wide_dt>()) << '\n'
<< "-> eps(as(wxf)) = " << eve::eps(eve::as(wxf)) << '\n'
<< "-> eps(as(wxi)) = " << eve::eps(eve::as(wxi)) << '\n';
float xf;
double xd;
std::cout << "---- scalar" << '\n'
<< "-> eps(as<float>()) = " << eve::eps(eve::as<float>()) << '\n'
<< "-> eps(as<double>()) = " << eve::eps(eve::as<double>()) << '\n'
<< "-> eps(as(xf)) = " << eve::eps(eve::as(xf)) << '\n'
<< "-> eps(as(xd)) = " << eve::eps(eve::as(xd)) << '\n';
std::cout << "-> constexpr eps = " << constexpr_eps<float>() << std::endl;
return 0;
}

◆ exponentmask

auto eve::exponentmask = functor<exponentmask_t>
inlineconstexpr

Computes the exponent bit mask of IEEE float or double.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr eve::as_integer_t<T> exponentmask(as<T> t) noexcept;
}
constexpr auto exponentmask
Computes the exponent bit mask of IEEE float or double.
Definition exponentmask.hpp:72

Parameters

t: Type wrapper instance embedding the type of the constant.

Return value

the call eve::exponentmask(as<T>()) returns elementwise, the integral mask to extract the exponent bits of an ieee floating value. The element values are:

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_exponentmask() { return eve::exponentmask(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> exponentmask(as<wide_ft>()) = " << eve::exponentmask(eve::as<wide_ft>()) << std::endl
<< "-> exponentmask(as(wxf)) = " << eve::exponentmask(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> exponentmask(as<float>()) = " << eve::exponentmask(eve::as(float())) << std::endl
<< "-> exponentmask(as<xf)) = " << eve::exponentmask(eve::as(xf)) << std::endl;
std::cout << "-> constexpr exponentmask = " << constexpr_exponentmask<float>() << std::endl;
return 0;
}

◆ false_

auto eve::false_ = functor<false_t>
inlineconstexpr

Computes the false logical value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr eve::as_logical<T> false_(as<T> x) noexcept;
}
constexpr auto false_
Computes the false logical value.
Definition false.hpp:66

Parameters

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

Return value

The call eve::false_(as<T>()) returns the false logical value for type T.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_false_() { return eve::false_(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> false_(as<wide_ft>()) = " << eve::false_(eve::as<wide_ft>()) << std::endl
<< "-> false_(as<wide_it>()) = " << eve::false_(eve::as<wide_it>()) << std::endl
<< "-> false_(as(wxf)) = " << eve::false_(eve::as(wxf)) << std::endl
<< "-> false_(as(wxi)) = " << eve::false_(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> false_(as<float>()) = " << eve::false_(eve::as(float())) << std::endl
<< "-> false_(as<std::int16_t>()) = " << eve::false_(eve::as(std::int16_t())) << std::endl
<< "-> false_(as<xf)) = " << eve::false_(eve::as(xf)) << std::endl
<< "-> false_(as<xi)) = " << eve::false_(eve::as(xi)) << std::endl;
std::cout << "-> constexpr false_ = " << constexpr_false_<float>() << std::endl;
return 0;
}

◆ half

auto eve::half = functor<half_t>
inlineconstexpr

Computes the constant \(1/2\).

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T half(as<T> x) noexcept;
}
constexpr auto half
Computes the constant .
Definition half.hpp:67

Parameters

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

    Return value

    The call eve::half(as<T>()) is semantically equivalent to T(0.5).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_half() { return eve::half(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> half(as<wide_ft>()) = " << eve::half(eve::as<wide_ft>()) << std::endl
<< "-> half(as(wxf)) = " << eve::half(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> half(as<float>()) = " << eve::half(eve::as(float())) << std::endl
<< "-> half(as<xf)) = " << eve::half(eve::as(xf)) << std::endl;
std::cout << "-> constexpr half = " << constexpr_half<float>() << std::endl;
return 0;
}

◆ inf

auto eve::inf = functor<inf_t>
inlineconstexpr

Computes the infinity ieee value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T inf(as<T> x);
}
constexpr auto inf
Computes the infinity ieee value.
Definition inf.hpp:67

Parameters

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

Return value

The call eve::inf(as<T>()) is semantically equivalent to T(std::numeric_limits<eve::element_type_t<T>>::``infinity())

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_inf() { return eve::inf(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> inf(as<wide_ft>()) = " << eve::inf(eve::as<wide_ft>()) << std::endl
<< "-> inf(as(wxf)) = " << eve::inf(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> inf(as<float>()) = " << eve::inf(eve::as(float())) << std::endl
<< "-> inf(as<xf)) = " << eve::inf(eve::as(xf)) << std::endl;
std::cout << "-> constexpr inf = " << constexpr_inf<float>() << std::endl;
return 0;
}

◆ iota

auto eve::iota = functor<iota_t>
inlineconstexpr

all numbers from 0 to size() - 1. equivalent to T{ [](int i, int) {return i; } }

See also
eve::views::iota if you want a view.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template < eve::conditional_expr C
, eve::arithmetic_simd_value T
>
T iota[C cond](as<T> tgt);
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
constexpr auto iota
all numbers from 0 to size() - 1. equivalent to T{ [](int i, int) {return i; } }
Definition iota.hpp:69

Parameters

  • tgt : Type wrapper - type of the resulting
  • cond : (optional) - a way to replace undesired elements If no alternative is provided - returns eve::zero(tgt) for disabled elements.

Return value

  • T{0, 1, ...}

Example

#include <eve/module/core.hpp>
#include <tts/tts.hpp>
using n = eve::fixed<4>;
using i32s = eve::wide<int, n>;
using f64s = eve::wide<double, n>;
template<typename T>
concept iota_supports = std::invocable<decltype(eve::iota), eve::as<T>>;
// See below - maybe this is what you are looking for?
void how_to_keep_track_of_index();
int main()
{
how_to_keep_track_of_index();
// basic ints
{
i32s expected {0, 1, 2, 3};
i32s actual = eve::iota(eve::as<i32s> {});
TTS_EXPECT(eve::all(expected == actual));
}
// floats
{
f64s expected {0.0, 1.0, 2.0, 3.0};
f64s actual = eve::iota(eve::as<f64s> {});
TTS_EXPECT(eve::all(expected == actual));
}
// doesn't work for
{
static_assert(!iota_supports<eve::logical<i32s>>);
static_assert(!iota_supports<eve::logical<int>>);
}
// conditional
{
auto tgt = eve::as<i32s> {};
const auto actual0 = eve::iota[eve::ignore_last(2)](tgt);
const auto actual1 = eve::iota[eve::ignore_last(2).else_(5)](tgt);
TTS_EXPECT(eve::all(actual0 == i32s {0, 1, 0, 0}));
TTS_EXPECT(eve::all(actual1 == i32s {0, 1, 5, 5}));
const auto m = eve::logical<i32s> {true, true, false, false};
const auto actual2 = eve::iota[m](tgt);
const auto actual3 = eve::iota[eve::if_(m).else_(5)](tgt);
TTS_EXPECT(eve::all(actual2 == i32s {0, 1, 0, 0}));
TTS_EXPECT(eve::all(actual3 == i32s {0, 1, 5, 5}));
}
}
#include <eve/module/algo.hpp>
void
how_to_keep_track_of_index()
{
// There is a good chance you found this doc because
// you wanted to enumerate all elements in a sequence.
// It is harder then you might think in a general case.
// If you need to do it for small types (such as vector of chars or shorts)
// look at `eve::algo::for_each_iteration_fixed_overflow`.
// There is no docs for that at this point, because it is very clumsy.
// If you don't care about overflow, just zip with iota view.
// Example: for (int i = 0; auto& x : v) x = (i++) * 2;
{
std::vector<int> v;
v.resize(10);
eve::views::iota(0), v, [](eve::like<int> auto idx) { return idx + idx; });
TTS_EQUAL(v, std::vector<int>({0, 2, 4, 6, 8, 10, 12, 14, 16, 18}));
}
// Example: imperfect for (int i = 0; auto& x : v) x = x << i;
{
std::vector<int> v(5u, 1);
// Here, because we pass v twice, it will not be as perfect as it can but
// it has advantage of being very simple.
eve::algo::transform_to(eve::views::zip(v, eve::views::iota(0)),
v,
[](auto input_idx)
{
auto [input, idx] = input_idx;
return input << idx;
});
TTS_EQUAL(v, std::vector<int>({1, 2, 4, 8, 16}));
}
// Example: handwriting for (int i = 0; auto& x : v) x = x << i;
{
std::vector<int> v(5u, 1);
eve::algo::for_each(eve::views::zip(v, eve::views::iota(0)),
[](eve::algo::iterator auto it, eve::relative_conditional_expr auto ignore)
{
auto [elements_it, index_it] = it;
eve::like<int> auto elements = eve::load[ignore](elements_it);
eve::like<int> auto idxs = eve::load[ignore](index_it);
elements <<= idxs;
eve::store[ignore](elements, elements_it);
});
TTS_EQUAL(v, std::vector<int>({1, 2, 4, 8, 16}));
}
}
Specifies semantic compatibility between wrapper/wrapped types.
Definition product_type.hpp:101
Specifies that a type is a Conditional Expression using relative mask.
Definition conditional.hpp:52
constexpr auto for_each
a basic for_each algorithm.
Definition for_each.hpp:73
constexpr auto transform_to
SIMD version of std::transform.
Definition transform.hpp:112
constexpr auto all
Computes a bool value which is true if and only if every elements of x evaluates to true.
Definition all.hpp:95
constexpr auto store
Store the elements of a SIMD value into the given memory location.
Definition store.hpp:80
constexpr auto load
Loads data from a pointer or a pair of iterators into a SIMD value.
Definition load.hpp:71
SIMD register cardinal type.
Definition cardinals.hpp:39
Extensible wrapper for SIMD conditional.
Definition conditional.hpp:111
auto else_(V const &v) const
Extends a conditional expression with an alternative value.
Definition conditional.hpp:123
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:361
constexpr auto else_(V const &v) const
Extends a conditional expression with an alternative value.
Definition conditional.hpp:355

◆ logeps

auto eve::logeps = functor<logeps_t>
inlineconstexpr

Computes the natural logarithm of the machine epsilon.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T logeps(as<T> x);
}
constexpr auto logeps
Computes the natural logarithm of the machine epsilon.
Definition logeps.hpp:68

Parameters

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

Return value

The call eve::logeps(as<T>()) is semantically equivalent to eve::log (eve::eps (eve::as<T>())).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_logeps() { return eve::logeps(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> logeps(as<wide_ft>()) = " << eve::logeps(eve::as<wide_ft>()) << std::endl
<< "-> logeps(as(wxf)) = " << eve::logeps(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> logeps(as<float>()) = " << eve::logeps(eve::as(float())) << std::endl
<< "-> logeps(as<xf)) = " << eve::logeps(eve::as(xf)) << std::endl;
std::cout << "-> constexpr logeps = " << constexpr_logeps<float>() << std::endl;
return 0;
}

◆ majorant

auto eve::majorant = functor<majorant_t>
inlineconstexpr

Computes a value x such that for any value y of the same type, is_not_greater(y, x) is true.

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

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()
{
wide_ft x;
wide_it y;
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;
}

◆ mantissamask

auto eve::mantissamask = functor<mantissamask_t>
inlineconstexpr

Computes the mask to extract the mantissa bits of an ieee floating value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr eve::as_uinteger_t<T> mantissamask(as<T> x);
}
constexpr auto mantissamask
Computes the mask to extract the mantissa bits of an ieee floating value.
Definition mantissamask.hpp:73

Parameters

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

Return value

The call eve::mantissamask(as<T>()) returns elementwise, the integral mask to extract the mantissa bits of an ieee floating value. The element values are:

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_mantissamask() { return eve::mantissamask(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> mantissamask(as<wide_ft>()) = " << eve::mantissamask(eve::as<wide_ft>()) << std::endl
<< "-> mantissamask(as(wxf)) = " << eve::mantissamask(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> mantissamask(as<float>()) = " << eve::mantissamask(eve::as(float())) << std::endl
<< "-> mantissamask(as<xf)) = " << eve::mantissamask(eve::as(xf)) << std::endl;
std::cout << "-> constexpr mantissamask = " << constexpr_mantissamask<float>() << std::endl;
return 0;
}

◆ max_safe_integer

auto eve::max_safe_integer = functor<max_safe_integer_t>
inlineconstexpr

Computes the greatest floating point representing an integer such that n != n+1.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T max_safe_integer(as<T> x) noexcept;
}
constexpr auto max_safe_integer
Computes the greatest floating point representing an integer such that n != n+1.
Definition max_safe_integer.hpp:70

Parameters

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

Return value

The call eve::max_safe_integer(as<T>()) is semantically equivalent to:

  • T(2047.0f) if eve::element_type_t<T> is float16.
  • T(16777215.0f) if eve::element_type_t<T> is float.
  • T(9007199254740991.0) if eve::element_type_t<T> is double.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_max_safe_integer() { return eve::max_safe_integer(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> max_safe_integer(as<wide_ft>()) = " << eve::max_safe_integer(eve::as<wide_ft>()) << std::endl
<< "-> max_safe_integer(as(wxf)) = " << eve::max_safe_integer(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> max_safe_integer(as<float>()) = " << std::setprecision(17) << eve::max_safe_integer(eve::as(float())) << std::endl
<< "-> max_safe_integer(as<xf)) = " << std::setprecision(17) << eve::max_safe_integer(eve::as(xf)) << std::endl;
std::cout << "-> constexpr max_safe_integer = " << constexpr_max_safe_integer<float>() << std::endl;
return 0;
}

◆ maxexponent

auto eve::maxexponent = functor<maxexponent_t>
inlineconstexpr

Computes the greatest exponent of a floating point IEEE value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr eve::as_integer<T> maxexponent(as<T> x);
}
constexpr auto maxexponent
Computes the greatest exponent of a floating point IEEE value.
Definition maxexponent.hpp:71

Parameters

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

Return value

the call eve::maxexponent(as<T>()) is semantically equivalent to

  • as_integer_t<T>(127) if eve::element_type_t<T> is float
  • as_integer_t<T>(1023) if eve::element_type_t<T> is double

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_maxexponent() { return eve::maxexponent(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> maxexponent(as<wide_ft>()) = " << eve::maxexponent(eve::as<wide_ft>()) << std::endl
<< "-> maxexponent(as(wxf)) = " << eve::maxexponent(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> maxexponent(as<float>()) = " << eve::maxexponent(eve::as(float())) << std::endl
<< "-> maxexponent(as<xf)) = " << eve::maxexponent(eve::as(xf)) << std::endl;
std::cout << "-> constexpr maxexponent = " << constexpr_maxexponent<float>() << std::endl;
return 0;
}

◆ maxexponentm1

auto eve::maxexponentm1 = functor<maxexponentm1_t>
inlineconstexpr

Computes the greatest exponent of a floating point IEEE value minus one.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plafloating_valuein_value T> constexpr eve::as_integer_t<T> maxexponentm1m1(as<T> x);
}

Parameters

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

Return value

the call eve::maxexponentm1(as<T>()) is semantically equivalent to

  • as_integer_t<T>(126) if eve::element_type_t<T> is float
  • as_integer_t<T>(1022) if eve::element_type_t<T> is double

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_maxexponentm1() { return eve::maxexponentm1(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> maxexponentm1(as<wide_ft>()) = " << eve::maxexponentm1(eve::as<wide_ft>()) << std::endl
<< "-> maxexponentm1(as(wxf)) = " << eve::maxexponentm1(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> maxexponentm1(as<float>()) = " << eve::maxexponentm1(eve::as(float())) << std::endl
<< "-> maxexponentm1(as<xf)) = " << eve::maxexponentm1(eve::as(xf)) << std::endl;
std::cout << "-> constexpr maxexponentm1 = " << constexpr_maxexponentm1<float>() << std::endl;
return 0;
}
constexpr auto maxexponentm1
Computes the greatest exponent of a floating point IEEE value minus one.
Definition maxexponentm1.hpp:71

◆ maxexponentp1

auto eve::maxexponentp1 = functor<maxexponentp1_t>
inlineconstexpr

Computes the greatest exponent of a floating point IEEE value plus one.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr eve::as_integer<T> maxexponentp1(as<T> x);
}
constexpr auto maxexponentp1
Computes the greatest exponent of a floating point IEEE value plus one.
Definition maxexponentp1.hpp:71

Parameters

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

Return value

the call eve::maxexponentp1(as<T>()) is semantically equivalent to

  • as_integer_t<T>(128) if eve::element_type_t<T> is float
  • as_integer_t<T>(1024) if eve::element_type_t<T> is double

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_maxexponentp1() { return eve::maxexponentp1(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> maxexponentp1(as<wide_ft>()) = " << eve::maxexponentp1(eve::as<wide_ft>()) << std::endl
<< "-> maxexponentp1(as(wxf)) = " << eve::maxexponentp1(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> maxexponentp1(as<float>()) = " << eve::maxexponentp1(eve::as(float())) << std::endl
<< "-> maxexponentp1(as<xf)) = " << eve::maxexponentp1(eve::as(xf)) << std::endl;
std::cout << "-> constexpr maxexponentp1 = " << constexpr_maxexponentp1<float>() << std::endl;
return 0;
}

◆ maxflint

auto eve::maxflint = functor<maxflint_t>
inlineconstexpr

Computes the smallest floating point representing an integer such that n == n+1.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T maxflint(as<T> x) noexcept;
}
constexpr auto maxflint
Computes the smallest floating point representing an integer such that n == n+1.
Definition maxflint.hpp:70

Parameters

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

Return value

The call eve::maxflint(as<T>()) is semantically equivalent to:

  • T(2048.0f) if eve::element_type_t<T> is float16.
  • T(16777216.0f) if eve::element_type_t<T> is float.
  • T(9007199254740992.0) if eve::element_type_t<T> is double.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_maxflint() { return eve::maxflint(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> maxflint(as<wide_ft>()) = " << eve::maxflint(eve::as<wide_ft>()) << std::endl
<< "-> maxflint(as(wxf)) = " << eve::maxflint(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> maxflint(as<float>()) = " << std::setprecision(17) << eve::maxflint(eve::as(float())) << std::endl
<< "-> maxflint(as<xf)) = " << std::setprecision(17) << eve::maxflint(eve::as(xf)) << std::endl;
std::cout << "-> constexpr maxflint = " << constexpr_maxflint<float>() << std::endl;
return 0;
}

◆ maxrepint

auto eve::maxrepint = functor<maxrepint_t>
inlineconstexpr

Computes the maximum representable integer value. Same as maxflint for floating types and valmax for integral types.

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

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;
}

◆ mhalf

auto eve::mhalf = functor<mhalf_t>
inlineconstexpr

Computes the constant \(-1/2\).

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T mhalf(as<T> x) noexcept;
}
constexpr auto mhalf
Computes the constant .
Definition mhalf.hpp:67

Parameters

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

    Return value

    The call eve::mhalf(as<T>()) is semantically equivalent to T(-0.5).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_mhalf() { return eve::mhalf(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> mhalf(as<wide_ft>()) = " << eve::mhalf(eve::as<wide_ft>()) << std::endl
<< "-> mhalf(as(wxf)) = " << eve::mhalf(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> mhalf(as<float>()) = " << eve::mhalf(eve::as(float())) << std::endl
<< "-> mhalf(as<xf)) = " << eve::mhalf(eve::as(xf)) << std::endl;
std::cout << "-> constexpr mhalf = " << constexpr_mhalf<float>() << std::endl;
return 0;
}

◆ mindenormal

auto eve::mindenormal = functor<mindenormal_t>
inlineconstexpr

Computes the smallest denormal positive value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T mindenormal(as<T> x) noexcept;
}
constexpr auto mindenormal
Computes the smallest denormal positive value.
Definition mindenormal.hpp:71

Parameters

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

Return value

The call eve::mindenormal(as<T>()) is semantically equivalent to:

  • T(1) if eve::element_type_t<T> is integral
  • T(1.4013e-45f) if eve::element_type_t<T> is float
  • T(4.94066e-324) if eve::element_type_t<T> is double

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_mindenormal() { return eve::mindenormal(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> mindenormal(as<wide_ft>()) = " << eve::mindenormal(eve::as<wide_ft>()) << std::endl
<< "-> mindenormal(as(wxf)) = " << eve::mindenormal(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> mindenormal(as<float>()) = " << eve::mindenormal(eve::as(float())) << std::endl
<< "-> mindenormal(as<xf)) = " << eve::mindenormal(eve::as(xf)) << std::endl;
std::cout << "-> constexpr mindenormal = " << constexpr_mindenormal<float>() << std::endl;
return 0;
}

◆ minexponent

auto eve::minexponent = functor<minexponent_t>
inlineconstexpr

Computes the least exponent of a floating point IEEE value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr eve::as_integer_t<T> minexponent(as<T> x) noexcept;
}
constexpr auto minexponent
Computes the least exponent of a floating point IEEE value.
Definition minexponent.hpp:71

Parameters

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

Return value

The call eve::minexponent(as<T>()) is semantically equivalent to

  • as_integer_t<T>(-126) if eve::element_type_t<T> is float
  • as_integer_t<T>(-1022) if eve::element_type_t<T> is double

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_minexponent() { return eve::minexponent(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> minexponent(as<wide_ft>()) = " << eve::minexponent(eve::as<wide_ft>()) << std::endl
<< "-> minexponent(as(wxf)) = " << eve::minexponent(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> minexponent(as<float>()) = " << eve::minexponent(eve::as(float())) << std::endl
<< "-> minexponent(as<xf)) = " << eve::minexponent(eve::as(xf)) << std::endl;
std::cout << "-> constexpr minexponent = " << constexpr_minexponent<float>() << std::endl;
return 0;
}

◆ minf

auto eve::minf = functor<minf_t>
inlineconstexpr

Computes the -infinity ieee value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<floating_value> constexpr T minf(as<T> x) noexcept;
}
constexpr auto minf
Computes the -infinity ieee value.
Definition minf.hpp:67

Parameters

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

Return value

The call eve::minf(as<T>()) is semantically equivalent to T(-std::numeric_limits<eve::element_type_t<T>>::infinity())

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_minf() { return eve::minf(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> minf(as<wide_ft>()) = " << eve::minf(eve::as<wide_ft>()) << std::endl
<< "-> minf(as(wxf)) = " << eve::minf(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> minf(as<float>()) = " << eve::minf(eve::as(float())) << std::endl
<< "-> minf(as<xf)) = " << eve::minf(eve::as(xf)) << std::endl;
std::cout << "-> constexpr minf = " << constexpr_minf<float>() << std::endl;
return 0;
}

◆ minorant

auto eve::minorant = functor<minorant_t>
inlineconstexpr

Computes a value x such that for any value y of the same type, is_not_less(y, x) is true.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T minorant(as<T> x) noexcept;
}
constexpr auto minorant
Computes a value x such that for any value y of the same type, is_not_less(y, x) is true.
Definition minorant.hpp:69

Parameters

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

Return value

The call eve::minorant(as<T>()) is semantically equivalent to valmin for integral types and minf for floating-point types.

Example

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

◆ mone

auto eve::mone = functor<mone_t>
inlineconstexpr

Computes the constant \(-1\).

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T mone(as<T> x) noexcept;
}
constexpr auto mone
Computes the constant .
Definition mone.hpp:66

Parameters

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

Return value

The call eve::mone(as<T>()) is semantically equivalent to T(-1)

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_mone() { return eve::mone(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> mone(as<wide_ft>()) = " << eve::mone(eve::as<wide_ft>()) << std::endl
<< "-> mone(as<wide_it>()) = " << eve::mone(eve::as<wide_it>()) << std::endl
<< "-> mone(as(wxf)) = " << eve::mone(eve::as(wxf)) << std::endl
<< "-> mone(as(wxi)) = " << eve::mone(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> mone(as<float>()) = " << eve::mone(eve::as(float())) << std::endl
<< "-> mone(as<std::int16_t>()) = " << eve::mone(eve::as(std::int16_t())) << std::endl
<< "-> mone(as<xf)) = " << eve::mone(eve::as(xf)) << std::endl
<< "-> mone(as<xi)) = " << eve::mone(eve::as(xi)) << std::endl;
std::cout << "-> constexpr mone = " << constexpr_mone<float>() << std::endl;
return 0;
}

◆ mzero

auto eve::mzero = functor<mzero_t>
inlineconstexpr

Computes the negative zero value.

For integral type there is no difference between eve::zero and eve::mzero, but for floating ones the bit of sign differs.

However, eve::mzero always satisfies the equality predicate with eve::zero and eve::mzero satisfies the predicate is_negative, but not the predicate is_ltz.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T mzero(as<T> x) noexcept;
}
constexpr auto mzero
Computes the negative zero value.
Definition mzero.hpp:74

Parameters

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

Return value

The call eve::mzero(as<T>()) is semantically equivalent to T(-0.0).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_mzero() { return eve::mzero(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> mzero(as<wide_ft>()) = " << eve::mzero(eve::as<wide_ft>()) << std::endl
<< "-> mzero(as<wide_it>()) = " << eve::mzero(eve::as<wide_it>()) << std::endl
<< "-> mzero(as(wxf)) = " << eve::mzero(eve::as(wxf)) << std::endl
<< "-> mzero(as(wxi)) = " << eve::mzero(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> mzero(as<float>()) = " << eve::mzero(eve::as(float())) << std::endl
<< "-> mzero(as<std::int16_t>()) = " << eve::mzero(eve::as(std::int16_t())) << std::endl
<< "-> mzero(as<xf)) = " << eve::mzero(eve::as(xf)) << std::endl
<< "-> mzero(as<xi)) = " << eve::mzero(eve::as(xi)) << std::endl;
std::cout << "-> constexpr mzero = " << constexpr_mzero<float>() << std::endl;
return 0;
}

◆ nan

auto eve::nan = functor<nan_t>
inlineconstexpr

Computes the IEEE quiet NaN constant.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T nan(as<T> x) noexcept;
}
constexpr auto nan
Computes the IEEE quiet NaN constant.
Definition nan.hpp:67

Parameters

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

Return value

The call eve::nan(as<T>()) is semantically equivalent to T(0.0/0.0).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_nan() { return eve::nan(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> nan(as<wide_ft>()) = " << eve::nan(eve::as<wide_ft>()) << std::endl
<< "-> nan(as(wxf)) = " << eve::nan(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> nan(as<float>()) = " << eve::nan(eve::as(float())) << std::endl
<< "-> nan(as<xf)) = " << eve::nan(eve::as(xf)) << std::endl;
std::cout << "-> constexpr nan = " << constexpr_nan<float>() << std::endl;
return 0;
}

◆ nbmantissabits

auto eve::nbmantissabits = functor<nbmantissabits_t>
inlineconstexpr

Returns the number of mantissa bits of a floating point value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T nbmantissabits(as<T> x) noexcept;
}
constexpr auto nbmantissabits
Returns the number of mantissa bits of a floating point value.
Definition nbmantissabits.hpp:71

Parameters

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

Return value

The call eve::nbmantissabits(as<T>()) is semantically equivalent to:

  • as_integer_t<T>(23) if eve::element_type_t<T> is float
  • as_integer_t<T>(52) if eve::element_type_t<T> is double

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_nbmantissabits() { return eve::nbmantissabits(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> nbmantissabits(as<wide_ft>()) = " << eve::nbmantissabits(eve::as<wide_ft>()) << std::endl
<< "-> nbmantissabits(as(wxf)) = " << eve::nbmantissabits(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> nbmantissabits(as<float>()) = " << eve::nbmantissabits(eve::as(float())) << std::endl
<< "-> nbmantissabits(as<xf)) = " << eve::nbmantissabits(eve::as(xf)) << std::endl;
std::cout << "-> constexpr nbmantissabits = " << constexpr_nbmantissabits<float>() << std::endl;
return 0;
}

◆ one

auto eve::one = functor<one_t>
inlineconstexpr

Computes the constant \(1\).

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T one(as<T> x) noexcept;
}
constexpr auto one
Computes the constant .
Definition one.hpp:66

Parameters

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

Return value

The call eve::one(as<T>()) is semantically equivalent to T(1)

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_one() { return eve::one(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
eve::wide x {-1, -2, 3, 4};
std::cout << "---- simd" << std::endl
<< "-> one(as<wide_ft>()) = " << eve::one(eve::as<wide_ft>()) << std::endl
<< "-> one(as<wide_it>()) = " << eve::one(eve::as<wide_it>()) << std::endl
<< "-> one(as(wxf)) = " << eve::one(eve::as(wxf)) << std::endl
<< "-> one(as(wxi)) = " << eve::one(eve::as(wxi)) << std::endl
<< "-> one[x > 0](as(x)) = " << eve::one[x > 0](eve::as(x)) << std::endl
<< "-> one[if_(x > 0).else_(22.0f)](as(x)) = " << eve::one[eve::if_(x > 0).else_(22.0f)](eve::as(x)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> one(as<float>()) = " << eve::one(eve::as(float())) << std::endl
<< "-> one(as<std::int16_t>()) = " << eve::one(eve::as(std::int16_t())) << std::endl
<< "-> one(as<xf)) = " << eve::one(eve::as(xf)) << std::endl
<< "-> one(as<xi)) = " << eve::one(eve::as(xi)) << std::endl;
std::cout << "-> constexpr one = " << constexpr_one<float>() << std::endl;
return 0;
}

◆ oneosqrteps

auto eve::oneosqrteps = functor<oneosqrteps_t>
inlineconstexpr

Computes the inverse of the square root of the machine epsilon.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T oneosqrteps(as<T> x) noexcept;
}
constexpr auto oneosqrteps
Computes the inverse of the square root of the machine epsilon.
Definition oneosqrteps.hpp:72

Parameters

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

Return value

The call eve::oneosqrteps(as<T>()) is semantically equivalent to eve::rec (eve::sqrt (eve::eps (as<T>())))

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_oneosqrteps() { return eve::oneosqrteps(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::setprecision(9) << std::endl
<< "-> oneosqrteps(as<wide_ft>()) = " << eve::oneosqrteps(eve::as<wide_ft>()) << std::endl
<< "-> oneosqrteps(as(wxf)) = " << eve::oneosqrteps(eve::as(wxf)) << std::endl
<< "-> upper(oneosqrteps)(as(wxf)) = " << eve::oneosqrteps[eve::upper](eve::as(wxf)) << std::endl
<< "-> rec(eve::sqrt(double(eps((as<float>()))))) = " << 1.0/(eve::sqrt(double(eve::eps((eve::as<float>()))))) << std::endl
<< "-> lower(oneosqrteps)(as(wxf)) = " << eve::oneosqrteps[eve::lower](eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> oneosqrteps(as<float>()) = " << eve::oneosqrteps(eve::as(float())) << std::endl
<< "-> oneosqrteps(as<xf)) = " << eve::oneosqrteps(eve::as(xf)) << std::endl;
std::cout << "-> constexpr oneosqrteps = " << constexpr_oneosqrteps<float>() << std::endl;
return 0;
}
constexpr auto sqrt
Computes the elementwise square root of the parameter.
Definition sqrt.hpp:86
constexpr auto lower
Guarantees a result no greater than the exact mathematical one.
Definition core.hpp:103
constexpr auto upper
Guarantees a result no smaller than the exact mathematical one.
Definition core.hpp:102

◆ oneotwoeps

auto eve::oneotwoeps = functor<oneotwoeps_t>
inlineconstexpr

Computes a constant to the machine oneotwoepsilon.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T oneotwoeps(as<T> x) noexcept;
}
constexpr auto oneotwoeps
Computes a constant to the machine oneotwoepsilon.
Definition oneotwoeps.hpp:71

Parameters

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

Return value

The call eve::oneotwoeps(as<T>()) returns elementwise, the smallest positive value x of the type such that 1+x != x.

Example

// revision 0
#include <eve/module/math.hpp>
#include <iostream>
#include <iomanip>
int main()
{
using wf_t = eve::wide<float>;
using wd_t = eve::wide<double>;
std::cout << std::setprecision(9);
std::cout << "-> oneotwoeps(as<float>()) = " << eve::oneotwoeps(eve::as<float>()) << "\n";
std::cout << "-> oneotwoeps(as<wf_t>()) = " << eve::oneotwoeps(eve::as<wf_t>()) << "\n";
std::cout << "-> oneotwoeps[lower](as<wf_t>()) = " << eve::oneotwoeps[eve::lower](eve::as<wf_t>()) << "\n";
std::cout << "-> oneotwoeps[upper](as<wf_t>()) = " << eve::oneotwoeps[eve::upper](eve::as<wf_t>()) << "\n";
std::cout << std::setprecision(17);
std::cout << "-> oneotwoeps(as<double>()) = " << eve::oneotwoeps(eve::as<double>()) << "\n";
std::cout << "-> oneotwoeps(as<wd_t>()) = " << eve::oneotwoeps(eve::as<wd_t>()) << "\n";
std::cout << "-> oneotwoeps[lower](as<wd_t>()) = " << eve::oneotwoeps[eve::lower](eve::as<wd_t>()) << "\n";
std::cout << "-> oneotwoeps[upper](as<wd_t>()) = " << eve::oneotwoeps[eve::upper](eve::as<wd_t>()) << "\n";
}

◆ signmask

auto eve::signmask = functor<signmask_t>
inlineconstexpr

Computes a value in which the most significant bit is the only bit set.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T signmask(as<T> x) noexcept;
}
constexpr auto signmask
Computes a value in which the most significant bit is the only bit set.
Definition signmask.hpp:77

Parameters

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

Return value

The call eve::signmask(as<T)) returns a value of type T for which each element has all its bits unset except the highest.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_signmask() { return eve::signmask(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> signmask(as<wide_ft>()) = " << eve::signmask(eve::as<wide_ft>()) << std::endl
<< "-> signmask(as<wide_it>()) = " << eve::signmask(eve::as<wide_it>()) << std::endl
<< "-> signmask(as(wxf)) = " << eve::signmask(eve::as(wxf)) << std::endl
<< "-> signmask(as(wxi)) = " << eve::signmask(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> signmask(as<float>()) = " << eve::signmask(eve::as(float())) << std::endl
<< "-> signmask(as<std::int16_t>()) = " << eve::signmask(eve::as(std::int16_t())) << std::endl
<< "-> signmask(as<xf)) = " << eve::signmask(eve::as(xf)) << std::endl
<< "-> signmask(as<xi)) = " << eve::signmask(eve::as(xi)) << std::endl;
std::cout << "-> constexpr signmask = " << constexpr_signmask<float>() << std::endl;
return 0;
}

◆ smallestposval

auto eve::smallestposval = functor<smallestposval_t>
inlineconstexpr

Computes the smallest normal positive value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T smallestposval(as<T> x) noexcept;
}
constexpr auto smallestposval
Computes the smallest normal positive value.
Definition smallestposval.hpp:71

Parameters

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

Return value

The call eve::smallestposval(as<T>()) is semantically equivalent to:

  • T(1) if eve::element_type_t<T> is integral
  • T(1.1754944e-38f) if eve::element_type_t<T> is float
  • T(2.225073858507201e-308) if eve::element_type_t<T> is double

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_smallestposval() { return eve::smallestposval(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> smallestposval(as<wide_ft>()) = " << eve::smallestposval(eve::as<wide_ft>()) << std::endl
<< "-> smallestposval(as<wide_it>()) = " << eve::smallestposval(eve::as<wide_it>()) << std::endl
<< "-> smallestposval(as(wxf)) = " << eve::smallestposval(eve::as(wxf)) << std::endl
<< "-> smallestposval(as(wxi)) = " << eve::smallestposval(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> smallestposval(as<float>()) = " << eve::smallestposval(eve::as(float())) << std::endl
<< "-> smallestposval(as<std::int16_t>()) = " << eve::smallestposval(eve::as(std::int16_t())) << std::endl
<< "-> smallestposval(as<xf)) = " << eve::smallestposval(eve::as(xf)) << std::endl
<< "-> smallestposval(as<xi)) = " << eve::smallestposval(eve::as(xi)) << std::endl;
std::cout << "-> constexpr smallestposval = " << constexpr_smallestposval<float>() << std::endl;
return 0;
}

◆ sqrteps

auto eve::sqrteps = functor<sqrteps_t>
inlineconstexpr

Computes the square root of the machine epsilon.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T sqrteps(as<T> x) noexcept;
}
constexpr auto sqrteps
Computes the square root of the machine epsilon.
Definition sqrteps.hpp:72

Parameters

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

Return value

The call eve::sqrteps(as<T>()) is semantically equivalent to eve::sqrt (eve::eps (as<T>()))

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_sqrteps() { return eve::sqrteps(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::setprecision(9) << std::endl
<< "-> sqrteps(as<wide_ft>()) = " << eve::sqrteps(eve::as<wide_ft>()) << std::endl
<< "-> sqrteps(as(wxf)) = " << eve::sqrteps(eve::as(wxf)) << std::endl
<< "-> sqrteps[upper](as(wxf)) = " << eve::sqrteps[eve::upper](eve::as(wxf)) << std::endl
<< "-> sqrt(double(eve::eps(as<float>()))) = " << eve::sqrt(double(eve::eps(eve::as<float>()))) << std::endl
<< "-> sqrteps[lower](as(wxf)) = " << eve::sqrteps[eve::lower](eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> sqrteps(as<float>()) = " << eve::sqrteps(eve::as(float())) << std::endl
<< "-> sqrteps(as<xf)) = " << eve::sqrteps(eve::as(xf)) << std::endl;
std::cout << "-> constexpr sqrteps = " << constexpr_sqrteps<float>() << std::endl;
return 0;
}

◆ sqrtsmallestposval

auto eve::sqrtsmallestposval = functor<sqrtsmallestposval_t>
inlineconstexpr

Computes the square root of the eve::smallestposval.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::plain_value T> constexpr T sqrtsmallestposval(as<T> x) noexcept;
}
constexpr auto sqrtsmallestposval
Computes the square root of the eve::smallestposval.
Definition sqrtsmallestposval.hpp:69

Parameters

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

Return value

The call eve::sqrtsmallestposval(as<T>()) is semantically equivalent to eve::sqrt (eve::smallestposval(as<T>()).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_sqrtsmallestposval() { return eve::sqrtsmallestposval(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> sqrtsmallestposval(as<wide_ft>()) = " << eve::sqrtsmallestposval(eve::as<wide_ft>()) << std::endl
<< "-> sqrtsmallestposval(as<wide_it>()) = " << eve::sqrtsmallestposval(eve::as<wide_it>()) << std::endl
<< "-> sqrtsmallestposval(as(wxf)) = " << eve::sqrtsmallestposval(eve::as(wxf)) << std::endl
<< "-> sqrtsmallestposval(as(wxi)) = " << eve::sqrtsmallestposval(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> sqrtsmallestposval(as<float>()) = " << eve::sqrtsmallestposval(eve::as(float())) << std::endl
<< "-> sqrtsmallestposval(as<std::int16_t>()) = " << eve::sqrtsmallestposval(eve::as(std::int16_t())) << std::endl
<< "-> sqrtsmallestposval(as<xf)) = " << eve::sqrtsmallestposval(eve::as(xf)) << std::endl
<< "-> sqrtsmallestposval(as<xi)) = " << eve::sqrtsmallestposval(eve::as(xi)) << std::endl;
std::cout << "-> constexpr sqrtsmallestposval = " << constexpr_sqrtsmallestposval<float>() << std::endl;
return 0;
}

◆ sqrtvalmax

auto eve::sqrtvalmax = functor<sqrtvalmax_t>
inlineconstexpr

Computes the greatest value less than the square root of eve::valmax.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T sqrtvalmax(as<T> x) noexcept;
}
constexpr auto sqrtvalmax
Computes the greatest value less than the square root of eve::valmax.
Definition sqrtvalmax.hpp:75

Parameters

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

Return value

The call eve::sqrtvalmax(as<T>()) is the greatest number of the type whose square is less or equal to eve::valmax(as<T>()).

Example

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

◆ true_

auto eve::true_ = functor<true_t>
inlineconstexpr

Computes the logical true_ value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<typename T> constexpr as_logical<T> true_(as<T> x);
}
constexpr auto true_
Computes the logical true_ value.
Definition true.hpp:67

Parameters

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

Return value

The call eve::true_(as<T>()) returns elementwise, the true logical value.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_true_() { return eve::true_(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> true(as<wide_ft>()) = " << eve::true_(eve::as<wide_ft>()) << std::endl
<< "-> true_(as<wide_it>()) = " << eve::true_(eve::as<wide_it>()) << std::endl
<< "-> true_(as(wxf)) = " << eve::true_(eve::as(wxf)) << std::endl
<< "-> true_(as(wxi)) = " << eve::true_(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> true_(as<float>()) = " << eve::true_(eve::as(float())) << std::endl
<< "-> true_(as<std::int16_t>()) = " << eve::true_(eve::as(std::int16_t())) << std::endl
<< "-> true_(as<xf)) = " << eve::true_(eve::as(xf)) << std::endl
<< "-> true_(as<xi)) = " << eve::true_(eve::as(xi)) << std::endl;
std::cout << "-> constexpr true_ = " << constexpr_true_<float>() << std::endl;
return 0;
}

◆ twotonmb

auto eve::twotonmb = functor<twotonmb_t>
inlineconstexpr

Computes the 2 power of the number of mantissa bits of a floating value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::floating_value T> constexpr T twotonmb(as<T> x) noexcept;
}
constexpr auto twotonmb
Computes the 2 power of the number of mantissa bits of a floating value.
Definition twotonmb.hpp:68

Parameters

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

Return value

The call eve::twotonmb(as<T>()) is semantically equivalent to eve::exp2 (T(eve::nbmantissabits (as<eve::element_type_t<T>>())))

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
template<typename T>
consteval auto constexpr_twotonmb() { return eve::twotonmb(eve::as<T>{}); }
int main()
{
wide_ft wxf;
std::cout << "---- simd" << std::endl
<< "-> twotonmb(as<wide_ft>()) = " << eve::twotonmb(eve::as<wide_ft>()) << std::endl
<< "-> twotonmb(as(wxf)) = " << eve::twotonmb(eve::as(wxf)) << std::endl;
double xf;
std::cout << "---- scalar" << std::endl
<< "-> twotonmb(as<float>()) = " << eve::twotonmb(eve::as(float())) << std::endl
<< "-> twotonmb(as<xf)) = " << eve::twotonmb(eve::as(xf)) << std::endl;
std::cout << "-> constexpr twotonmb = " << constexpr_twotonmb<float>() << std::endl;
return 0;
}

◆ valmax

auto eve::valmax = functor<valmax_t>
inlineconstexpr

Computes the greatest representable value.

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 greatest representable value.
Definition valmax.hpp:67

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;
}

◆ valmin

auto eve::valmin = functor<valmin_t>
inlineconstexpr

Computes the lowest representable value.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<eve::plain_value T> constexpr T valmin(as<T> x) noexcept;
}
constexpr auto valmin
Computes the lowest representable value.
Definition valmin.hpp:67

Parameters

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

Return value

The call eve::valmin(as<T>()) is semantically equivalent to T(std::numeric_limits<element_type_t<T>>::``lowest())

Example

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

◆ zero

auto eve::zero = functor<zero_t>
inlineconstexpr

Computes the constant 0.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::plain_value T >
T zero(as<T> x) noexcept;
}
constexpr auto zero
Computes the constant 0.
Definition zero.hpp:78

Parameters

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

Return value

The call eve::zero(as<T>()) is semantically equivalent to T(0).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_zero() { return eve::zero(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> zero(as<wide_ft>()) = " << eve::zero(eve::as<wide_ft>()) << std::endl
<< "-> zero(as<wide_it>()) = " << eve::zero(eve::as<wide_it>()) << std::endl
<< "-> zero(as(wxf)) = " << eve::zero(eve::as(wxf)) << std::endl
<< "-> zero(as(wxi)) = " << eve::zero(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> zero(as<float>()) = " << eve::zero(eve::as(float())) << std::endl
<< "-> zero(as<std::int16_t>()) = " << eve::zero(eve::as(std::int16_t())) << std::endl
<< "-> zero(as<xf)) = " << eve::zero(eve::as(xf)) << std::endl
<< "-> zero(as<xi)) = " << eve::zero(eve::as(xi)) << std::endl;
std::cout << "-> constexpr zero = " << constexpr_zero<float>() << std::endl;
return 0;
}