\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.28151121097985566 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 3.3825854527583296 \cdot 10^{81}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r592482 = x;
double r592483 = r592482 * r592482;
double r592484 = y;
double r592485 = r592483 + r592484;
double r592486 = sqrt(r592485);
return r592486;
}
double f(double x, double y) {
double r592487 = x;
double r592488 = -1.2815112109798557e+154;
bool r592489 = r592487 <= r592488;
double r592490 = y;
double r592491 = r592490 / r592487;
double r592492 = -0.5;
double r592493 = r592491 * r592492;
double r592494 = r592493 - r592487;
double r592495 = 3.3825854527583296e+81;
bool r592496 = r592487 <= r592495;
double r592497 = r592487 * r592487;
double r592498 = r592497 + r592490;
double r592499 = sqrt(r592498);
double r592500 = 0.5;
double r592501 = r592500 * r592491;
double r592502 = r592487 + r592501;
double r592503 = r592496 ? r592499 : r592502;
double r592504 = r592489 ? r592494 : r592503;
return r592504;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.4 |
|---|---|
| Target | 0.5 |
| Herbie | 0.3 |
if x < -1.2815112109798557e+154Initial program 63.9
Taylor expanded around -inf 0.0
Simplified0.0
if -1.2815112109798557e+154 < x < 3.3825854527583296e+81Initial program 0.0
if 3.3825854527583296e+81 < x Initial program 44.2
Taylor expanded around inf 1.1
Final simplification0.3
herbie shell --seed 2020046
(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)))