1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -270508391.61573327 \lor \neg \left(y \le 148253897.024537414\right):\\
\;\;\;\;\log \left(\frac{e^{1}}{\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{1}{y}, \frac{x}{y}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\end{array}double f(double x, double y) {
double r321124 = 1.0;
double r321125 = x;
double r321126 = y;
double r321127 = r321125 - r321126;
double r321128 = r321124 - r321126;
double r321129 = r321127 / r321128;
double r321130 = r321124 - r321129;
double r321131 = log(r321130);
double r321132 = r321124 - r321131;
return r321132;
}
double f(double x, double y) {
double r321133 = y;
double r321134 = -270508391.61573327;
bool r321135 = r321133 <= r321134;
double r321136 = 148253897.0245374;
bool r321137 = r321133 <= r321136;
double r321138 = !r321137;
bool r321139 = r321135 || r321138;
double r321140 = 1.0;
double r321141 = exp(r321140);
double r321142 = x;
double r321143 = 2.0;
double r321144 = pow(r321133, r321143);
double r321145 = r321142 / r321144;
double r321146 = 1.0;
double r321147 = r321146 / r321133;
double r321148 = r321145 - r321147;
double r321149 = r321142 / r321133;
double r321150 = fma(r321140, r321148, r321149);
double r321151 = r321141 / r321150;
double r321152 = log(r321151);
double r321153 = r321142 - r321133;
double r321154 = r321140 - r321133;
double r321155 = r321153 / r321154;
double r321156 = r321140 - r321155;
double r321157 = r321141 / r321156;
double r321158 = log(r321157);
double r321159 = r321139 ? r321152 : r321158;
return r321159;
}




Bits error versus x




Bits error versus y
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -270508391.61573327 or 148253897.0245374 < y Initial program 47.3
rmApplied add-log-exp47.3
Applied diff-log47.3
Taylor expanded around inf 0.2
Simplified0.2
if -270508391.61573327 < y < 148253897.0245374Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
Final simplification0.1
herbie shell --seed 2020036 +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))))))