\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 -4.287284232108416106066864366743565298507 \cdot 10^{48}:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -1.589170604265435174984094851901889510014 \cdot 10^{-299}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -0.0:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 1.970871734171082082394253114435156426509 \cdot 10^{-7}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{-1 + \frac{x}{y}}{2}}\\
\end{array}double f(double x, double y) {
double r326789 = x;
double r326790 = 2.0;
double r326791 = r326789 * r326790;
double r326792 = y;
double r326793 = r326791 * r326792;
double r326794 = r326789 - r326792;
double r326795 = r326793 / r326794;
return r326795;
}
double f(double x, double y) {
double r326796 = x;
double r326797 = 2.0;
double r326798 = r326796 * r326797;
double r326799 = y;
double r326800 = r326798 * r326799;
double r326801 = r326796 - r326799;
double r326802 = r326800 / r326801;
double r326803 = -4.287284232108416e+48;
bool r326804 = r326802 <= r326803;
double r326805 = r326799 / r326801;
double r326806 = r326798 * r326805;
double r326807 = -1.5891706042654352e-299;
bool r326808 = r326802 <= r326807;
double r326809 = -0.0;
bool r326810 = r326802 <= r326809;
double r326811 = 1.970871734171082e-07;
bool r326812 = r326802 <= r326811;
double r326813 = -1.0;
double r326814 = r326796 / r326799;
double r326815 = r326813 + r326814;
double r326816 = r326815 / r326797;
double r326817 = r326796 / r326816;
double r326818 = r326812 ? r326802 : r326817;
double r326819 = r326810 ? r326806 : r326818;
double r326820 = r326808 ? r326802 : r326819;
double r326821 = r326804 ? r326806 : r326820;
return r326821;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if (/ (* (* x 2.0) y) (- x y)) < -4.287284232108416e+48 or -1.5891706042654352e-299 < (/ (* (* x 2.0) y) (- x y)) < -0.0Initial program 47.1
rmApplied *-un-lft-identity47.1
Applied times-frac1.5
Simplified1.5
if -4.287284232108416e+48 < (/ (* (* x 2.0) y) (- x y)) < -1.5891706042654352e-299 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.970871734171082e-07Initial program 4.8
if 1.970871734171082e-07 < (/ (* (* x 2.0) y) (- x y)) Initial program 29.8
rmApplied associate-/l*0.3
rmApplied associate-/l*0.3
Simplified0.2
Final simplification0.6
herbie shell --seed 2019347 +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)))