1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.083471465588124433:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{1}{y}, \frac{x}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r349123 = 1.0;
double r349124 = x;
double r349125 = y;
double r349126 = r349124 - r349125;
double r349127 = r349123 - r349125;
double r349128 = r349126 / r349127;
double r349129 = r349123 - r349128;
double r349130 = log(r349129);
double r349131 = r349123 - r349130;
return r349131;
}
double f(double x, double y) {
double r349132 = x;
double r349133 = y;
double r349134 = r349132 - r349133;
double r349135 = 1.0;
double r349136 = r349135 - r349133;
double r349137 = r349134 / r349136;
double r349138 = 0.08347146558812443;
bool r349139 = r349137 <= r349138;
double r349140 = 1.0;
double r349141 = r349140 / r349136;
double r349142 = r349134 * r349141;
double r349143 = r349135 - r349142;
double r349144 = log(r349143);
double r349145 = r349135 - r349144;
double r349146 = 2.0;
double r349147 = pow(r349133, r349146);
double r349148 = r349132 / r349147;
double r349149 = r349140 / r349133;
double r349150 = r349148 - r349149;
double r349151 = r349132 / r349133;
double r349152 = fma(r349135, r349150, r349151);
double r349153 = log(r349152);
double r349154 = r349135 - r349153;
double r349155 = r349139 ? r349145 : r349154;
return r349155;
}




Bits error versus x




Bits error versus y
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.4 |
if (/ (- x y) (- 1.0 y)) < 0.08347146558812443Initial program 0.0
rmApplied div-inv0.0
if 0.08347146558812443 < (/ (- x y) (- 1.0 y)) Initial program 60.5
Taylor expanded around inf 1.2
Simplified1.2
Final simplification0.4
herbie shell --seed 2020047 +o rules:numerics
(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))))))