◆ rat
Callable object computing the rational approximation. Required header: Members Functions
Definition: value.hpp:83 Parameters
Return values Two values with the same type as Supported decoratorsno decorators are supported ExampleSee it live on Compiler Explorer //==================================================================================================
//==================================================================================================
#include <eve/function/rat.hpp>
#include <eve/constant/pi.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<double, eve::fixed<8>>;
int main()
{
using eve::as;
wide_ft pf = {1.25, 1.5, -3.123, 456.0
auto [n, d] = eve::rat(pf);
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> n = " << n << '\n'
<< "-> d = " << d << '\n' ;
double xf = -3.0/5.0;
auto [xn, xd] = eve::rat(xf);
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> xn = " << xn << '\n'
<< "-> xd = " << xd << '\n' ;
;
return 0;
}
constexpr callable_rat_ rat Callable object computing the rational approximation. Definition: rat.hpp:63 constexpr callable_minf_ minf Callable object computing the negative infinity value. Definition: minf.hpp:55 constexpr callable_inf_ inf Callable object computing the infinity ieee value. Definition: inf.hpp:54 |