1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.3399084615053225566505545884865568950772:\\
\;\;\;\;1 - \log \left(1 - \frac{x - y}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(1 \cdot \left(\frac{x}{{y}^{2}} - \frac{1}{y}\right) + \frac{x}{y}\right)\\
\end{array}double f(double x, double y) {
double r459940 = 1.0;
double r459941 = x;
double r459942 = y;
double r459943 = r459941 - r459942;
double r459944 = r459940 - r459942;
double r459945 = r459943 / r459944;
double r459946 = r459940 - r459945;
double r459947 = log(r459946);
double r459948 = r459940 - r459947;
return r459948;
}
double f(double x, double y) {
double r459949 = x;
double r459950 = y;
double r459951 = r459949 - r459950;
double r459952 = 1.0;
double r459953 = r459952 - r459950;
double r459954 = r459951 / r459953;
double r459955 = 0.33990846150532256;
bool r459956 = r459954 <= r459955;
double r459957 = r459952 - r459954;
double r459958 = log(r459957);
double r459959 = r459952 - r459958;
double r459960 = 2.0;
double r459961 = pow(r459950, r459960);
double r459962 = r459949 / r459961;
double r459963 = 1.0;
double r459964 = r459963 / r459950;
double r459965 = r459962 - r459964;
double r459966 = r459952 * r459965;
double r459967 = r459949 / r459950;
double r459968 = r459966 + r459967;
double r459969 = log(r459968);
double r459970 = r459952 - r459969;
double r459971 = r459956 ? r459959 : r459970;
return r459971;
}




Bits error versus x




Bits error versus y
Results
| Original | 18.4 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if (/ (- x y) (- 1.0 y)) < 0.33990846150532256Initial program 0.0
if 0.33990846150532256 < (/ (- x y) (- 1.0 y)) Initial program 61.2
Taylor expanded around inf 0.8
Simplified0.8
Final simplification0.3
herbie shell --seed 2019354
(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))))))