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(\frac{x}{{y}^{2}}, 1, \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 r303130 = 1.0;
double r303131 = x;
double r303132 = y;
double r303133 = r303131 - r303132;
double r303134 = r303130 - r303132;
double r303135 = r303133 / r303134;
double r303136 = r303130 - r303135;
double r303137 = log(r303136);
double r303138 = r303130 - r303137;
return r303138;
}
double f(double x, double y) {
double r303139 = x;
double r303140 = y;
double r303141 = r303139 - r303140;
double r303142 = 1.0;
double r303143 = r303142 - r303140;
double r303144 = r303141 / r303143;
double r303145 = 0.967940061387686;
bool r303146 = r303144 <= r303145;
double r303147 = exp(r303142);
double r303148 = r303142 - r303144;
double r303149 = r303147 / r303148;
double r303150 = log(r303149);
double r303151 = 2.0;
double r303152 = pow(r303140, r303151);
double r303153 = r303139 / r303152;
double r303154 = r303139 / r303140;
double r303155 = fma(r303153, r303142, r303154);
double r303156 = r303142 / r303140;
double r303157 = r303155 - r303156;
double r303158 = cbrt(r303143);
double r303159 = 3.0;
double r303160 = pow(r303158, r303159);
double r303161 = r303141 / r303160;
double r303162 = -r303161;
double r303163 = r303161 + r303162;
double r303164 = r303157 + r303163;
double r303165 = log(r303164);
double r303166 = r303142 - r303165;
double r303167 = r303146 ? r303150 : r303166;
return r303167;
}




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-cube-cbrt62.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))))))