\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -2.176665368798762034403420210926666921837 \cdot 10^{117}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 1.048565751089651352045129138343128122191 \cdot 10^{96}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r517500 = x;
double r517501 = r517500 * r517500;
double r517502 = y;
double r517503 = r517502 * r517502;
double r517504 = r517501 + r517503;
double r517505 = sqrt(r517504);
return r517505;
}
double f(double x, double y) {
double r517506 = x;
double r517507 = -2.176665368798762e+117;
bool r517508 = r517506 <= r517507;
double r517509 = -1.0;
double r517510 = r517509 * r517506;
double r517511 = 1.0485657510896514e+96;
bool r517512 = r517506 <= r517511;
double r517513 = r517506 * r517506;
double r517514 = y;
double r517515 = r517514 * r517514;
double r517516 = r517513 + r517515;
double r517517 = sqrt(r517516);
double r517518 = r517512 ? r517517 : r517506;
double r517519 = r517508 ? r517510 : r517518;
return r517519;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 18.0 |
| Herbie | 18.0 |
if x < -2.176665368798762e+117Initial program 54.5
Taylor expanded around -inf 10.2
if -2.176665368798762e+117 < x < 1.0485657510896514e+96Initial program 21.6
if 1.0485657510896514e+96 < x Initial program 51.5
Taylor expanded around inf 10.6
Final simplification18.0
herbie shell --seed 2019298
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:precision binary64
:herbie-target
(if (< x -1.123695082659983e145) (- x) (if (< x 1.11655762118336204e93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))