Average Error: 14.3 → 0.0
Time: 13.8s
Precision: 64
$0 \le x \land x \lt y$
$\frac{\left(2 \cdot x\right) \cdot y}{x - y}$
$\frac{x \cdot 2}{\frac{x}{y} - 1}$
\frac{\left(2 \cdot x\right) \cdot y}{x - y}
\frac{x \cdot 2}{\frac{x}{y} - 1}
double f(double x, double y) {
double r16028144 = 2.0;
double r16028145 = x;
double r16028146 = r16028144 * r16028145;
double r16028147 = y;
double r16028148 = r16028146 * r16028147;
double r16028149 = r16028145 - r16028147;
double r16028150 = r16028148 / r16028149;
return r16028150;
}


double f(double x, double y) {
double r16028151 = x;
double r16028152 = 2.0;
double r16028153 = r16028151 * r16028152;
double r16028154 = y;
double r16028155 = r16028151 / r16028154;
double r16028156 = 1.0;
double r16028157 = r16028155 - r16028156;
double r16028158 = r16028153 / r16028157;
return r16028158;
}



# Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 14.3

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

$\leadsto \color{blue}{\frac{2 \cdot x}{\frac{x - y}{y}}}$
4. Using strategy rm
5. Applied div-sub0.0

$\leadsto \frac{2 \cdot x}{\color{blue}{\frac{x}{y} - \frac{y}{y}}}$
6. Simplified0.0

$\leadsto \frac{2 \cdot x}{\frac{x}{y} - \color{blue}{1}}$
7. Final simplification0.0

$\leadsto \frac{x \cdot 2}{\frac{x}{y} - 1}$

# Reproduce

herbie shell --seed 1
(FPCore (x y)
:name "2*x*y/(x-y)"
:pre (and (<= 0 x) (< x y))
(/ (* (* 2 x) y) (- x y)))