1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -123098519.9019673168659210205078125:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(\frac{1}{y}, \frac{x}{y}, \frac{x}{y} - \frac{1}{y}\right)\right)\\
\mathbf{elif}\;y \le 1.002831089821186738575420349661726504564:\\
\;\;\;\;\left(1 - \log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right)\right) - \log \left(\sqrt{\mathsf{fma}\left(\frac{x - y}{\sqrt{1 - y}}, \frac{-1}{\sqrt{1 - y}}, \frac{\frac{x - y}{\sqrt{1 - y}}}{\sqrt{1 - y}}\right) + \left(1 - \frac{\frac{x - y}{\sqrt{1 - y}}}{\sqrt{1 - y}}\right)}\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 r13533906 = 1.0;
double r13533907 = x;
double r13533908 = y;
double r13533909 = r13533907 - r13533908;
double r13533910 = r13533906 - r13533908;
double r13533911 = r13533909 / r13533910;
double r13533912 = r13533906 - r13533911;
double r13533913 = log(r13533912);
double r13533914 = r13533906 - r13533913;
return r13533914;
}
double f(double x, double y) {
double r13533915 = y;
double r13533916 = -123098519.90196732;
bool r13533917 = r13533915 <= r13533916;
double r13533918 = 1.0;
double r13533919 = r13533918 / r13533915;
double r13533920 = x;
double r13533921 = r13533920 / r13533915;
double r13533922 = r13533921 - r13533919;
double r13533923 = fma(r13533919, r13533921, r13533922);
double r13533924 = log(r13533923);
double r13533925 = r13533918 - r13533924;
double r13533926 = 1.0028310898211867;
bool r13533927 = r13533915 <= r13533926;
double r13533928 = r13533920 - r13533915;
double r13533929 = r13533918 - r13533915;
double r13533930 = r13533928 / r13533929;
double r13533931 = r13533918 - r13533930;
double r13533932 = sqrt(r13533931);
double r13533933 = log(r13533932);
double r13533934 = r13533918 - r13533933;
double r13533935 = sqrt(r13533929);
double r13533936 = r13533928 / r13533935;
double r13533937 = -1.0;
double r13533938 = r13533937 / r13533935;
double r13533939 = r13533936 / r13533935;
double r13533940 = fma(r13533936, r13533938, r13533939);
double r13533941 = r13533918 - r13533939;
double r13533942 = r13533940 + r13533941;
double r13533943 = sqrt(r13533942);
double r13533944 = log(r13533943);
double r13533945 = r13533934 - r13533944;
double r13533946 = r13533927 ? r13533945 : r13533925;
double r13533947 = r13533917 ? r13533925 : r13533946;
return r13533947;
}




Bits error versus x




Bits error versus y
| Original | 18.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if y < -123098519.90196732 or 1.0028310898211867 < y Initial program 46.1
Taylor expanded around inf 0.2
Simplified0.2
if -123098519.90196732 < y < 1.0028310898211867Initial program 0.1
rmApplied add-sqr-sqrt0.1
Applied log-prod0.1
Applied associate--r+0.1
rmApplied add-sqr-sqrt0.1
Applied add-cube-cbrt0.1
Applied times-frac0.1
Applied add-sqr-sqrt0.1
Applied prod-diff0.1
Simplified0.1
Simplified0.1
Final simplification0.2
herbie shell --seed 2019172 +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))))))