\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -1.4667592323261061 \cdot 10^{131}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 1.3722084465878742 \cdot 10^{86}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r672134 = x;
double r672135 = r672134 * r672134;
double r672136 = y;
double r672137 = r672136 * r672136;
double r672138 = r672135 + r672137;
double r672139 = sqrt(r672138);
return r672139;
}
double f(double x, double y) {
double r672140 = x;
double r672141 = -1.4667592323261061e+131;
bool r672142 = r672140 <= r672141;
double r672143 = -1.0;
double r672144 = r672143 * r672140;
double r672145 = 1.3722084465878742e+86;
bool r672146 = r672140 <= r672145;
double r672147 = r672140 * r672140;
double r672148 = y;
double r672149 = r672148 * r672148;
double r672150 = r672147 + r672149;
double r672151 = sqrt(r672150);
double r672152 = r672146 ? r672151 : r672140;
double r672153 = r672142 ? r672144 : r672152;
return r672153;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 17.4 |
| Herbie | 17.5 |
if x < -1.4667592323261061e+131Initial program 58.9
Taylor expanded around -inf 8.8
if -1.4667592323261061e+131 < x < 1.3722084465878742e+86Initial program 21.0
if 1.3722084465878742e+86 < x Initial program 50.0
Taylor expanded around inf 10.9
Final simplification17.5
herbie shell --seed 2020027
(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))))