\sqrt{\left(2 \cdot x\right) \cdot x}\begin{array}{l}
\mathbf{if}\;x \leq -3.1772341154775 \cdot 10^{-311}:\\
\;\;\;\;-\sqrt[3]{\sqrt{2}} \cdot \left(x \cdot \left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x} \cdot \sqrt{x \cdot 2}\\
\end{array}(FPCore (x) :precision binary64 (sqrt (* (* 2.0 x) x)))
(FPCore (x) :precision binary64 (if (<= x -3.1772341154775e-311) (- (* (cbrt (sqrt 2.0)) (* x (* (cbrt (sqrt 2.0)) (cbrt (sqrt 2.0)))))) (* (sqrt x) (sqrt (* x 2.0)))))
double code(double x) {
return sqrt((2.0 * x) * x);
}
double code(double x) {
double tmp;
if (x <= -3.1772341154775e-311) {
tmp = -(cbrt(sqrt(2.0)) * (x * (cbrt(sqrt(2.0)) * cbrt(sqrt(2.0)))));
} else {
tmp = sqrt(x) * sqrt(x * 2.0);
}
return tmp;
}









Bits error versus x
Results
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 26305 |
| Alternative 2 | |
|---|---|
| Error | 0.4 |
| Cost | 13441 |
| Alternative 3 | |
|---|---|
| Error | 0.4 |
| Cost | 6977 |
| Alternative 4 | |
|---|---|
| Error | 30.1 |
| Cost | 6913 |
| Alternative 5 | |
|---|---|
| Error | 60.6 |
| Cost | 64 |
| Alternative 6 | |
|---|---|
| Error | 61.6 |
| Cost | 64 |

if x < -3.17723411547747e-311Initial program 30.7
Taylor expanded around -inf 0.4
Simplified0.4
rmApplied add-cube-cbrt_binary64_1130.4
Applied associate-*r*_binary64_180.4
Simplified0.4
if -3.17723411547747e-311 < x Initial program 30.5
rmApplied pow1_binary64_13930.5
rmApplied add-exp-log_binary64_11632.8
Simplified32.8
rmApplied sqrt-prod_binary64_945.7
Applied log-prod_binary64_1646.1
Applied exp-sum_binary64_1245.2
Simplified4.7
Simplified0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2021014
(FPCore (x)
:name "sqrt B"
:precision binary64
(sqrt (* (* 2.0 x) x)))