1.0 - \log \left(1.0 - \frac{x - y}{1.0 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -3.475504821605494 \cdot 10^{+19}:\\
\;\;\;\;1.0 - \log \left(\mathsf{fma}\left(\frac{1.0}{y}, \frac{x}{y}, \frac{x}{y} - \frac{1.0}{y}\right)\right)\\
\mathbf{elif}\;y \le 98095783.98664801:\\
\;\;\;\;1.0 - \left(\log \left(\sqrt{1.0 - \frac{x - y}{1.0 - y}}\right) + \log \left(\sqrt{1.0 - \frac{x - y}{1.0 - y}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1.0 - \log \left(\mathsf{fma}\left(\frac{1.0}{y}, \frac{x}{y}, \frac{x}{y} - \frac{1.0}{y}\right)\right)\\
\end{array}double f(double x, double y) {
double r17214986 = 1.0;
double r17214987 = x;
double r17214988 = y;
double r17214989 = r17214987 - r17214988;
double r17214990 = r17214986 - r17214988;
double r17214991 = r17214989 / r17214990;
double r17214992 = r17214986 - r17214991;
double r17214993 = log(r17214992);
double r17214994 = r17214986 - r17214993;
return r17214994;
}
double f(double x, double y) {
double r17214995 = y;
double r17214996 = -3.475504821605494e+19;
bool r17214997 = r17214995 <= r17214996;
double r17214998 = 1.0;
double r17214999 = r17214998 / r17214995;
double r17215000 = x;
double r17215001 = r17215000 / r17214995;
double r17215002 = r17215001 - r17214999;
double r17215003 = fma(r17214999, r17215001, r17215002);
double r17215004 = log(r17215003);
double r17215005 = r17214998 - r17215004;
double r17215006 = 98095783.98664801;
bool r17215007 = r17214995 <= r17215006;
double r17215008 = r17215000 - r17214995;
double r17215009 = r17214998 - r17214995;
double r17215010 = r17215008 / r17215009;
double r17215011 = r17214998 - r17215010;
double r17215012 = sqrt(r17215011);
double r17215013 = log(r17215012);
double r17215014 = r17215013 + r17215013;
double r17215015 = r17214998 - r17215014;
double r17215016 = r17215007 ? r17215015 : r17215005;
double r17215017 = r17214997 ? r17215005 : r17215016;
return r17215017;
}




Bits error versus x




Bits error versus y
| Original | 17.3 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if y < -3.475504821605494e+19 or 98095783.98664801 < y Initial program 46.1
Taylor expanded around inf 0.0
Simplified0.0
if -3.475504821605494e+19 < y < 98095783.98664801Initial program 0.5
rmApplied add-sqr-sqrt0.5
Applied log-prod0.5
Final simplification0.3
herbie shell --seed 2019164 +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))))))