\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.34741200166273024865549457096980522016 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 3.903488335015737711762269431799121933757 \cdot 10^{107}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r603358 = x;
double r603359 = r603358 * r603358;
double r603360 = y;
double r603361 = r603359 + r603360;
double r603362 = sqrt(r603361);
return r603362;
}
double f(double x, double y) {
double r603363 = x;
double r603364 = -1.3474120016627302e+154;
bool r603365 = r603363 <= r603364;
double r603366 = y;
double r603367 = r603366 / r603363;
double r603368 = -0.5;
double r603369 = r603367 * r603368;
double r603370 = r603369 - r603363;
double r603371 = 3.903488335015738e+107;
bool r603372 = r603363 <= r603371;
double r603373 = r603363 * r603363;
double r603374 = r603373 + r603366;
double r603375 = sqrt(r603374);
double r603376 = 0.5;
double r603377 = r603376 * r603367;
double r603378 = r603363 + r603377;
double r603379 = r603372 ? r603375 : r603378;
double r603380 = r603365 ? r603370 : r603379;
return r603380;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.6 |
|---|---|
| Target | 0.4 |
| Herbie | 0.1 |
if x < -1.3474120016627302e+154Initial program 64.0
Taylor expanded around -inf 0.0
Simplified0.0
if -1.3474120016627302e+154 < x < 3.903488335015738e+107Initial program 0.0
if 3.903488335015738e+107 < x Initial program 50.4
Taylor expanded around inf 0.5
Final simplification0.1
herbie shell --seed 2019350
(FPCore (x y)
:name "Linear.Quaternion:$clog from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< x -1.5097698010472593e+153) (- (+ (* 0.5 (/ y x)) x)) (if (< x 5.582399551122541e+57) (sqrt (+ (* x x) y)) (+ (* 0.5 (/ y x)) x)))
(sqrt (+ (* x x) y)))