1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.8658429469844214354523614929348696023226:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{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 r337171 = 1.0;
double r337172 = x;
double r337173 = y;
double r337174 = r337172 - r337173;
double r337175 = r337171 - r337173;
double r337176 = r337174 / r337175;
double r337177 = r337171 - r337176;
double r337178 = log(r337177);
double r337179 = r337171 - r337178;
return r337179;
}
double f(double x, double y) {
double r337180 = x;
double r337181 = y;
double r337182 = r337180 - r337181;
double r337183 = 1.0;
double r337184 = r337183 - r337181;
double r337185 = r337182 / r337184;
double r337186 = 0.8658429469844214;
bool r337187 = r337185 <= r337186;
double r337188 = exp(r337183);
double r337189 = r337183 - r337185;
double r337190 = r337188 / r337189;
double r337191 = log(r337190);
double r337192 = 2.0;
double r337193 = pow(r337181, r337192);
double r337194 = r337180 / r337193;
double r337195 = 1.0;
double r337196 = r337195 / r337181;
double r337197 = r337194 - r337196;
double r337198 = r337183 * r337197;
double r337199 = r337180 / r337181;
double r337200 = r337198 + r337199;
double r337201 = log(r337200);
double r337202 = r337183 - r337201;
double r337203 = r337187 ? r337191 : r337202;
return r337203;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.8658429469844214Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
if 0.8658429469844214 < (/ (- x y) (- 1.0 y)) Initial program 61.3
Taylor expanded around inf 0.7
Simplified0.7
Final simplification0.2
herbie shell --seed 2019294
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.619472414) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))