◆ two_prod
Callable object computing the two_prod operation. Required header: Members Functions
template< value T, value U > auto operator()( T x, U y ) const noexcept requires compatible< T, U >;
Parameters
Return value computes elementwise a pair of values
where \(\oplus\) (resp. \(\otimes\)) adds (resp. multiplies) its two parameters with infinite precision. Supported decoratorsno decorators are supported ExampleSee it live on Compiler Explorer #include <eve/function/two_prod.hpp>
#include <eve/wide.hpp>
#include <eve/constant/eps.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float, eve::fixed<4>>;
int main()
{
wide_ft pf = {1.0f+ep, 0.5f*(1.0f+ep*4), -1.3f, 1.0f+4*ep};
wide_ft qf = {1.0f-ep, 0.5f, -1.3f, 1.0f-ep/2};
auto [a, e] = eve::two_prod(pf, qf);
std::cout << "---- simd" << std::setprecision(10) << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> two_prod(pf, qf) = [" << '\n'
<< " " << a << ", \n"
<< " " << e << '\n'
<< " ]\n";
float xf = 1+ep, yf = 1-ep;
auto [sa, se] = eve::two_prod(xf, yf);
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> two_prod(xf, yf) = [" << sa << ", " << se << "]\n";
return 0;
}
constexpr callable_eps_ eps Callable object computing the machine epsilon. Definition: eps.hpp:60 constexpr callable_two_prod_ two_prod Callable object computing the two_prod operation. Definition: two_prod.hpp:64 |