1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -119577009.99898484 \lor \neg \left(y \le 25589815.688386947\right):\\
\;\;\;\;\log \left(\frac{e^{1}}{\mathsf{fma}\left(\frac{x}{{y}^{2}}, 1, \frac{x}{y}\right) - \frac{1}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 - \left(x - y\right) \cdot \frac{1}{1 - y}\right)\\
\end{array}double f(double x, double y) {
double r351796 = 1.0;
double r351797 = x;
double r351798 = y;
double r351799 = r351797 - r351798;
double r351800 = r351796 - r351798;
double r351801 = r351799 / r351800;
double r351802 = r351796 - r351801;
double r351803 = log(r351802);
double r351804 = r351796 - r351803;
return r351804;
}
double f(double x, double y) {
double r351805 = y;
double r351806 = -119577009.99898484;
bool r351807 = r351805 <= r351806;
double r351808 = 25589815.688386947;
bool r351809 = r351805 <= r351808;
double r351810 = !r351809;
bool r351811 = r351807 || r351810;
double r351812 = 1.0;
double r351813 = exp(r351812);
double r351814 = x;
double r351815 = 2.0;
double r351816 = pow(r351805, r351815);
double r351817 = r351814 / r351816;
double r351818 = r351814 / r351805;
double r351819 = fma(r351817, r351812, r351818);
double r351820 = r351812 / r351805;
double r351821 = r351819 - r351820;
double r351822 = r351813 / r351821;
double r351823 = log(r351822);
double r351824 = r351814 - r351805;
double r351825 = 1.0;
double r351826 = r351812 - r351805;
double r351827 = r351825 / r351826;
double r351828 = r351824 * r351827;
double r351829 = r351812 - r351828;
double r351830 = log(r351829);
double r351831 = r351812 - r351830;
double r351832 = r351811 ? r351823 : r351831;
return r351832;
}




Bits error versus x




Bits error versus y
| Original | 18.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -119577009.99898484 or 25589815.688386947 < y Initial program 46.9
rmApplied add-log-exp46.9
Applied diff-log46.9
Taylor expanded around inf 0.2
Simplified0.2
if -119577009.99898484 < y < 25589815.688386947Initial program 0.1
rmApplied div-inv0.1
Final simplification0.1
herbie shell --seed 2020046 +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))))))