1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \le -4.38962381722942814 \cdot 10^{28} \lor \neg \left(y \le 103782153027757.69\right):\\
\;\;\;\;\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{x}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\
\end{array}double f(double x, double y) {
double r2779 = 1.0;
double r2780 = x;
double r2781 = r2779 - r2780;
double r2782 = y;
double r2783 = r2781 * r2782;
double r2784 = r2782 + r2779;
double r2785 = r2783 / r2784;
double r2786 = r2779 - r2785;
return r2786;
}
double f(double x, double y) {
double r2787 = y;
double r2788 = -4.389623817229428e+28;
bool r2789 = r2787 <= r2788;
double r2790 = 103782153027757.69;
bool r2791 = r2787 <= r2790;
double r2792 = !r2791;
bool r2793 = r2789 || r2792;
double r2794 = 1.0;
double r2795 = x;
double r2796 = 2.0;
double r2797 = pow(r2787, r2796);
double r2798 = r2795 / r2797;
double r2799 = r2795 / r2787;
double r2800 = r2798 - r2799;
double r2801 = fma(r2794, r2800, r2795);
double r2802 = r2794 - r2795;
double r2803 = r2802 * r2787;
double r2804 = r2787 + r2794;
double r2805 = r2803 / r2804;
double r2806 = r2794 - r2805;
double r2807 = r2793 ? r2801 : r2806;
return r2807;
}




Bits error versus x




Bits error versus y
| Original | 22.7 |
|---|---|
| Target | 0.2 |
| Herbie | 7.4 |
if y < -4.389623817229428e+28 or 103782153027757.69 < y Initial program 47.0
Simplified29.1
rmApplied add-cube-cbrt29.9
Applied *-un-lft-identity29.9
Applied times-frac29.9
Taylor expanded around inf 14.1
Simplified14.1
if -4.389623817229428e+28 < y < 103782153027757.69Initial program 1.4
Final simplification7.4
herbie shell --seed 2020025 +o rules:numerics
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x))))
(- 1 (/ (* (- 1 x) y) (+ y 1))))