\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.37787330356564457 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 1.29225661239445747 \cdot 10^{80}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r634248 = x;
double r634249 = r634248 * r634248;
double r634250 = y;
double r634251 = r634249 + r634250;
double r634252 = sqrt(r634251);
return r634252;
}
double f(double x, double y) {
double r634253 = x;
double r634254 = -1.3778733035656446e+154;
bool r634255 = r634253 <= r634254;
double r634256 = y;
double r634257 = r634256 / r634253;
double r634258 = -0.5;
double r634259 = r634257 * r634258;
double r634260 = r634259 - r634253;
double r634261 = 1.2922566123944575e+80;
bool r634262 = r634253 <= r634261;
double r634263 = r634253 * r634253;
double r634264 = r634263 + r634256;
double r634265 = sqrt(r634264);
double r634266 = 0.5;
double r634267 = r634266 * r634257;
double r634268 = r634253 + r634267;
double r634269 = r634262 ? r634265 : r634268;
double r634270 = r634255 ? r634260 : r634269;
return r634270;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.3 |
|---|---|
| Target | 0.6 |
| Herbie | 0.4 |
if x < -1.3778733035656446e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3778733035656446e+154 < x < 1.2922566123944575e+80Initial program 0.0
if 1.2922566123944575e+80 < x Initial program 44.1
Taylor expanded around inf 1.5
Final simplification0.4
herbie shell --seed 2020047
(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)))