\sqrt{x \cdot x + y}\begin{array}{l}
\mathbf{if}\;x \le -1.299677200223385524664624994654815196296 \cdot 10^{154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{-1}{2} - x\\
\mathbf{elif}\;x \le 7.41981782524246538584328907917534943779 \cdot 10^{111}:\\
\;\;\;\;\sqrt{x \cdot x + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{2} \cdot \frac{y}{x}\\
\end{array}double f(double x, double y) {
double r373084 = x;
double r373085 = r373084 * r373084;
double r373086 = y;
double r373087 = r373085 + r373086;
double r373088 = sqrt(r373087);
return r373088;
}
double f(double x, double y) {
double r373089 = x;
double r373090 = -1.2996772002233855e+154;
bool r373091 = r373089 <= r373090;
double r373092 = y;
double r373093 = r373092 / r373089;
double r373094 = -0.5;
double r373095 = r373093 * r373094;
double r373096 = r373095 - r373089;
double r373097 = 7.419817825242465e+111;
bool r373098 = r373089 <= r373097;
double r373099 = r373089 * r373089;
double r373100 = r373099 + r373092;
double r373101 = sqrt(r373100);
double r373102 = 0.5;
double r373103 = r373102 * r373093;
double r373104 = r373089 + r373103;
double r373105 = r373098 ? r373101 : r373104;
double r373106 = r373091 ? r373096 : r373105;
return r373106;
}




Bits error versus x




Bits error versus y
Results
| Original | 21.7 |
|---|---|
| Target | 0.4 |
| Herbie | 0.1 |
if x < -1.2996772002233855e+154Initial program 64.0
Taylor expanded around -inf 0
Simplified0
if -1.2996772002233855e+154 < x < 7.419817825242465e+111Initial program 0.0
if 7.419817825242465e+111 < x Initial program 50.8
Taylor expanded around inf 0.3
Final simplification0.1
herbie shell --seed 2019304
(FPCore (x y)
:name "Linear.Quaternion:$clog from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< x -1.5097698010472593e153) (- (+ (* 0.5 (/ y x)) x)) (if (< x 5.5823995511225407e57) (sqrt (+ (* x x) y)) (+ (* 0.5 (/ y x)) x)))
(sqrt (+ (* x x) y)))