1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -240248535.9542663097381591796875:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(\frac{1}{y}, \frac{x}{y}, \frac{x}{y} - \frac{1}{y}\right)\right)\\
\mathbf{elif}\;y \le 60168479.88061915338039398193359375:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(\frac{1}{y}, \frac{x}{y}, \frac{x}{y} - \frac{1}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r18522984 = 1.0;
double r18522985 = x;
double r18522986 = y;
double r18522987 = r18522985 - r18522986;
double r18522988 = r18522984 - r18522986;
double r18522989 = r18522987 / r18522988;
double r18522990 = r18522984 - r18522989;
double r18522991 = log(r18522990);
double r18522992 = r18522984 - r18522991;
return r18522992;
}
double f(double x, double y) {
double r18522993 = y;
double r18522994 = -240248535.9542663;
bool r18522995 = r18522993 <= r18522994;
double r18522996 = 1.0;
double r18522997 = r18522996 / r18522993;
double r18522998 = x;
double r18522999 = r18522998 / r18522993;
double r18523000 = r18522999 - r18522997;
double r18523001 = fma(r18522997, r18522999, r18523000);
double r18523002 = log(r18523001);
double r18523003 = r18522996 - r18523002;
double r18523004 = 60168479.88061915;
bool r18523005 = r18522993 <= r18523004;
double r18523006 = exp(r18522996);
double r18523007 = r18522998 - r18522993;
double r18523008 = r18522996 - r18522993;
double r18523009 = r18523007 / r18523008;
double r18523010 = r18522996 - r18523009;
double r18523011 = r18523006 / r18523010;
double r18523012 = log(r18523011);
double r18523013 = r18523005 ? r18523012 : r18523003;
double r18523014 = r18522995 ? r18523003 : r18523013;
return r18523014;
}




Bits error versus x




Bits error versus y
| Original | 18.6 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -240248535.9542663 or 60168479.88061915 < y Initial program 47.0
Taylor expanded around inf 0.1
Simplified0.1
if -240248535.9542663 < y < 60168479.88061915Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
Final simplification0.1
herbie shell --seed 2019170 +o rules:numerics
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:herbie-target
(if (< y -81284752.61947241) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y))))) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))
(- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))