\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.3285272782249076 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 1.2357322782900815 \cdot 10^{112}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r609803 = x;
double r609804 = r609803 * r609803;
double r609805 = y;
double r609806 = r609804 + r609805;
double r609807 = sqrt(r609806);
return r609807;
}
double f(double x, double y) {
double r609808 = x;
double r609809 = -1.3285272782249076e+154;
bool r609810 = r609808 <= r609809;
double r609811 = y;
double r609812 = r609811 / r609808;
double r609813 = -0.5;
double r609814 = r609812 * r609813;
double r609815 = r609814 - r609808;
double r609816 = 1.2357322782900815e+112;
bool r609817 = r609808 <= r609816;
double r609818 = r609808 * r609808;
double r609819 = r609818 + r609811;
double r609820 = sqrt(r609819);
double r609821 = 0.5;
double r609822 = r609821 * r609812;
double r609823 = r609808 + r609822;
double r609824 = r609817 ? r609820 : r609823;
double r609825 = r609810 ? r609815 : r609824;
return r609825;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.0 |
|---|---|
| Target | 0.4 |
| Herbie | 0.1 |
if x < -1.3285272782249076e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.3285272782249076e+154 < x < 1.2357322782900815e+112Initial program 0.0
if 1.2357322782900815e+112 < x Initial program 50.6
Taylor expanded around inf 0.5
Final simplification0.1
herbie shell --seed 2020045
(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)))