\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} = -\infty \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -1.471592529896085774661241966279671564936 \cdot 10^{-299} \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 1.814653870831097695138700872366755944978 \cdot 10^{-20}\right):\\
\;\;\;\;\frac{x}{\frac{-1 + \frac{x}{y}}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\end{array}double f(double x, double y) {
double r350165 = x;
double r350166 = 2.0;
double r350167 = r350165 * r350166;
double r350168 = y;
double r350169 = r350167 * r350168;
double r350170 = r350165 - r350168;
double r350171 = r350169 / r350170;
return r350171;
}
double f(double x, double y) {
double r350172 = x;
double r350173 = 2.0;
double r350174 = r350172 * r350173;
double r350175 = y;
double r350176 = r350174 * r350175;
double r350177 = r350172 - r350175;
double r350178 = r350176 / r350177;
double r350179 = -inf.0;
bool r350180 = r350178 <= r350179;
double r350181 = -1.4715925298960858e-299;
bool r350182 = r350178 <= r350181;
double r350183 = 0.0;
bool r350184 = r350178 <= r350183;
double r350185 = !r350184;
double r350186 = 1.8146538708310977e-20;
bool r350187 = r350178 <= r350186;
bool r350188 = r350185 && r350187;
bool r350189 = r350182 || r350188;
double r350190 = !r350189;
bool r350191 = r350180 || r350190;
double r350192 = -1.0;
double r350193 = r350172 / r350175;
double r350194 = r350192 + r350193;
double r350195 = r350194 / r350173;
double r350196 = r350172 / r350195;
double r350197 = r350191 ? r350196 : r350178;
return r350197;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.4 |
| Herbie | 0.6 |
if (/ (* (* x 2.0) y) (- x y)) < -inf.0 or -1.4715925298960858e-299 < (/ (* (* x 2.0) y) (- x y)) < 0.0 or 1.8146538708310977e-20 < (/ (* (* x 2.0) y) (- x y)) Initial program 42.5
rmApplied associate-/l*0.8
Simplified0.8
rmApplied associate-/l*0.7
Simplified0.7
if -inf.0 < (/ (* (* x 2.0) y) (- x y)) < -1.4715925298960858e-299 or 0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.8146538708310977e-20Initial program 5.1
Final simplification0.6
herbie shell --seed 2019304
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))
(/ (* (* x 2) y) (- x y)))