\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.364714454837564 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -3.2241936526231514 \cdot 10^{-170}:\\
\;\;\;\;\sqrt[3]{\left(\frac{1}{\frac{\mathsf{fma}\left(y, y, x \cdot x\right)}{\left(x - y\right) \cdot \left(y + x\right)}} \cdot \frac{1}{\frac{\mathsf{fma}\left(y, y, x \cdot x\right)}{\left(x - y\right) \cdot \left(y + x\right)}}\right) \cdot \frac{1}{\frac{\mathsf{fma}\left(y, y, x \cdot x\right)}{\left(x - y\right) \cdot \left(y + x\right)}}}\\
\mathbf{elif}\;y \le -1.0663270652980943 \cdot 10^{-198}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 6.518473908454177 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(y, y, x \cdot x\right)}{\left(x - y\right) \cdot \left(y + x\right)}}\\
\end{array}double f(double x, double y) {
double r2162631 = x;
double r2162632 = y;
double r2162633 = r2162631 - r2162632;
double r2162634 = r2162631 + r2162632;
double r2162635 = r2162633 * r2162634;
double r2162636 = r2162631 * r2162631;
double r2162637 = r2162632 * r2162632;
double r2162638 = r2162636 + r2162637;
double r2162639 = r2162635 / r2162638;
return r2162639;
}
double f(double x, double y) {
double r2162640 = y;
double r2162641 = -1.364714454837564e+154;
bool r2162642 = r2162640 <= r2162641;
double r2162643 = -1.0;
double r2162644 = -3.2241936526231514e-170;
bool r2162645 = r2162640 <= r2162644;
double r2162646 = 1.0;
double r2162647 = x;
double r2162648 = r2162647 * r2162647;
double r2162649 = fma(r2162640, r2162640, r2162648);
double r2162650 = r2162647 - r2162640;
double r2162651 = r2162640 + r2162647;
double r2162652 = r2162650 * r2162651;
double r2162653 = r2162649 / r2162652;
double r2162654 = r2162646 / r2162653;
double r2162655 = r2162654 * r2162654;
double r2162656 = r2162655 * r2162654;
double r2162657 = cbrt(r2162656);
double r2162658 = -1.0663270652980943e-198;
bool r2162659 = r2162640 <= r2162658;
double r2162660 = 6.518473908454177e-162;
bool r2162661 = r2162640 <= r2162660;
double r2162662 = r2162661 ? r2162646 : r2162654;
double r2162663 = r2162659 ? r2162643 : r2162662;
double r2162664 = r2162645 ? r2162657 : r2162663;
double r2162665 = r2162642 ? r2162643 : r2162664;
return r2162665;
}




Bits error versus x




Bits error versus y
| Original | 19.6 |
|---|---|
| Target | 0.1 |
| Herbie | 5.3 |
if y < -1.364714454837564e+154 or -3.2241936526231514e-170 < y < -1.0663270652980943e-198Initial program 58.3
Simplified58.3
rmApplied clear-num58.3
rmApplied add-cbrt-cube58.3
Taylor expanded around inf 6.2
if -1.364714454837564e+154 < y < -3.2241936526231514e-170Initial program 0.6
Simplified0.6
rmApplied clear-num0.6
rmApplied add-cbrt-cube0.6
if -1.0663270652980943e-198 < y < 6.518473908454177e-162Initial program 28.6
Simplified28.6
Taylor expanded around inf 13.5
if 6.518473908454177e-162 < y Initial program 0.0
Simplified0.0
rmApplied clear-num0.0
Final simplification5.3
herbie shell --seed 2019134 +o rules:numerics
(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))))