1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -244170417.415870637 \lor \neg \left(y \le 39316813.46217899\right):\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{1}{y}, \frac{x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \frac{x - y}{1 - y}\right)\right)\right)\\
\end{array}double f(double x, double y) {
double r402013 = 1.0;
double r402014 = x;
double r402015 = y;
double r402016 = r402014 - r402015;
double r402017 = r402013 - r402015;
double r402018 = r402016 / r402017;
double r402019 = r402013 - r402018;
double r402020 = log(r402019);
double r402021 = r402013 - r402020;
return r402021;
}
double f(double x, double y) {
double r402022 = y;
double r402023 = -244170417.41587064;
bool r402024 = r402022 <= r402023;
double r402025 = 39316813.46217899;
bool r402026 = r402022 <= r402025;
double r402027 = !r402026;
bool r402028 = r402024 || r402027;
double r402029 = 1.0;
double r402030 = x;
double r402031 = 2.0;
double r402032 = pow(r402022, r402031);
double r402033 = r402030 / r402032;
double r402034 = 1.0;
double r402035 = r402034 / r402022;
double r402036 = r402033 - r402035;
double r402037 = r402030 / r402022;
double r402038 = fma(r402029, r402036, r402037);
double r402039 = log(r402038);
double r402040 = r402029 - r402039;
double r402041 = r402030 - r402022;
double r402042 = r402029 - r402022;
double r402043 = r402041 / r402042;
double r402044 = r402029 - r402043;
double r402045 = log1p(r402044);
double r402046 = expm1(r402045);
double r402047 = log(r402046);
double r402048 = r402029 - r402047;
double r402049 = r402028 ? r402040 : r402048;
return r402049;
}




Bits error versus x




Bits error versus y
| Original | 18.3 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -244170417.41587064 or 39316813.46217899 < y Initial program 46.4
Taylor expanded around inf 0.1
Simplified0.1
if -244170417.41587064 < y < 39316813.46217899Initial program 0.1
rmApplied expm1-log1p-u0.1
Final simplification0.1
herbie shell --seed 2020060 +o rules:numerics
(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))))))