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 r265210 = 1.0;
double r265211 = x;
double r265212 = y;
double r265213 = r265211 - r265212;
double r265214 = r265210 - r265212;
double r265215 = r265213 / r265214;
double r265216 = r265210 - r265215;
double r265217 = log(r265216);
double r265218 = r265210 - r265217;
return r265218;
}
double f(double x, double y) {
double r265219 = 1.0;
double r265220 = x;
double r265221 = y;
double r265222 = r265220 - r265221;
double r265223 = r265219 - r265221;
double r265224 = r265222 / r265223;
double r265225 = r265219 - r265224;
double r265226 = 4.669598041573408e-13;
bool r265227 = r265225 <= r265226;
double r265228 = 2.0;
double r265229 = pow(r265221, r265228);
double r265230 = r265220 / r265229;
double r265231 = r265220 / r265221;
double r265232 = fma(r265219, r265230, r265231);
double r265233 = r265219 / r265221;
double r265234 = r265232 - r265233;
double r265235 = log(r265234);
double r265236 = r265219 - r265235;
double r265237 = sqrt(r265225);
double r265238 = log(r265237);
double r265239 = r265238 + r265238;
double r265240 = r265219 - r265239;
double r265241 = r265227 ? r265236 : r265240;
return r265241;
}




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))))))