\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.336913857166639347415301363669115809283 \cdot 10^{154}:\\
\;\;\;\;-\mathsf{fma}\left(\frac{\frac{1}{2}}{x}, y, x\right)\\
\mathbf{elif}\;x \le 1.574212501990470180534105460064927660599 \cdot 10^{131}:\\
\;\;\;\;\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 r1277676 = x;
double r1277677 = r1277676 * r1277676;
double r1277678 = y;
double r1277679 = r1277677 + r1277678;
double r1277680 = sqrt(r1277679);
return r1277680;
}
double f(double x, double y) {
double r1277681 = x;
double r1277682 = -1.3369138571666393e+154;
bool r1277683 = r1277681 <= r1277682;
double r1277684 = 0.5;
double r1277685 = r1277684 / r1277681;
double r1277686 = y;
double r1277687 = fma(r1277685, r1277686, r1277681);
double r1277688 = -r1277687;
double r1277689 = 1.5742125019904702e+131;
bool r1277690 = r1277681 <= r1277689;
double r1277691 = fma(r1277681, r1277681, r1277686);
double r1277692 = sqrt(r1277691);
double r1277693 = r1277686 / r1277681;
double r1277694 = fma(r1277693, r1277684, r1277681);
double r1277695 = r1277690 ? r1277692 : r1277694;
double r1277696 = r1277683 ? r1277688 : r1277695;
return r1277696;
}




Bits error versus x




Bits error versus y
| Original | 21.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.0 |
if x < -1.3369138571666393e+154Initial program 64.0
Simplified64.0
Taylor expanded around -inf 0
Simplified0
if -1.3369138571666393e+154 < x < 1.5742125019904702e+131Initial program 0.0
Simplified0.0
if 1.5742125019904702e+131 < x Initial program 55.8
Simplified55.8
Taylor expanded around inf 0.1
Simplified0.1
Final simplification0.0
herbie shell --seed 2019194 +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)))