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

◆ two_sqrt_approx

auto eve::two_sqrt_approx = functor<two_sqrt_approx_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
constexpr auto two_sqrt_approx(floating_value auto x) 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 two_sqrt_approx
Computes the elementwise pair of square root and error,.
Definition two_sqrt_approx.hpp:67
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

Computes elementwise a pair of values [a,e] such that:

  • a is eve::sqrt(x)
  • e is a value such that a \(\oplus\)e is an approximation in doubled precision to \(\sqrt\)x, where \(\oplus\) (resp. \(\sqrt\)) adds (resp. take the square roots of) its parameters with infinite precision.

Example

// revision 1
#include <eve/module/core.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide wf0 = {3.0f, 2.5f, 32.7f, 1.0f};
std::cout << "<- wf0 = " << wf0 << "\n";
std::cout << "-> two_sqrt_approx(wf0) = " << eve::two_sqrt_approx(wf0) << "\n";
auto [d, e] = eve::two_sqrt_approx(3.0f);
std::cout << std::setprecision(15);
std::cout << double(d) << " + " << double(e) << std::endl;
std::cout << double(e)+double(d) << std::endl;
std::cout << eve::sqrt(3.0) << std::endl;
std::cout << eve::sqrt(3.0f) << std::endl;
std::cout << eve::sqrt(3.0) - (double(e)+double(d))<< std::endl;
}
constexpr auto sqrt
Computes the elementwise square root of the parameter.
Definition sqrt.hpp:86
Wrapper for SIMD registers.
Definition wide.hpp:94