1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -1123308855491800.2 \lor \neg \left(y \le 106063957.48696265\right):\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}}, \frac{x}{y}\right) - \frac{1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\end{array}double f(double x, double y) {
double r263755 = 1.0;
double r263756 = x;
double r263757 = y;
double r263758 = r263756 - r263757;
double r263759 = r263755 - r263757;
double r263760 = r263758 / r263759;
double r263761 = r263755 - r263760;
double r263762 = log(r263761);
double r263763 = r263755 - r263762;
return r263763;
}
double f(double x, double y) {
double r263764 = y;
double r263765 = -1123308855491800.2;
bool r263766 = r263764 <= r263765;
double r263767 = 106063957.48696265;
bool r263768 = r263764 <= r263767;
double r263769 = !r263768;
bool r263770 = r263766 || r263769;
double r263771 = 1.0;
double r263772 = x;
double r263773 = 2.0;
double r263774 = pow(r263764, r263773);
double r263775 = r263772 / r263774;
double r263776 = r263772 / r263764;
double r263777 = fma(r263771, r263775, r263776);
double r263778 = r263771 / r263764;
double r263779 = r263777 - r263778;
double r263780 = log(r263779);
double r263781 = r263771 - r263780;
double r263782 = r263772 - r263764;
double r263783 = 1.0;
double r263784 = r263771 - r263764;
double r263785 = r263783 / r263784;
double r263786 = r263782 * r263785;
double r263787 = r263771 - r263786;
double r263788 = log(r263787);
double r263789 = r263771 - r263788;
double r263790 = r263770 ? r263781 : r263789;
return r263790;
}




Bits error versus x




Bits error versus y
| Original | 17.9 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if y < -1123308855491800.2 or 106063957.48696265 < y Initial program 46.6
Taylor expanded around inf 0.0
Simplified0.0
if -1123308855491800.2 < y < 106063957.48696265Initial program 0.3
rmApplied div-inv0.3
Final simplification0.2
herbie shell --seed 2019199 +o rules:numerics
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:herbie-target
(if (< y -81284752.61947241) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y))))) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))
(- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))