\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.336927375966215258326160736033930548748 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 6.791589890324519170947728943797958496879 \cdot 10^{101}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r384522 = x;
double r384523 = r384522 * r384522;
double r384524 = y;
double r384525 = r384523 + r384524;
double r384526 = sqrt(r384525);
return r384526;
}
double f(double x, double y) {
double r384527 = x;
double r384528 = -1.3369273759662153e+154;
bool r384529 = r384527 <= r384528;
double r384530 = y;
double r384531 = r384530 / r384527;
double r384532 = -0.5;
double r384533 = r384531 * r384532;
double r384534 = r384533 - r384527;
double r384535 = 6.791589890324519e+101;
bool r384536 = r384527 <= r384535;
double r384537 = r384527 * r384527;
double r384538 = r384537 + r384530;
double r384539 = sqrt(r384538);
double r384540 = 0.5;
double r384541 = r384540 * r384531;
double r384542 = r384527 + r384541;
double r384543 = r384536 ? r384539 : r384542;
double r384544 = r384529 ? r384534 : r384543;
return r384544;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.2 |
|---|---|
| Target | 0.5 |
| Herbie | 0.1 |
if x < -1.3369273759662153e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3369273759662153e+154 < x < 6.791589890324519e+101Initial program 0.0
if 6.791589890324519e+101 < x Initial program 47.6
Taylor expanded around inf 0.6
Final simplification0.1
herbie shell --seed 2019208
(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)))