1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9679400613876859571504951418319251388311:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}}, \frac{x}{y}\right) - \frac{1}{y}\right) + \left(\frac{x - y}{{\left(\sqrt[3]{1 - y}\right)}^{3}} + \left(-\frac{x - y}{{\left(\sqrt[3]{1 - y}\right)}^{3}}\right)\right)\right)\\
\end{array}double f(double x, double y) {
double r226109 = 1.0;
double r226110 = x;
double r226111 = y;
double r226112 = r226110 - r226111;
double r226113 = r226109 - r226111;
double r226114 = r226112 / r226113;
double r226115 = r226109 - r226114;
double r226116 = log(r226115);
double r226117 = r226109 - r226116;
return r226117;
}
double f(double x, double y) {
double r226118 = x;
double r226119 = y;
double r226120 = r226118 - r226119;
double r226121 = 1.0;
double r226122 = r226121 - r226119;
double r226123 = r226120 / r226122;
double r226124 = 0.967940061387686;
bool r226125 = r226123 <= r226124;
double r226126 = exp(r226121);
double r226127 = r226121 - r226123;
double r226128 = r226126 / r226127;
double r226129 = log(r226128);
double r226130 = 2.0;
double r226131 = pow(r226119, r226130);
double r226132 = r226118 / r226131;
double r226133 = r226118 / r226119;
double r226134 = fma(r226121, r226132, r226133);
double r226135 = r226121 / r226119;
double r226136 = r226134 - r226135;
double r226137 = cbrt(r226122);
double r226138 = 3.0;
double r226139 = pow(r226137, r226138);
double r226140 = r226120 / r226139;
double r226141 = -r226140;
double r226142 = r226140 + r226141;
double r226143 = r226136 + r226142;
double r226144 = log(r226143);
double r226145 = r226121 - r226144;
double r226146 = r226125 ? r226129 : r226145;
return r226146;
}




Bits error versus x




Bits error versus y
| Original | 18.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.967940061387686Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
if 0.967940061387686 < (/ (- x y) (- 1.0 y)) Initial program 61.9
rmApplied add-cube-cbrt57.2
Applied add-cube-cbrt62.1
Applied times-frac62.1
Applied add-sqr-sqrt62.1
Applied prod-diff62.1
Simplified57.1
Simplified57.1
Taylor expanded around inf 0.5
Simplified0.5
Final simplification0.2
herbie shell --seed 2019325 +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))))))