1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.941146194758038734:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\left(1 + \frac{1}{y}\right) \cdot \frac{x}{y} - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r377051 = 1.0;
double r377052 = x;
double r377053 = y;
double r377054 = r377052 - r377053;
double r377055 = r377051 - r377053;
double r377056 = r377054 / r377055;
double r377057 = r377051 - r377056;
double r377058 = log(r377057);
double r377059 = r377051 - r377058;
return r377059;
}
double f(double x, double y) {
double r377060 = x;
double r377061 = y;
double r377062 = r377060 - r377061;
double r377063 = 1.0;
double r377064 = r377063 - r377061;
double r377065 = r377062 / r377064;
double r377066 = 0.9411461947580387;
bool r377067 = r377065 <= r377066;
double r377068 = 1.0;
double r377069 = r377068 / r377064;
double r377070 = r377062 * r377069;
double r377071 = r377063 - r377070;
double r377072 = log(r377071);
double r377073 = r377063 - r377072;
double r377074 = r377063 / r377061;
double r377075 = r377068 + r377074;
double r377076 = r377060 / r377061;
double r377077 = r377075 * r377076;
double r377078 = r377077 - r377074;
double r377079 = log(r377078);
double r377080 = r377063 - r377079;
double r377081 = r377067 ? r377073 : r377080;
return r377081;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9411461947580387Initial program 0.0
rmApplied div-inv0.0
if 0.9411461947580387 < (/ (- x y) (- 1.0 y)) Initial program 61.4
Taylor expanded around inf 0.7
Simplified0.7
Final simplification0.2
herbie shell --seed 2020045
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.61947241) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))