1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9999998768371195501103443348256405442953:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(\frac{x}{{y}^{2}}, 1, \frac{x}{y}\right) - \frac{1}{y}\right)\\
\end{array}double f(double x, double y) {
double r340182 = 1.0;
double r340183 = x;
double r340184 = y;
double r340185 = r340183 - r340184;
double r340186 = r340182 - r340184;
double r340187 = r340185 / r340186;
double r340188 = r340182 - r340187;
double r340189 = log(r340188);
double r340190 = r340182 - r340189;
return r340190;
}
double f(double x, double y) {
double r340191 = x;
double r340192 = y;
double r340193 = r340191 - r340192;
double r340194 = 1.0;
double r340195 = r340194 - r340192;
double r340196 = r340193 / r340195;
double r340197 = 0.9999998768371196;
bool r340198 = r340196 <= r340197;
double r340199 = 1.0;
double r340200 = r340199 / r340195;
double r340201 = r340193 * r340200;
double r340202 = r340194 - r340201;
double r340203 = log(r340202);
double r340204 = r340194 - r340203;
double r340205 = 2.0;
double r340206 = pow(r340192, r340205);
double r340207 = r340191 / r340206;
double r340208 = r340191 / r340192;
double r340209 = fma(r340207, r340194, r340208);
double r340210 = r340194 / r340192;
double r340211 = r340209 - r340210;
double r340212 = log(r340211);
double r340213 = r340194 - r340212;
double r340214 = r340198 ? r340204 : r340213;
return r340214;
}




Bits error versus x




Bits error versus y
| Original | 18.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9999998768371196Initial program 0.1
rmApplied div-inv0.1
if 0.9999998768371196 < (/ (- x y) (- 1.0 y)) Initial program 62.5
rmApplied flip--62.5
Simplified62.5
Taylor expanded around inf 0.3
Simplified0.3
Final simplification0.2
herbie shell --seed 2019209 +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.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))))))