1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 1.537598818068412357583554970976054410148 \cdot 10^{-9}:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e^{1}}{\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 r356293 = 1.0;
double r356294 = x;
double r356295 = y;
double r356296 = r356294 - r356295;
double r356297 = r356293 - r356295;
double r356298 = r356296 / r356297;
double r356299 = r356293 - r356298;
double r356300 = log(r356299);
double r356301 = r356293 - r356300;
return r356301;
}
double f(double x, double y) {
double r356302 = x;
double r356303 = y;
double r356304 = r356302 - r356303;
double r356305 = 1.0;
double r356306 = r356305 - r356303;
double r356307 = r356304 / r356306;
double r356308 = 1.5375988180684124e-09;
bool r356309 = r356307 <= r356308;
double r356310 = exp(r356305);
double r356311 = r356305 - r356307;
double r356312 = r356310 / r356311;
double r356313 = log(r356312);
double r356314 = 2.0;
double r356315 = pow(r356303, r356314);
double r356316 = r356302 / r356315;
double r356317 = r356302 / r356303;
double r356318 = fma(r356316, r356305, r356317);
double r356319 = r356305 / r356303;
double r356320 = r356318 - r356319;
double r356321 = r356310 / r356320;
double r356322 = log(r356321);
double r356323 = r356309 ? r356313 : r356322;
return r356323;
}




Bits error versus x




Bits error versus y
| Original | 18.7 |
|---|---|
| Target | 0.1 |
| Herbie | 0.9 |
if (/ (- x y) (- 1.0 y)) < 1.5375988180684124e-09Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
if 1.5375988180684124e-09 < (/ (- x y) (- 1.0 y)) Initial program 59.1
rmApplied add-log-exp59.1
Applied diff-log59.1
Taylor expanded around inf 2.9
Simplified2.9
Final simplification0.9
herbie shell --seed 2019194 +o rules:numerics
(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))))))