\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.33039994920999637206017606321533586726 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 6.063771965228404863100273443341838455211 \cdot 10^{84}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r426187 = x;
double r426188 = r426187 * r426187;
double r426189 = y;
double r426190 = r426188 + r426189;
double r426191 = sqrt(r426190);
return r426191;
}
double f(double x, double y) {
double r426192 = x;
double r426193 = -1.3303999492099964e+154;
bool r426194 = r426192 <= r426193;
double r426195 = y;
double r426196 = r426195 / r426192;
double r426197 = -0.5;
double r426198 = r426196 * r426197;
double r426199 = r426198 - r426192;
double r426200 = 6.063771965228405e+84;
bool r426201 = r426192 <= r426200;
double r426202 = r426192 * r426192;
double r426203 = r426202 + r426195;
double r426204 = sqrt(r426203);
double r426205 = 0.5;
double r426206 = r426205 * r426196;
double r426207 = r426192 + r426206;
double r426208 = r426201 ? r426204 : r426207;
double r426209 = r426194 ? r426199 : r426208;
return r426209;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.9 |
|---|---|
| Target | 0.5 |
| Herbie | 0.3 |
if x < -1.3303999492099964e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3303999492099964e+154 < x < 6.063771965228405e+84Initial program 0.0
if 6.063771965228405e+84 < x Initial program 43.9
Taylor expanded around inf 1.1
Final simplification0.3
herbie shell --seed 2019303
(FPCore (x y)
:name "Linear.Quaternion:$clog from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< x -1.5097698010472593e153) (- (+ (* 0.5 (/ y x)) x)) (if (< x 5.5823995511225407e57) (sqrt (+ (* x x) y)) (+ (* 0.5 (/ y x)) x)))
(sqrt (+ (* x x) y)))