\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -2.27109209614237641 \cdot 10^{59}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 9.6349667233636427 \cdot 10^{131}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r818555 = x;
double r818556 = r818555 * r818555;
double r818557 = y;
double r818558 = r818557 * r818557;
double r818559 = r818556 + r818558;
double r818560 = sqrt(r818559);
return r818560;
}
double f(double x, double y) {
double r818561 = x;
double r818562 = -2.2710920961423764e+59;
bool r818563 = r818561 <= r818562;
double r818564 = -1.0;
double r818565 = r818564 * r818561;
double r818566 = 9.634966723363643e+131;
bool r818567 = r818561 <= r818566;
double r818568 = r818561 * r818561;
double r818569 = y;
double r818570 = r818569 * r818569;
double r818571 = r818568 + r818570;
double r818572 = sqrt(r818571);
double r818573 = r818567 ? r818572 : r818561;
double r818574 = r818563 ? r818565 : r818573;
return r818574;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 17.9 |
| Herbie | 18.2 |
if x < -2.2710920961423764e+59Initial program 45.1
Taylor expanded around -inf 12.9
if -2.2710920961423764e+59 < x < 9.634966723363643e+131Initial program 22.0
if 9.634966723363643e+131 < x Initial program 57.8
Taylor expanded around inf 8.5
Final simplification18.2
herbie shell --seed 2020062
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:precision binary64
:herbie-target
(if (< x -1.123695082659983e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))