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(1, \frac{x}{{y}^{2}}, \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 r385936 = 1.0;
double r385937 = x;
double r385938 = y;
double r385939 = r385937 - r385938;
double r385940 = r385936 - r385938;
double r385941 = r385939 / r385940;
double r385942 = r385936 - r385941;
double r385943 = log(r385942);
double r385944 = r385936 - r385943;
return r385944;
}
double f(double x, double y) {
double r385945 = y;
double r385946 = -119577009.99898484;
bool r385947 = r385945 <= r385946;
double r385948 = 25589815.688386947;
bool r385949 = r385945 <= r385948;
double r385950 = !r385949;
bool r385951 = r385947 || r385950;
double r385952 = 1.0;
double r385953 = exp(r385952);
double r385954 = x;
double r385955 = 2.0;
double r385956 = pow(r385945, r385955);
double r385957 = r385954 / r385956;
double r385958 = r385954 / r385945;
double r385959 = fma(r385952, r385957, r385958);
double r385960 = r385952 / r385945;
double r385961 = r385959 - r385960;
double r385962 = r385953 / r385961;
double r385963 = log(r385962);
double r385964 = r385954 - r385945;
double r385965 = 1.0;
double r385966 = r385952 - r385945;
double r385967 = r385965 / r385966;
double r385968 = r385964 * r385967;
double r385969 = r385952 - r385968;
double r385970 = log(r385969);
double r385971 = r385952 - r385970;
double r385972 = r385951 ? r385963 : r385971;
return r385972;
}




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))))))