\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.3285272782249076 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 1.2357322782900815 \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 r531047 = x;
double r531048 = r531047 * r531047;
double r531049 = y;
double r531050 = r531048 + r531049;
double r531051 = sqrt(r531050);
return r531051;
}
double f(double x, double y) {
double r531052 = x;
double r531053 = -1.3285272782249076e+154;
bool r531054 = r531052 <= r531053;
double r531055 = y;
double r531056 = r531055 / r531052;
double r531057 = -0.5;
double r531058 = r531056 * r531057;
double r531059 = r531058 - r531052;
double r531060 = 1.2357322782900815e+112;
bool r531061 = r531052 <= r531060;
double r531062 = r531052 * r531052;
double r531063 = r531062 + r531055;
double r531064 = sqrt(r531063);
double r531065 = 0.5;
double r531066 = r531065 * r531056;
double r531067 = r531052 + r531066;
double r531068 = r531061 ? r531064 : r531067;
double r531069 = r531054 ? r531059 : r531068;
return r531069;
}




Bits error versus x




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