Average Error: 14.4 → 0.7
Time: 27.1s
Precision: 64
$\frac{\left(2 \cdot x\right) \cdot y}{x - y}$
$\begin{array}{l} \mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} = -\infty:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -6.220306090676272 \cdot 10^{-292}:\\ \;\;\;\;\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:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 3.671660047644326 \cdot 10^{-28}:\\ \;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \end{array}$
\frac{\left(2 \cdot x\right) \cdot y}{x - y}
\begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} = -\infty:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\

\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -6.220306090676272 \cdot 10^{-292}:\\
\;\;\;\;\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:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\

\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 3.671660047644326 \cdot 10^{-28}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\

\end{array}
double f(double x, double y) {
double r8387823 = 2.0;
double r8387824 = x;
double r8387825 = r8387823 * r8387824;
double r8387826 = y;
double r8387827 = r8387825 * r8387826;
double r8387828 = r8387824 - r8387826;
double r8387829 = r8387827 / r8387828;
return r8387829;
}


double f(double x, double y) {
double r8387830 = x;
double r8387831 = 2.0;
double r8387832 = r8387830 * r8387831;
double r8387833 = y;
double r8387834 = r8387832 * r8387833;
double r8387835 = r8387830 - r8387833;
double r8387836 = r8387834 / r8387835;
double r8387837 = -inf.0;
bool r8387838 = r8387836 <= r8387837;
double r8387839 = r8387835 / r8387833;
double r8387840 = r8387832 / r8387839;
double r8387841 = -6.220306090676272e-292;
bool r8387842 = r8387836 <= r8387841;
double r8387843 = -0.0;
bool r8387844 = r8387836 <= r8387843;
double r8387845 = 3.671660047644326e-28;
bool r8387846 = r8387836 <= r8387845;
double r8387847 = r8387846 ? r8387836 : r8387840;
double r8387848 = r8387844 ? r8387840 : r8387847;
double r8387849 = r8387842 ? r8387836 : r8387848;
double r8387850 = r8387838 ? r8387840 : r8387849;
return r8387850;
}



Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Split input into 2 regimes
2. if (/ (* (* 2 x) y) (- x y)) < -inf.0 or -6.220306090676272e-292 < (/ (* (* 2 x) y) (- x y)) < -0.0 or 3.671660047644326e-28 < (/ (* (* 2 x) y) (- x y))

1. Initial program 42.0

$\frac{\left(2 \cdot x\right) \cdot y}{x - y}$
2. Using strategy rm
3. Applied associate-/l*1.3

$\leadsto \color{blue}{\frac{2 \cdot x}{\frac{x - y}{y}}}$

if -inf.0 < (/ (* (* 2 x) y) (- x y)) < -6.220306090676272e-292 or -0.0 < (/ (* (* 2 x) y) (- x y)) < 3.671660047644326e-28

1. Initial program 0.5

$\frac{\left(2 \cdot x\right) \cdot y}{x - y}$
3. Recombined 2 regimes into one program.
4. Final simplification0.7

$\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} = -\infty:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -6.220306090676272 \cdot 10^{-292}:\\ \;\;\;\;\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:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 3.671660047644326 \cdot 10^{-28}:\\ \;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \end{array}$

Reproduce

herbie shell --seed 1
(FPCore (x y)
:name "2*x*y/(x-y)"
(/ (* (* 2 x) y) (- x y)))