\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -1.5701395123872976 \cdot 10^{96}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 1.5292574126268538 \cdot 10^{125}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r872678 = x;
double r872679 = r872678 * r872678;
double r872680 = y;
double r872681 = r872680 * r872680;
double r872682 = r872679 + r872681;
double r872683 = sqrt(r872682);
return r872683;
}
double f(double x, double y) {
double r872684 = x;
double r872685 = -1.5701395123872976e+96;
bool r872686 = r872684 <= r872685;
double r872687 = -1.0;
double r872688 = r872687 * r872684;
double r872689 = 1.5292574126268538e+125;
bool r872690 = r872684 <= r872689;
double r872691 = r872684 * r872684;
double r872692 = y;
double r872693 = r872692 * r872692;
double r872694 = r872691 + r872693;
double r872695 = sqrt(r872694);
double r872696 = r872690 ? r872695 : r872684;
double r872697 = r872686 ? r872688 : r872696;
return r872697;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.2 |
|---|---|
| Target | 17.3 |
| Herbie | 17.2 |
if x < -1.5701395123872976e+96Initial program 50.6
Taylor expanded around -inf 10.3
if -1.5701395123872976e+96 < x < 1.5292574126268538e+125Initial program 20.7
if 1.5292574126268538e+125 < x Initial program 57.7
Taylor expanded around inf 9.5
Final simplification17.2
herbie shell --seed 2020065
(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))))