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

◆ oneotwoeps

auto eve::oneotwoeps = functor<oneotwoeps_t>
inlineconstexpr

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
EVE Main Namespace.
Definition abi.hpp:19
Lightweight type-wrapper.
Definition as.hpp:29

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";
}
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
Wrapper for SIMD registers.
Definition wide.hpp:94