1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.03024915003939501398355638173143233871087:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e^{1}}{\mathsf{fma}\left(1, \frac{x}{{y}^{2}}, \frac{x}{y}\right) - \frac{1}{y}}\right)\\
\end{array}double f(double x, double y) {
double r215317 = 1.0;
double r215318 = x;
double r215319 = y;
double r215320 = r215318 - r215319;
double r215321 = r215317 - r215319;
double r215322 = r215320 / r215321;
double r215323 = r215317 - r215322;
double r215324 = log(r215323);
double r215325 = r215317 - r215324;
return r215325;
}
double f(double x, double y) {
double r215326 = x;
double r215327 = y;
double r215328 = r215326 - r215327;
double r215329 = 1.0;
double r215330 = r215329 - r215327;
double r215331 = r215328 / r215330;
double r215332 = 0.030249150039395014;
bool r215333 = r215331 <= r215332;
double r215334 = 1.0;
double r215335 = r215334 / r215330;
double r215336 = r215328 * r215335;
double r215337 = r215329 - r215336;
double r215338 = log(r215337);
double r215339 = r215329 - r215338;
double r215340 = exp(r215329);
double r215341 = 2.0;
double r215342 = pow(r215327, r215341);
double r215343 = r215326 / r215342;
double r215344 = r215326 / r215327;
double r215345 = fma(r215329, r215343, r215344);
double r215346 = r215329 / r215327;
double r215347 = r215345 - r215346;
double r215348 = r215340 / r215347;
double r215349 = log(r215348);
double r215350 = r215333 ? r215339 : r215349;
return r215350;
}




Bits error versus x




Bits error versus y
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.4 |
if (/ (- x y) (- 1.0 y)) < 0.030249150039395014Initial program 0.0
rmApplied div-inv0.0
if 0.030249150039395014 < (/ (- x y) (- 1.0 y)) Initial program 60.5
rmApplied add-cbrt-cube60.5
Simplified60.5
rmApplied add-log-exp60.5
Simplified60.5
Taylor expanded around inf 1.1
Simplified1.1
Final simplification0.4
herbie shell --seed 2019306 +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))))))