\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -3.75321797851906779486008847671727426178 \cdot 10^{-87} \lor \neg \left(x \le 1.400872302202354975456358848427742881356 \cdot 10^{-45}\right):\\
\;\;\;\;\left(y \cdot 2\right) \cdot \frac{x}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x}{y} - 1}\\
\end{array}double f(double x, double y) {
double r463339 = x;
double r463340 = 2.0;
double r463341 = r463339 * r463340;
double r463342 = y;
double r463343 = r463341 * r463342;
double r463344 = r463339 - r463342;
double r463345 = r463343 / r463344;
return r463345;
}
double f(double x, double y) {
double r463346 = x;
double r463347 = -3.753217978519068e-87;
bool r463348 = r463346 <= r463347;
double r463349 = 1.400872302202355e-45;
bool r463350 = r463346 <= r463349;
double r463351 = !r463350;
bool r463352 = r463348 || r463351;
double r463353 = y;
double r463354 = 2.0;
double r463355 = r463353 * r463354;
double r463356 = r463346 - r463353;
double r463357 = r463346 / r463356;
double r463358 = r463355 * r463357;
double r463359 = r463346 * r463354;
double r463360 = r463346 / r463353;
double r463361 = 1.0;
double r463362 = r463360 - r463361;
double r463363 = r463359 / r463362;
double r463364 = r463352 ? r463358 : r463363;
return r463364;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if x < -3.753217978519068e-87 or 1.400872302202355e-45 < x Initial program 13.7
Simplified12.6
rmApplied div-inv12.8
Applied times-frac0.7
Simplified0.5
if -3.753217978519068e-87 < x < 1.400872302202355e-45Initial program 16.6
Simplified0.0
rmApplied *-un-lft-identity0.0
Applied *-un-lft-identity0.0
Applied times-frac0.0
Simplified0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))
(/ (* (* x 2.0) y) (- x y)))