\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 r383501 = x;
double r383502 = r383501 * r383501;
double r383503 = y;
double r383504 = r383502 + r383503;
double r383505 = sqrt(r383504);
return r383505;
}
double f(double x, double y) {
double r383506 = x;
double r383507 = -1.3754584125205376e+154;
bool r383508 = r383506 <= r383507;
double r383509 = y;
double r383510 = r383509 / r383506;
double r383511 = -0.5;
double r383512 = r383510 * r383511;
double r383513 = r383512 - r383506;
double r383514 = 2.0585496864569574e+132;
bool r383515 = r383506 <= r383514;
double r383516 = r383506 * r383506;
double r383517 = r383516 + r383509;
double r383518 = sqrt(r383517);
double r383519 = 0.5;
double r383520 = r383519 * r383510;
double r383521 = r383506 + r383520;
double r383522 = r383515 ? r383518 : r383521;
double r383523 = r383508 ? r383513 : r383522;
return r383523;
}




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)))