1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9999999625628327448723098314076196402311:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x}{y} \cdot \left(\frac{1}{y} + 1\right) - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r19284156 = 1.0;
double r19284157 = x;
double r19284158 = y;
double r19284159 = r19284157 - r19284158;
double r19284160 = r19284156 - r19284158;
double r19284161 = r19284159 / r19284160;
double r19284162 = r19284156 - r19284161;
double r19284163 = log(r19284162);
double r19284164 = r19284156 - r19284163;
return r19284164;
}
double f(double x, double y) {
double r19284165 = x;
double r19284166 = y;
double r19284167 = r19284165 - r19284166;
double r19284168 = 1.0;
double r19284169 = r19284168 - r19284166;
double r19284170 = r19284167 / r19284169;
double r19284171 = 0.9999999625628327;
bool r19284172 = r19284170 <= r19284171;
double r19284173 = exp(r19284168);
double r19284174 = r19284168 - r19284170;
double r19284175 = r19284173 / r19284174;
double r19284176 = log(r19284175);
double r19284177 = r19284165 / r19284166;
double r19284178 = r19284168 / r19284166;
double r19284179 = 1.0;
double r19284180 = r19284178 + r19284179;
double r19284181 = r19284177 * r19284180;
double r19284182 = r19284181 - r19284178;
double r19284183 = log(r19284182);
double r19284184 = r19284168 - r19284183;
double r19284185 = r19284172 ? r19284176 : r19284184;
return r19284185;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.9 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if (/ (- x y) (- 1.0 y)) < 0.9999999625628327Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
if 0.9999999625628327 < (/ (- x y) (- 1.0 y)) Initial program 62.8
Taylor expanded around inf 0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019168
(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))))))