\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.354574227411527670224267982161705278163 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 8.970759006124063597546869044071596379693 \cdot 10^{123}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r418372 = x;
double r418373 = r418372 * r418372;
double r418374 = y;
double r418375 = r418373 + r418374;
double r418376 = sqrt(r418375);
return r418376;
}
double f(double x, double y) {
double r418377 = x;
double r418378 = -1.3545742274115277e+154;
bool r418379 = r418377 <= r418378;
double r418380 = y;
double r418381 = r418380 / r418377;
double r418382 = -0.5;
double r418383 = r418381 * r418382;
double r418384 = r418383 - r418377;
double r418385 = 8.970759006124064e+123;
bool r418386 = r418377 <= r418385;
double r418387 = r418377 * r418377;
double r418388 = r418387 + r418380;
double r418389 = sqrt(r418388);
double r418390 = 0.5;
double r418391 = r418390 * r418381;
double r418392 = r418377 + r418391;
double r418393 = r418386 ? r418389 : r418392;
double r418394 = r418379 ? r418384 : r418393;
return r418394;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.6 |
|---|---|
| Target | 0.5 |
| Herbie | 0.0 |
if x < -1.3545742274115277e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3545742274115277e+154 < x < 8.970759006124064e+123Initial program 0.0
if 8.970759006124064e+123 < x Initial program 54.2
Taylor expanded around inf 0.2
Final simplification0.0
herbie shell --seed 2019212
(FPCore (x y)
:name "Linear.Quaternion:$clog from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< x -1.5097698010472593e153) (- (+ (* 0.5 (/ y x)) x)) (if (< x 5.5823995511225407e57) (sqrt (+ (* x x) y)) (+ (* 0.5 (/ y x)) x)))
(sqrt (+ (* x x) y)))