\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.334706067250781795686802411753971031003 \cdot 10^{154}:\\
\;\;\;\;-\mathsf{fma}\left(\frac{y}{x}, \frac{1}{2}, x\right)\\
\mathbf{elif}\;x \le 1.439938037416395822463756229119736498067 \cdot 10^{138}:\\
\;\;\;\;\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 r691478 = x;
double r691479 = r691478 * r691478;
double r691480 = y;
double r691481 = r691479 + r691480;
double r691482 = sqrt(r691481);
return r691482;
}
double f(double x, double y) {
double r691483 = x;
double r691484 = -1.3347060672507818e+154;
bool r691485 = r691483 <= r691484;
double r691486 = y;
double r691487 = r691486 / r691483;
double r691488 = 0.5;
double r691489 = fma(r691487, r691488, r691483);
double r691490 = -r691489;
double r691491 = 1.4399380374163958e+138;
bool r691492 = r691483 <= r691491;
double r691493 = fma(r691483, r691483, r691486);
double r691494 = sqrt(r691493);
double r691495 = r691492 ? r691494 : r691489;
double r691496 = r691485 ? r691490 : r691495;
return r691496;
}




Bits error versus x




Bits error versus y
| Original | 21.1 |
|---|---|
| Target | 0.5 |
| Herbie | 0.0 |
if x < -1.3347060672507818e+154Initial program 64.0
Simplified64.0
Taylor expanded around -inf 0
Simplified0
if -1.3347060672507818e+154 < x < 1.4399380374163958e+138Initial program 0.0
Simplified0.0
if 1.4399380374163958e+138 < x Initial program 58.2
Simplified58.2
Taylor expanded around inf 0.2
Simplified0.2
Final simplification0.0
herbie shell --seed 2019351 +o rules:numerics
(FPCore (x y)
:name "Linear.Quaternion:$clog from linear-1.19.1.3"
:precision binary64
: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)))