1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \le 0.9931203730725725042915996709780301898718:\\
\;\;\;\;\log \left(\sqrt{e^{1}}\right) + \log \left(\frac{\sqrt{e^{1}}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\sqrt{e^{1}}\right) + \log \left(\frac{\sqrt{e^{1}}}{1 \cdot \left(\frac{x}{{y}^{2}} - \frac{1}{y}\right) + \frac{x}{y}}\right)\\
\end{array}double f(double x, double y) {
double r278959 = 1.0;
double r278960 = x;
double r278961 = y;
double r278962 = r278960 - r278961;
double r278963 = r278959 - r278961;
double r278964 = r278962 / r278963;
double r278965 = r278959 - r278964;
double r278966 = log(r278965);
double r278967 = r278959 - r278966;
return r278967;
}
double f(double x, double y) {
double r278968 = x;
double r278969 = y;
double r278970 = r278968 - r278969;
double r278971 = 1.0;
double r278972 = r278971 - r278969;
double r278973 = r278970 / r278972;
double r278974 = 0.9931203730725725;
bool r278975 = r278973 <= r278974;
double r278976 = exp(r278971);
double r278977 = sqrt(r278976);
double r278978 = log(r278977);
double r278979 = r278971 - r278973;
double r278980 = r278977 / r278979;
double r278981 = log(r278980);
double r278982 = r278978 + r278981;
double r278983 = 2.0;
double r278984 = pow(r278969, r278983);
double r278985 = r278968 / r278984;
double r278986 = 1.0;
double r278987 = r278986 / r278969;
double r278988 = r278985 - r278987;
double r278989 = r278971 * r278988;
double r278990 = r278968 / r278969;
double r278991 = r278989 + r278990;
double r278992 = r278977 / r278991;
double r278993 = log(r278992);
double r278994 = r278978 + r278993;
double r278995 = r278975 ? r278982 : r278994;
return r278995;
}




Bits error versus x




Bits error versus y
Results
| Original | 17.9 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (/ (- x y) (- 1.0 y)) < 0.9931203730725725Initial program 0.0
rmApplied add-log-exp0.0
Applied diff-log0.0
rmApplied *-un-lft-identity0.0
Applied add-sqr-sqrt0.0
Applied times-frac0.0
Applied log-prod0.0
Simplified0.0
if 0.9931203730725725 < (/ (- x y) (- 1.0 y)) Initial program 61.5
rmApplied add-log-exp61.5
Applied diff-log61.5
rmApplied *-un-lft-identity61.5
Applied add-sqr-sqrt61.5
Applied times-frac61.5
Applied log-prod61.5
Simplified61.5
Taylor expanded around inf 0.6
Simplified0.6
Final simplification0.2
herbie shell --seed 2019297
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(if (< y -81284752.619472414) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y))))) (if (< y 3.0094271212461764e25) (log (/ (exp 1) (- 1 (/ (- x y) (- 1 y))))) (- 1 (log (- (/ x (* y y)) (- (/ 1 y) (/ x y)))))))
(- 1 (log (- 1 (/ (- x y) (- 1 y))))))