\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.163461482030304147197123634102301164915 \cdot 10^{154}:\\
\;\;\;\;-\mathsf{fma}\left(\frac{\frac{1}{2}}{x}, y, x\right)\\
\mathbf{elif}\;x \le 2.648277919935003443657636145779230905143 \cdot 10^{92}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(x, x, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x}, \frac{1}{2}, x\right)\\
\end{array}double f(double x, double y) {
double r421023 = x;
double r421024 = r421023 * r421023;
double r421025 = y;
double r421026 = r421024 + r421025;
double r421027 = sqrt(r421026);
return r421027;
}
double f(double x, double y) {
double r421028 = x;
double r421029 = -1.1634614820303041e+154;
bool r421030 = r421028 <= r421029;
double r421031 = 0.5;
double r421032 = r421031 / r421028;
double r421033 = y;
double r421034 = fma(r421032, r421033, r421028);
double r421035 = -r421034;
double r421036 = 2.6482779199350034e+92;
bool r421037 = r421028 <= r421036;
double r421038 = fma(r421028, r421028, r421033);
double r421039 = sqrt(r421038);
double r421040 = r421033 / r421028;
double r421041 = fma(r421040, r421031, r421028);
double r421042 = r421037 ? r421039 : r421041;
double r421043 = r421030 ? r421035 : r421042;
return r421043;
}




Bits error versus x




Bits error versus y
| Original | 21.3 |
|---|---|
| Target | 0.6 |
| Herbie | 0.2 |
if x < -1.1634614820303041e+154Initial program 64.0
Simplified64.0
Taylor expanded around -inf 0
Simplified0
if -1.1634614820303041e+154 < x < 2.6482779199350034e+92Initial program 0.0
Simplified0.0
if 2.6482779199350034e+92 < x Initial program 46.3
Simplified46.3
Taylor expanded around inf 1.0
Simplified1.0
Final simplification0.2
herbie shell --seed 2019196 +o rules:numerics
(FPCore (x y)
:name "Linear.Quaternion:$clog from linear-1.19.1.3"
: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)))