\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -9.16501881147335996 \cdot 10^{142}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 9.23653280905907259 \cdot 10^{138}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r1033503 = x;
double r1033504 = r1033503 * r1033503;
double r1033505 = y;
double r1033506 = r1033505 * r1033505;
double r1033507 = r1033504 + r1033506;
double r1033508 = sqrt(r1033507);
return r1033508;
}
double f(double x, double y) {
double r1033509 = x;
double r1033510 = -9.16501881147336e+142;
bool r1033511 = r1033509 <= r1033510;
double r1033512 = -1.0;
double r1033513 = r1033512 * r1033509;
double r1033514 = 9.236532809059073e+138;
bool r1033515 = r1033509 <= r1033514;
double r1033516 = r1033509 * r1033509;
double r1033517 = y;
double r1033518 = r1033517 * r1033517;
double r1033519 = r1033516 + r1033518;
double r1033520 = sqrt(r1033519);
double r1033521 = r1033515 ? r1033520 : r1033509;
double r1033522 = r1033511 ? r1033513 : r1033521;
return r1033522;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.9 |
|---|---|
| Target | 17.7 |
| Herbie | 17.6 |
if x < -9.16501881147336e+142Initial program 61.3
Taylor expanded around -inf 9.1
if -9.16501881147336e+142 < x < 9.236532809059073e+138Initial program 20.9
if 9.236532809059073e+138 < x Initial program 59.7
Taylor expanded around inf 8.8
Final simplification17.6
herbie shell --seed 2020025
(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))))