1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;1 - \frac{x - y}{1 - y} \le 4.669598041573408409021794795989990234375 \cdot 10^{-13}:\\
\;\;\;\;1 - \log \left(\mathsf{fma}\left(1, \frac{x}{{y}^{2}}, \frac{x}{y}\right) - \frac{1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right) + \log \left(\sqrt{1 - \frac{x - y}{1 - y}}\right)\right)\\
\end{array}double f(double x, double y) {
double r311033 = 1.0;
double r311034 = x;
double r311035 = y;
double r311036 = r311034 - r311035;
double r311037 = r311033 - r311035;
double r311038 = r311036 / r311037;
double r311039 = r311033 - r311038;
double r311040 = log(r311039);
double r311041 = r311033 - r311040;
return r311041;
}
double f(double x, double y) {
double r311042 = 1.0;
double r311043 = x;
double r311044 = y;
double r311045 = r311043 - r311044;
double r311046 = r311042 - r311044;
double r311047 = r311045 / r311046;
double r311048 = r311042 - r311047;
double r311049 = 4.669598041573408e-13;
bool r311050 = r311048 <= r311049;
double r311051 = 2.0;
double r311052 = pow(r311044, r311051);
double r311053 = r311043 / r311052;
double r311054 = r311043 / r311044;
double r311055 = fma(r311042, r311053, r311054);
double r311056 = r311042 / r311044;
double r311057 = r311055 - r311056;
double r311058 = log(r311057);
double r311059 = r311042 - r311058;
double r311060 = sqrt(r311048);
double r311061 = log(r311060);
double r311062 = r311061 + r311061;
double r311063 = r311042 - r311062;
double r311064 = r311050 ? r311059 : r311063;
return r311064;
}




Bits error versus x




Bits error versus y
| Original | 18.2 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if (- 1.0 (/ (- x y) (- 1.0 y))) < 4.669598041573408e-13Initial program 63.6
Taylor expanded around inf 0.0
Simplified0.0
if 4.669598041573408e-13 < (- 1.0 (/ (- x y) (- 1.0 y))) Initial program 0.3
rmApplied add-sqr-sqrt0.4
Applied log-prod0.4
Final simplification0.3
herbie shell --seed 2019326 +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))))))