\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 r433600 = x;
double r433601 = r433600 * r433600;
double r433602 = y;
double r433603 = r433601 + r433602;
double r433604 = sqrt(r433603);
return r433604;
}
double f(double x, double y) {
double r433605 = x;
double r433606 = -1.3303999492099964e+154;
bool r433607 = r433605 <= r433606;
double r433608 = y;
double r433609 = r433608 / r433605;
double r433610 = -0.5;
double r433611 = r433609 * r433610;
double r433612 = r433611 - r433605;
double r433613 = 6.063771965228405e+84;
bool r433614 = r433605 <= r433613;
double r433615 = r433605 * r433605;
double r433616 = r433615 + r433608;
double r433617 = sqrt(r433616);
double r433618 = 0.5;
double r433619 = r433618 * r433609;
double r433620 = r433605 + r433619;
double r433621 = r433614 ? r433617 : r433620;
double r433622 = r433607 ? r433612 : r433621;
return r433622;
}




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)))