\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.375458412520537572590774977918936206023 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 2.058549686456957362651677908428126133886 \cdot 10^{132}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r346461 = x;
double r346462 = r346461 * r346461;
double r346463 = y;
double r346464 = r346462 + r346463;
double r346465 = sqrt(r346464);
return r346465;
}
double f(double x, double y) {
double r346466 = x;
double r346467 = -1.3754584125205376e+154;
bool r346468 = r346466 <= r346467;
double r346469 = y;
double r346470 = r346469 / r346466;
double r346471 = -0.5;
double r346472 = r346470 * r346471;
double r346473 = r346472 - r346466;
double r346474 = 2.0585496864569574e+132;
bool r346475 = r346466 <= r346474;
double r346476 = r346466 * r346466;
double r346477 = r346476 + r346469;
double r346478 = sqrt(r346477);
double r346479 = 0.5;
double r346480 = r346479 * r346470;
double r346481 = r346466 + r346480;
double r346482 = r346475 ? r346478 : r346481;
double r346483 = r346468 ? r346473 : r346482;
return r346483;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.0 |
|---|---|
| Target | 0.6 |
| Herbie | 0.0 |
if x < -1.3754584125205376e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3754584125205376e+154 < x < 2.0585496864569574e+132Initial program 0.0
if 2.0585496864569574e+132 < x Initial program 56.3
Taylor expanded around inf 0.2
Final simplification0.0
herbie shell --seed 2019325
(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)))