1.0 - \log \left(1.0 - \frac{x - y}{1.0 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -319717390.54903644:\\
\;\;\;\;1.0 - \log \left(\mathsf{fma}\left(\frac{x}{y}, \frac{1.0}{y}, \frac{x}{y} - \frac{1.0}{y}\right)\right)\\
\mathbf{elif}\;y \le 41723711.509616:\\
\;\;\;\;\log \left(\frac{e^{1.0}}{1.0 - \frac{x - y}{1.0 - y}}\right)\\
\mathbf{else}:\\
\;\;\;\;1.0 - \log \left(\mathsf{fma}\left(\frac{x}{y}, \frac{1.0}{y}, \frac{x}{y} - \frac{1.0}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r16679918 = 1.0;
double r16679919 = x;
double r16679920 = y;
double r16679921 = r16679919 - r16679920;
double r16679922 = r16679918 - r16679920;
double r16679923 = r16679921 / r16679922;
double r16679924 = r16679918 - r16679923;
double r16679925 = log(r16679924);
double r16679926 = r16679918 - r16679925;
return r16679926;
}
double f(double x, double y) {
double r16679927 = y;
double r16679928 = -319717390.54903644;
bool r16679929 = r16679927 <= r16679928;
double r16679930 = 1.0;
double r16679931 = x;
double r16679932 = r16679931 / r16679927;
double r16679933 = r16679930 / r16679927;
double r16679934 = r16679932 - r16679933;
double r16679935 = fma(r16679932, r16679933, r16679934);
double r16679936 = log(r16679935);
double r16679937 = r16679930 - r16679936;
double r16679938 = 41723711.509616;
bool r16679939 = r16679927 <= r16679938;
double r16679940 = exp(r16679930);
double r16679941 = r16679931 - r16679927;
double r16679942 = r16679930 - r16679927;
double r16679943 = r16679941 / r16679942;
double r16679944 = r16679930 - r16679943;
double r16679945 = r16679940 / r16679944;
double r16679946 = log(r16679945);
double r16679947 = r16679939 ? r16679946 : r16679937;
double r16679948 = r16679929 ? r16679937 : r16679947;
return r16679948;
}




Bits error versus x




Bits error versus y
| Original | 17.6 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -319717390.54903644 or 41723711.509616 < y Initial program 45.2
Taylor expanded around inf 0.1
Simplified0.1
if -319717390.54903644 < y < 41723711.509616Initial program 0.1
rmApplied add-log-exp0.1
Applied diff-log0.1
Final simplification0.1
herbie shell --seed 2019162 +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))))))