\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.3614720717698548 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 7.40557002165322956 \cdot 10^{112}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r575674 = x;
double r575675 = r575674 * r575674;
double r575676 = y;
double r575677 = r575675 + r575676;
double r575678 = sqrt(r575677);
return r575678;
}
double f(double x, double y) {
double r575679 = x;
double r575680 = -1.3614720717698548e+154;
bool r575681 = r575679 <= r575680;
double r575682 = y;
double r575683 = r575682 / r575679;
double r575684 = -0.5;
double r575685 = r575683 * r575684;
double r575686 = r575685 - r575679;
double r575687 = 7.4055700216532296e+112;
bool r575688 = r575679 <= r575687;
double r575689 = r575679 * r575679;
double r575690 = r575689 + r575682;
double r575691 = sqrt(r575690);
double r575692 = 0.5;
double r575693 = r575692 * r575683;
double r575694 = r575679 + r575693;
double r575695 = r575688 ? r575691 : r575694;
double r575696 = r575681 ? r575686 : r575695;
return r575696;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.2 |
|---|---|
| Target | 0.5 |
| Herbie | 0.1 |
if x < -1.3614720717698548e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3614720717698548e+154 < x < 7.4055700216532296e+112Initial program 0.0
if 7.4055700216532296e+112 < x Initial program 50.1
Taylor expanded around inf 0.4
Final simplification0.1
herbie shell --seed 2020042
(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)))