\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -1.73735157607842638 \cdot 10^{-55} \lor \neg \left(x \le 2.31015467420133914 \cdot 10^{-42}\right):\\
\;\;\;\;\frac{x}{x - y} \cdot \left(2 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\end{array}double f(double x, double y) {
double r618080 = x;
double r618081 = 2.0;
double r618082 = r618080 * r618081;
double r618083 = y;
double r618084 = r618082 * r618083;
double r618085 = r618080 - r618083;
double r618086 = r618084 / r618085;
return r618086;
}
double f(double x, double y) {
double r618087 = x;
double r618088 = -1.7373515760784264e-55;
bool r618089 = r618087 <= r618088;
double r618090 = 2.310154674201339e-42;
bool r618091 = r618087 <= r618090;
double r618092 = !r618091;
bool r618093 = r618089 || r618092;
double r618094 = y;
double r618095 = r618087 - r618094;
double r618096 = r618087 / r618095;
double r618097 = 2.0;
double r618098 = r618097 * r618094;
double r618099 = r618096 * r618098;
double r618100 = r618087 * r618097;
double r618101 = r618095 / r618094;
double r618102 = r618100 / r618101;
double r618103 = r618093 ? r618099 : r618102;
return r618103;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.4 |
| Herbie | 0.2 |
if x < -1.7373515760784264e-55 or 2.310154674201339e-42 < x Initial program 13.7
rmApplied associate-/l*13.3
rmApplied div-inv13.4
Applied times-frac0.5
Simplified0.4
if -1.7373515760784264e-55 < x < 2.310154674201339e-42Initial program 17.0
rmApplied associate-/l*0.0
Final simplification0.2
herbie shell --seed 2020046
(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)))