1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \le -18067858855719976 \lor \neg \left(y \le 7.03747293035493089 \cdot 10^{31}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{1}{y} - 1, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \frac{1}{y + 1}, x - 1, 1\right)\\
\end{array}double f(double x, double y) {
double r622856 = 1.0;
double r622857 = x;
double r622858 = r622856 - r622857;
double r622859 = y;
double r622860 = r622858 * r622859;
double r622861 = r622859 + r622856;
double r622862 = r622860 / r622861;
double r622863 = r622856 - r622862;
return r622863;
}
double f(double x, double y) {
double r622864 = y;
double r622865 = -18067858855719976.0;
bool r622866 = r622864 <= r622865;
double r622867 = 7.037472930354931e+31;
bool r622868 = r622864 <= r622867;
double r622869 = !r622868;
bool r622870 = r622866 || r622869;
double r622871 = x;
double r622872 = r622871 / r622864;
double r622873 = 1.0;
double r622874 = r622873 / r622864;
double r622875 = r622874 - r622873;
double r622876 = fma(r622872, r622875, r622871);
double r622877 = 1.0;
double r622878 = r622864 + r622873;
double r622879 = r622877 / r622878;
double r622880 = r622864 * r622879;
double r622881 = r622871 - r622873;
double r622882 = fma(r622880, r622881, r622873);
double r622883 = r622870 ? r622876 : r622882;
return r622883;
}




Bits error versus x




Bits error versus y
| Original | 22.1 |
|---|---|
| Target | 0.2 |
| Herbie | 7.4 |
if y < -18067858855719976.0 or 7.037472930354931e+31 < y Initial program 46.8
Simplified28.9
Taylor expanded around inf 14.8
Simplified14.8
if -18067858855719976.0 < y < 7.037472930354931e+31Initial program 1.3
Simplified1.2
rmApplied div-inv1.2
Final simplification7.4
herbie shell --seed 2020036 +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))))