\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -1.300285162304908517480300856336753809112 \cdot 10^{108}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 1.865924590141658442437285705670191540248 \cdot 10^{56}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r791529 = x;
double r791530 = r791529 * r791529;
double r791531 = y;
double r791532 = r791531 * r791531;
double r791533 = r791530 + r791532;
double r791534 = sqrt(r791533);
return r791534;
}
double f(double x, double y) {
double r791535 = x;
double r791536 = -1.3002851623049085e+108;
bool r791537 = r791535 <= r791536;
double r791538 = -1.0;
double r791539 = r791538 * r791535;
double r791540 = 1.8659245901416584e+56;
bool r791541 = r791535 <= r791540;
double r791542 = r791535 * r791535;
double r791543 = y;
double r791544 = r791543 * r791543;
double r791545 = r791542 + r791544;
double r791546 = sqrt(r791545);
double r791547 = r791541 ? r791546 : r791535;
double r791548 = r791537 ? r791539 : r791547;
return r791548;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.5 |
|---|---|
| Target | 17.6 |
| Herbie | 17.8 |
if x < -1.3002851623049085e+108Initial program 52.3
Taylor expanded around -inf 9.5
if -1.3002851623049085e+108 < x < 1.8659245901416584e+56Initial program 21.7
if 1.8659245901416584e+56 < x Initial program 45.6
Taylor expanded around inf 12.2
Final simplification17.8
herbie shell --seed 2019362
(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))))