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

◆ rat

auto eve::rat = functor<rat_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto rat(floating_value auto x) noexcept;
constexpr auto rat(floating_value auto x, floating_value auto tol) noexcept;
}
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
constexpr auto rat
elementwise_callable object computing a rational approximation.
Definition rat.hpp:79
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

A tuple-like whose members have the same type as x, containing the numerator and denominator of the rational number approximating x.

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide wf0{0.0, 1.0, 2.0, 3.0, -1.0, -2.0, -3.0, -4.0};
eve::wide wf1{0.0, -4.0, 1.0, -1.0, 2.0, -2.0, 3.0, -3.0};
std::cout << "<- wf0 = " << wf0 << "\n";
std::cout << "<- wf1 = " << wf1 << "\n";
std::cout << "-> rat(wf0) = " << eve::rat(wf0) << "\n";
std::cout << "-> rat(wf0, wf1) = " << eve::rat(wf0, wf1) << "\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:86