Average Error: 22.3 → 0.1
Time: 22.6s
Precision: 64
$\frac{x}{\frac{2 \cdot \left(y + 1\right)}{y - 1}} - \frac{x}{2}$
$\begin{array}{l} \mathbf{if}\;y \le -12500.198194177805:\\ \;\;\;\;\left(\frac{\frac{x}{y}}{y} - \frac{x}{y}\right) - \frac{\frac{\frac{x}{y}}{y}}{y}\\ \mathbf{elif}\;y \le 15500.9993962099:\\ \;\;\;\;\frac{\left(\left(\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1}\right) \cdot \frac{y - 1}{y + 1} - 1\right) \cdot \left(\frac{1}{2} \cdot x\right)}{\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1} + \log \left(e^{\frac{y - 1}{y + 1} + 1}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{x}{y}}{y} - \frac{x}{y}\right) - \frac{\frac{\frac{x}{y}}{y}}{y}\\ \end{array}$
\frac{x}{\frac{2 \cdot \left(y + 1\right)}{y - 1}} - \frac{x}{2}
\begin{array}{l}
\mathbf{if}\;y \le -12500.198194177805:\\
\;\;\;\;\left(\frac{\frac{x}{y}}{y} - \frac{x}{y}\right) - \frac{\frac{\frac{x}{y}}{y}}{y}\\

\mathbf{elif}\;y \le 15500.9993962099:\\
\;\;\;\;\frac{\left(\left(\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1}\right) \cdot \frac{y - 1}{y + 1} - 1\right) \cdot \left(\frac{1}{2} \cdot x\right)}{\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1} + \log \left(e^{\frac{y - 1}{y + 1} + 1}\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{x}{y}}{y} - \frac{x}{y}\right) - \frac{\frac{\frac{x}{y}}{y}}{y}\\

\end{array}
double f(double x, double y) {
double r10518139 = x;
double r10518140 = 2.0;
double r10518141 = y;
double r10518142 = 1.0;
double r10518143 = r10518141 + r10518142;
double r10518144 = r10518140 * r10518143;
double r10518145 = r10518141 - r10518142;
double r10518146 = r10518144 / r10518145;
double r10518147 = r10518139 / r10518146;
double r10518148 = r10518139 / r10518140;
double r10518149 = r10518147 - r10518148;
return r10518149;
}


double f(double x, double y) {
double r10518150 = y;
double r10518151 = -12500.198194177805;
bool r10518152 = r10518150 <= r10518151;
double r10518153 = x;
double r10518154 = r10518153 / r10518150;
double r10518155 = r10518154 / r10518150;
double r10518156 = r10518155 - r10518154;
double r10518157 = r10518155 / r10518150;
double r10518158 = r10518156 - r10518157;
double r10518159 = 15500.9993962099;
bool r10518160 = r10518150 <= r10518159;
double r10518161 = 1.0;
double r10518162 = r10518150 - r10518161;
double r10518163 = r10518150 + r10518161;
double r10518164 = r10518162 / r10518163;
double r10518165 = r10518164 * r10518164;
double r10518166 = r10518165 * r10518164;
double r10518167 = r10518166 - r10518161;
double r10518168 = 0.5;
double r10518169 = r10518168 * r10518153;
double r10518170 = r10518167 * r10518169;
double r10518171 = r10518164 + r10518161;
double r10518172 = exp(r10518171);
double r10518173 = log(r10518172);
double r10518174 = r10518165 + r10518173;
double r10518175 = r10518170 / r10518174;
double r10518176 = r10518160 ? r10518175 : r10518158;
double r10518177 = r10518152 ? r10518158 : r10518176;
return r10518177;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if y < -12500.198194177805 or 15500.9993962099 < y

1. Initial program 45.1

$\frac{x}{\frac{2 \cdot \left(y + 1\right)}{y - 1}} - \frac{x}{2}$
2. Simplified45.0

$\leadsto \color{blue}{\left(\frac{1}{2} \cdot x\right) \cdot \left(\frac{y - 1}{1 + y} - 1\right)}$
3. Using strategy rm
4. Applied flip3--45.0

$\leadsto \left(\frac{1}{2} \cdot x\right) \cdot \color{blue}{\frac{{\left(\frac{y - 1}{1 + y}\right)}^{3} - {1}^{3}}{\frac{y - 1}{1 + y} \cdot \frac{y - 1}{1 + y} + \left(1 \cdot 1 + \frac{y - 1}{1 + y} \cdot 1\right)}}$
5. Applied associate-*r/45.0

$\leadsto \color{blue}{\frac{\left(\frac{1}{2} \cdot x\right) \cdot \left({\left(\frac{y - 1}{1 + y}\right)}^{3} - {1}^{3}\right)}{\frac{y - 1}{1 + y} \cdot \frac{y - 1}{1 + y} + \left(1 \cdot 1 + \frac{y - 1}{1 + y} \cdot 1\right)}}$
6. Simplified45.0

$\leadsto \frac{\color{blue}{\left(\frac{y - 1}{y + 1} \cdot \left(\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1}\right) - 1\right) \cdot \left(\frac{1}{2} \cdot x\right)}}{\frac{y - 1}{1 + y} \cdot \frac{y - 1}{1 + y} + \left(1 \cdot 1 + \frac{y - 1}{1 + y} \cdot 1\right)}$
7. Taylor expanded around inf 0.1

$\leadsto \color{blue}{\frac{x}{{y}^{2}} - \left(\frac{x}{{y}^{3}} + \frac{x}{y}\right)}$
8. Simplified0.1

$\leadsto \color{blue}{\left(\frac{\frac{x}{y}}{y} - \frac{x}{y}\right) - \frac{\frac{\frac{x}{y}}{y}}{y}}$

## if -12500.198194177805 < y < 15500.9993962099

1. Initial program 0.1

$\frac{x}{\frac{2 \cdot \left(y + 1\right)}{y - 1}} - \frac{x}{2}$
2. Simplified0.1

$\leadsto \color{blue}{\left(\frac{1}{2} \cdot x\right) \cdot \left(\frac{y - 1}{1 + y} - 1\right)}$
3. Using strategy rm
4. Applied flip3--0.1

$\leadsto \left(\frac{1}{2} \cdot x\right) \cdot \color{blue}{\frac{{\left(\frac{y - 1}{1 + y}\right)}^{3} - {1}^{3}}{\frac{y - 1}{1 + y} \cdot \frac{y - 1}{1 + y} + \left(1 \cdot 1 + \frac{y - 1}{1 + y} \cdot 1\right)}}$
5. Applied associate-*r/0.1

$\leadsto \color{blue}{\frac{\left(\frac{1}{2} \cdot x\right) \cdot \left({\left(\frac{y - 1}{1 + y}\right)}^{3} - {1}^{3}\right)}{\frac{y - 1}{1 + y} \cdot \frac{y - 1}{1 + y} + \left(1 \cdot 1 + \frac{y - 1}{1 + y} \cdot 1\right)}}$
6. Simplified0.1

$\leadsto \frac{\color{blue}{\left(\frac{y - 1}{y + 1} \cdot \left(\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1}\right) - 1\right) \cdot \left(\frac{1}{2} \cdot x\right)}}{\frac{y - 1}{1 + y} \cdot \frac{y - 1}{1 + y} + \left(1 \cdot 1 + \frac{y - 1}{1 + y} \cdot 1\right)}$
7. Using strategy rm

$\leadsto \frac{\left(\frac{y - 1}{y + 1} \cdot \left(\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1}\right) - 1\right) \cdot \left(\frac{1}{2} \cdot x\right)}{\frac{y - 1}{1 + y} \cdot \frac{y - 1}{1 + y} + \color{blue}{\log \left(e^{1 \cdot 1 + \frac{y - 1}{1 + y} \cdot 1}\right)}}$
3. Recombined 2 regimes into one program.
4. Final simplification0.1

$\leadsto \begin{array}{l} \mathbf{if}\;y \le -12500.198194177805:\\ \;\;\;\;\left(\frac{\frac{x}{y}}{y} - \frac{x}{y}\right) - \frac{\frac{\frac{x}{y}}{y}}{y}\\ \mathbf{elif}\;y \le 15500.9993962099:\\ \;\;\;\;\frac{\left(\left(\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1}\right) \cdot \frac{y - 1}{y + 1} - 1\right) \cdot \left(\frac{1}{2} \cdot x\right)}{\frac{y - 1}{y + 1} \cdot \frac{y - 1}{y + 1} + \log \left(e^{\frac{y - 1}{y + 1} + 1}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{x}{y}}{y} - \frac{x}{y}\right) - \frac{\frac{\frac{x}{y}}{y}}{y}\\ \end{array}$

# Reproduce

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