1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.999999374492958393:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 \cdot \left(\frac{x}{{y}^{2}} - \frac{1}{y}\right) + \frac{x}{y}\right)\\
\end{array}double f(double x, double y) {
double r455168 = 1.0;
double r455169 = x;
double r455170 = y;
double r455171 = r455169 - r455170;
double r455172 = r455168 - r455170;
double r455173 = r455171 / r455172;
double r455174 = r455168 - r455173;
double r455175 = log(r455174);
double r455176 = r455168 - r455175;
return r455176;
}
double f(double x, double y) {
double r455177 = x;
double r455178 = y;
double r455179 = r455177 - r455178;
double r455180 = 1.0;
double r455181 = r455180 - r455178;
double r455182 = r455179 / r455181;
double r455183 = 0.9999993744929584;
bool r455184 = r455182 <= r455183;
double r455185 = 1.0;
double r455186 = r455185 / r455181;
double r455187 = r455179 * r455186;
double r455188 = r455180 - r455187;
double r455189 = log(r455188);
double r455190 = r455180 - r455189;
double r455191 = 2.0;
double r455192 = pow(r455178, r455191);
double r455193 = r455177 / r455192;
double r455194 = r455185 / r455178;
double r455195 = r455193 - r455194;
double r455196 = r455180 * r455195;
double r455197 = r455177 / r455178;
double r455198 = r455196 + r455197;
double r455199 = log(r455198);
double r455200 = r455180 - r455199;
double r455201 = r455184 ? r455190 : r455200;
return r455201;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9999993744929584Initial program 0.1
rmApplied div-inv0.1
if 0.9999993744929584 < (/ (- x y) (- 1.0 y)) Initial program 62.5
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2020065
(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))))))