1 - \log \left(1 - \frac{x - y}{1 - y}\right)\begin{array}{l}
\mathbf{if}\;y \le -32434980278.3643684 \lor \neg \left(y \le 47573649.5674214438\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{\frac{x - y}{\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}}}{\sqrt[3]{1 - y}}\right)\right)\right)\\
\end{array}double f(double x, double y) {
double r348242 = 1.0;
double r348243 = x;
double r348244 = y;
double r348245 = r348243 - r348244;
double r348246 = r348242 - r348244;
double r348247 = r348245 / r348246;
double r348248 = r348242 - r348247;
double r348249 = log(r348248);
double r348250 = r348242 - r348249;
return r348250;
}
double f(double x, double y) {
double r348251 = y;
double r348252 = -32434980278.36437;
bool r348253 = r348251 <= r348252;
double r348254 = 47573649.567421444;
bool r348255 = r348251 <= r348254;
double r348256 = !r348255;
bool r348257 = r348253 || r348256;
double r348258 = 1.0;
double r348259 = x;
double r348260 = 2.0;
double r348261 = pow(r348251, r348260);
double r348262 = r348259 / r348261;
double r348263 = 1.0;
double r348264 = r348263 / r348251;
double r348265 = r348262 - r348264;
double r348266 = r348259 / r348251;
double r348267 = fma(r348258, r348265, r348266);
double r348268 = log(r348267);
double r348269 = r348258 - r348268;
double r348270 = r348259 - r348251;
double r348271 = r348258 - r348251;
double r348272 = cbrt(r348271);
double r348273 = r348272 * r348272;
double r348274 = r348270 / r348273;
double r348275 = r348274 / r348272;
double r348276 = r348258 - r348275;
double r348277 = log1p(r348276);
double r348278 = expm1(r348277);
double r348279 = log(r348278);
double r348280 = r348258 - r348279;
double r348281 = r348257 ? r348269 : r348280;
return r348281;
}




Bits error versus x




Bits error versus y
| Original | 18.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
if y < -32434980278.36437 or 47573649.567421444 < y Initial program 47.2
Taylor expanded around inf 0.1
Simplified0.1
if -32434980278.36437 < y < 47573649.567421444Initial program 0.1
rmApplied add-cube-cbrt0.2
Applied associate-/r*0.2
rmApplied expm1-log1p-u0.2
Final simplification0.1
herbie shell --seed 2020089 +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))))))