\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3561015051531283 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -2.0295842870860447 \cdot 10^{-160}:\\
\;\;\;\;\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.5669239890129575 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\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)}\\
\end{array}double f(double x, double y) {
double r2154700 = x;
double r2154701 = y;
double r2154702 = r2154700 - r2154701;
double r2154703 = r2154700 + r2154701;
double r2154704 = r2154702 * r2154703;
double r2154705 = r2154700 * r2154700;
double r2154706 = r2154701 * r2154701;
double r2154707 = r2154705 + r2154706;
double r2154708 = r2154704 / r2154707;
return r2154708;
}
double f(double x, double y) {
double r2154709 = y;
double r2154710 = -1.3561015051531283e+154;
bool r2154711 = r2154709 <= r2154710;
double r2154712 = -1.0;
double r2154713 = -2.0295842870860447e-160;
bool r2154714 = r2154709 <= r2154713;
double r2154715 = x;
double r2154716 = r2154715 * r2154715;
double r2154717 = r2154709 * r2154709;
double r2154718 = r2154716 + r2154717;
double r2154719 = r2154716 / r2154718;
double r2154720 = r2154717 / r2154718;
double r2154721 = r2154719 - r2154720;
double r2154722 = r2154721 * r2154721;
double r2154723 = r2154722 * r2154721;
double r2154724 = cbrt(r2154723);
double r2154725 = 1.5669239890129575e-162;
bool r2154726 = r2154709 <= r2154725;
double r2154727 = 1.0;
double r2154728 = r2154726 ? r2154727 : r2154724;
double r2154729 = r2154714 ? r2154724 : r2154728;
double r2154730 = r2154711 ? r2154712 : r2154729;
return r2154730;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.5 |
|---|---|
| Target | 0.1 |
| Herbie | 5.2 |
if y < -1.3561015051531283e+154Initial program 63.6
Simplified63.6
Taylor expanded around 0 0
if -1.3561015051531283e+154 < y < -2.0295842870860447e-160 or 1.5669239890129575e-162 < y Initial program 0.1
Simplified0.1
rmApplied add-cbrt-cube0.1
if -2.0295842870860447e-160 < y < 1.5669239890129575e-162Initial program 30.7
Simplified30.7
Taylor expanded around -inf 16.2
Final simplification5.2
herbie shell --seed 2019130
(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))))