\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.321177529973866349487419790268642426336 \cdot 10^{154}:\\
\;\;\;\;-\mathsf{fma}\left(\frac{\frac{1}{2}}{x}, y, x\right)\\
\mathbf{elif}\;x \le 1.785490461401806573968894092684210024398 \cdot 10^{149}:\\
\;\;\;\;\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 r464378 = x;
double r464379 = r464378 * r464378;
double r464380 = y;
double r464381 = r464379 + r464380;
double r464382 = sqrt(r464381);
return r464382;
}
double f(double x, double y) {
double r464383 = x;
double r464384 = -1.3211775299738663e+154;
bool r464385 = r464383 <= r464384;
double r464386 = 0.5;
double r464387 = r464386 / r464383;
double r464388 = y;
double r464389 = fma(r464387, r464388, r464383);
double r464390 = -r464389;
double r464391 = 1.7854904614018066e+149;
bool r464392 = r464383 <= r464391;
double r464393 = fma(r464383, r464383, r464388);
double r464394 = sqrt(r464393);
double r464395 = r464388 / r464383;
double r464396 = fma(r464395, r464386, r464383);
double r464397 = r464392 ? r464394 : r464396;
double r464398 = r464385 ? r464390 : r464397;
return r464398;
}




Bits error versus x




Bits error versus y
| Original | 20.7 |
|---|---|
| Target | 0.6 |
| Herbie | 0.0 |
if x < -1.3211775299738663e+154Initial program 64.0
Simplified64.0
Taylor expanded around -inf 0
Simplified0
if -1.3211775299738663e+154 < x < 1.7854904614018066e+149Initial program 0.0
Simplified0.0
if 1.7854904614018066e+149 < x Initial program 61.8
Simplified61.8
Taylor expanded around inf 0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019179 +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)))