\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -120878309475402.03125 \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -5.545286165337571374349144190718927055493 \cdot 10^{-303} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 0.0\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 8.162914331366078273047657170137319920997 \cdot 10^{-36}\right):\\
\;\;\;\;\left(x \cdot 2\right) \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{y}{x - y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\end{array}double f(double x, double y) {
double r342272 = x;
double r342273 = 2.0;
double r342274 = r342272 * r342273;
double r342275 = y;
double r342276 = r342274 * r342275;
double r342277 = r342272 - r342275;
double r342278 = r342276 / r342277;
return r342278;
}
double f(double x, double y) {
double r342279 = x;
double r342280 = 2.0;
double r342281 = r342279 * r342280;
double r342282 = y;
double r342283 = r342281 * r342282;
double r342284 = r342279 - r342282;
double r342285 = r342283 / r342284;
double r342286 = -120878309475402.03;
bool r342287 = r342285 <= r342286;
double r342288 = -5.5452861653375714e-303;
bool r342289 = r342285 <= r342288;
double r342290 = 0.0;
bool r342291 = r342285 <= r342290;
double r342292 = !r342291;
double r342293 = 8.162914331366078e-36;
bool r342294 = r342285 <= r342293;
bool r342295 = r342292 && r342294;
bool r342296 = r342289 || r342295;
double r342297 = !r342296;
bool r342298 = r342287 || r342297;
double r342299 = r342282 / r342284;
double r342300 = expm1(r342299);
double r342301 = log1p(r342300);
double r342302 = r342281 * r342301;
double r342303 = r342298 ? r342302 : r342285;
return r342303;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if (/ (* (* x 2.0) y) (- x y)) < -120878309475402.03 or -5.5452861653375714e-303 < (/ (* (* x 2.0) y) (- x y)) < 0.0 or 8.162914331366078e-36 < (/ (* (* x 2.0) y) (- x y)) Initial program 34.9
rmApplied *-un-lft-identity34.9
Applied times-frac0.6
Simplified0.6
rmApplied log1p-expm1-u0.7
if -120878309475402.03 < (/ (* (* x 2.0) y) (- x y)) < -5.5452861653375714e-303 or 0.0 < (/ (* (* x 2.0) y) (- x y)) < 8.162914331366078e-36Initial program 5.8
Final simplification0.6
herbie shell --seed 2019323 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))
(/ (* (* x 2) y) (- x y)))