\sqrt{x \cdot x + x \cdot x}
\begin{array}{l}
\mathbf{if}\;x \leq 2.49609637258684 \cdot 10^{-310}:\\
\;\;\;\;\begin{array}{l}
t_0 := \sqrt{\sqrt{2}}\\
t_1 := \sqrt{t_0}\\
-t_1 \cdot \left(t_1 \cdot \left(x \cdot t_0\right)\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \sqrt{x + x}\\
\end{array}
(FPCore (x) :precision binary64 (sqrt (+ (* x x) (* x x))))
(FPCore (x)
:precision binary64
(if (<= x 2.49609637258684e-310)
(let* ((t_0 (sqrt (sqrt 2.0))) (t_1 (sqrt t_0)))
(- (* t_1 (* t_1 (* x t_0)))))
(* (sqrt x) (sqrt (+ x x)))))double code(double x) {
return sqrt((x * x) + (x * x));
}
double code(double x) {
double tmp;
if (x <= 2.49609637258684e-310) {
double t_0_1 = sqrt(sqrt(2.0));
double t_1_2 = sqrt(t_0_1);
tmp = -(t_1_2 * (t_1_2 * (x * t_0_1)));
} else {
tmp = sqrt(x) * sqrt(x + x);
}
return tmp;
}



Bits error versus x
Results
if x < 2.496096372586836e-310Initial program 30.4
Simplified30.4
Taylor expanded around -inf 0.4
Simplified0.4
rmApplied add-sqr-sqrt_binary640.6
Applied associate-*l*_binary640.4
Simplified0.4
rmApplied add-sqr-sqrt_binary640.4
Applied associate-*l*_binary640.4
Simplified0.4
if 2.496096372586836e-310 < x Initial program 30.7
Simplified30.7
rmApplied sqrt-prod_binary640.3
Final simplification0.4
herbie shell --seed 2021205
(FPCore (x)
:name "sqrt A"
:precision binary64
(sqrt (+ (* x x) (* x x))))