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(1, \frac{x}{{y}^{2}} - \frac{x}{y}, 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 r676796 = 1.0;
double r676797 = x;
double r676798 = r676796 - r676797;
double r676799 = y;
double r676800 = r676798 * r676799;
double r676801 = r676799 + r676796;
double r676802 = r676800 / r676801;
double r676803 = r676796 - r676802;
return r676803;
}
double f(double x, double y) {
double r676804 = y;
double r676805 = -18067858855719976.0;
bool r676806 = r676804 <= r676805;
double r676807 = 7.037472930354931e+31;
bool r676808 = r676804 <= r676807;
double r676809 = !r676808;
bool r676810 = r676806 || r676809;
double r676811 = 1.0;
double r676812 = x;
double r676813 = 2.0;
double r676814 = pow(r676804, r676813);
double r676815 = r676812 / r676814;
double r676816 = r676812 / r676804;
double r676817 = r676815 - r676816;
double r676818 = fma(r676811, r676817, r676812);
double r676819 = 1.0;
double r676820 = r676804 + r676811;
double r676821 = r676819 / r676820;
double r676822 = r676804 * r676821;
double r676823 = r676812 - r676811;
double r676824 = fma(r676822, r676823, r676811);
double r676825 = r676810 ? r676818 : r676824;
return r676825;
}




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
rmApplied div-inv29.0
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))))