1#ifndef CONSTMATH_SQRT_HPP
2#define CONSTMATH_SQRT_HPP
4#include "../../consteig_options.hpp"
6#include "utilities.hpp"
15constexpr T sqrt_recur(
const T x,
const T xn,
const int count)
23template <
typename T>
constexpr T sqrt_check(
const T x,
const T m_val)
25 return (
x ==
T(0) ?
T(0)
27 :
x >
T(4) ? sqrt_check(
x /
T(4),
T(2) *
m_val)
28 :
x <
T(0.25) ? sqrt_check(
x *
T(4),
m_val /
T(2))
29 :
m_val * sqrt_recur(
x,
x /
T(2), 0));
32template <
typename T>
constexpr T sqrt_int(
const T x)
67template <
typename T>
constexpr T sqrt(
const T x)
70 if (
x <
static_cast<T>(0))
81 return sqrt_check(
x,
static_cast<T>(1));
#define CONSTEIG_MAX_ITER
Maximum QR iterations per eigenvalue block.
Definition consteig_options.hpp:21
constexpr T sqrt(const T x)
Constexpr square root.
Definition sqrt.hpp:67
constexpr T abs(const T x)
Absolute value of a real number.
Definition abs.hpp:17
constexpr T epsilon()
Machine epsilon for type T.
Definition utilities.hpp:82