\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.3374804328684521 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 1.7963572810955448 \cdot 10^{152}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r519842 = x;
double r519843 = r519842 * r519842;
double r519844 = y;
double r519845 = r519843 + r519844;
double r519846 = sqrt(r519845);
return r519846;
}
double f(double x, double y) {
double r519847 = x;
double r519848 = -1.3374804328684521e+154;
bool r519849 = r519847 <= r519848;
double r519850 = y;
double r519851 = r519850 / r519847;
double r519852 = -0.5;
double r519853 = r519851 * r519852;
double r519854 = r519853 - r519847;
double r519855 = 1.7963572810955448e+152;
bool r519856 = r519847 <= r519855;
double r519857 = r519847 * r519847;
double r519858 = r519857 + r519850;
double r519859 = sqrt(r519858);
double r519860 = 0.5;
double r519861 = r519860 * r519851;
double r519862 = r519847 + r519861;
double r519863 = r519856 ? r519859 : r519862;
double r519864 = r519849 ? r519854 : r519863;
return r519864;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.3 |
|---|---|
| Target | 0.4 |
| Herbie | 0.0 |
if x < -1.3374804328684521e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3374804328684521e+154 < x < 1.7963572810955448e+152Initial program 0.0
if 1.7963572810955448e+152 < x Initial program 62.8
Taylor expanded around inf 0
Final simplification0.0
herbie shell --seed 2020043
(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)))