\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3622257246714918 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -4.0918058340644614 \cdot 10^{-167}:\\
\;\;\;\;\sqrt[3]{\left(\left(\frac{x \cdot x}{x \cdot x + y \cdot y} - \frac{y \cdot y}{x \cdot x + y \cdot y}\right) \cdot \left(\frac{x \cdot x}{x \cdot x + y \cdot y} - \frac{y \cdot y}{x \cdot x + y \cdot y}\right)\right) \cdot \left(\frac{x \cdot x}{x \cdot x + y \cdot y} - \frac{y \cdot y}{x \cdot x + y \cdot y}\right)}\\
\mathbf{elif}\;y \le -1.9618167972718326 \cdot 10^{-179}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 3.050134070228654 \cdot 10^{-166}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + y \cdot y} - \log \left(e^{\frac{y \cdot y}{x \cdot x + y \cdot y}}\right)\\
\end{array}double f(double x, double y) {
double r3551175 = x;
double r3551176 = y;
double r3551177 = r3551175 - r3551176;
double r3551178 = r3551175 + r3551176;
double r3551179 = r3551177 * r3551178;
double r3551180 = r3551175 * r3551175;
double r3551181 = r3551176 * r3551176;
double r3551182 = r3551180 + r3551181;
double r3551183 = r3551179 / r3551182;
return r3551183;
}
double f(double x, double y) {
double r3551184 = y;
double r3551185 = -1.3622257246714918e+154;
bool r3551186 = r3551184 <= r3551185;
double r3551187 = -1.0;
double r3551188 = -4.0918058340644614e-167;
bool r3551189 = r3551184 <= r3551188;
double r3551190 = x;
double r3551191 = r3551190 * r3551190;
double r3551192 = r3551184 * r3551184;
double r3551193 = r3551191 + r3551192;
double r3551194 = r3551191 / r3551193;
double r3551195 = r3551192 / r3551193;
double r3551196 = r3551194 - r3551195;
double r3551197 = r3551196 * r3551196;
double r3551198 = r3551197 * r3551196;
double r3551199 = cbrt(r3551198);
double r3551200 = -1.9618167972718326e-179;
bool r3551201 = r3551184 <= r3551200;
double r3551202 = 3.050134070228654e-166;
bool r3551203 = r3551184 <= r3551202;
double r3551204 = 1.0;
double r3551205 = exp(r3551195);
double r3551206 = log(r3551205);
double r3551207 = r3551194 - r3551206;
double r3551208 = r3551203 ? r3551204 : r3551207;
double r3551209 = r3551201 ? r3551187 : r3551208;
double r3551210 = r3551189 ? r3551199 : r3551209;
double r3551211 = r3551186 ? r3551187 : r3551210;
return r3551211;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.5 |
|---|---|
| Target | 0.1 |
| Herbie | 4.7 |
if y < -1.3622257246714918e+154 or -4.0918058340644614e-167 < y < -1.9618167972718326e-179Initial program 61.9
Simplified61.9
rmApplied add-log-exp61.9
Taylor expanded around 0 2.0
if -1.3622257246714918e+154 < y < -4.0918058340644614e-167Initial program 0.4
Simplified0.4
rmApplied add-log-exp0.4
rmApplied add-cbrt-cube0.4
Simplified0.4
if -1.9618167972718326e-179 < y < 3.050134070228654e-166Initial program 28.5
Simplified28.5
rmApplied add-log-exp28.5
Taylor expanded around -inf 14.5
if 3.050134070228654e-166 < y Initial program 0.4
Simplified0.4
rmApplied add-log-exp0.4
Final simplification4.7
herbie shell --seed 2019143
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 0 x 1) (< y 1))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1 (/ 2 (+ 1 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))