Average Error: 14.6 → 1.2
Time: 2.3s
Precision: 64
\[\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 -3.72743673882506554 \cdot 10^{-62} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -9.8604770127885007 \cdot 10^{-293} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -0.0 \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 6.68716579138233919 \cdot 10^{-100}\right)\right)\right):\\ \;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\ \end{array}\]
\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 -3.72743673882506554 \cdot 10^{-62} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -9.8604770127885007 \cdot 10^{-293} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -0.0 \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 6.68716579138233919 \cdot 10^{-100}\right)\right)\right):\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\

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

\end{array}
double code(double x, double y) {
	return ((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))));
}
double code(double x, double y) {
	double VAR;
	if (((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -3.7274367388250655e-62) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -9.860477012788501e-293) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -0.0) || !(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 6.687165791382339e-100))))) {
		VAR = ((double) (((double) (x * 2.0)) * ((double) (y / ((double) (x - y))))));
	} else {
		VAR = ((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.6
Target0.3
Herbie1.2
\[\begin{array}{l} \mathbf{if}\;x \lt -1.7210442634149447 \cdot 10^{81}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \mathbf{elif}\;x \lt 83645045635564432:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* (* x 2.0) y) (- x y)) < -3.7274367388250655e-62 or -9.860477012788501e-293 < (/ (* (* x 2.0) y) (- x y)) < -0.0 or 6.687165791382339e-100 < (/ (* (* x 2.0) y) (- x y))

    1. Initial program 27.6

      \[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity27.6

      \[\leadsto \frac{\left(x \cdot 2\right) \cdot y}{\color{blue}{1 \cdot \left(x - y\right)}}\]
    4. Applied times-frac1.7

      \[\leadsto \color{blue}{\frac{x \cdot 2}{1} \cdot \frac{y}{x - y}}\]
    5. Simplified1.7

      \[\leadsto \color{blue}{\left(x \cdot 2\right)} \cdot \frac{y}{x - y}\]

    if -3.7274367388250655e-62 < (/ (* (* x 2.0) y) (- x y)) < -9.860477012788501e-293 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 6.687165791382339e-100

    1. Initial program 0.6

      \[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -3.72743673882506554 \cdot 10^{-62} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -9.8604770127885007 \cdot 10^{-293} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -0.0 \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 6.68716579138233919 \cdot 10^{-100}\right)\right)\right):\\ \;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020128 
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, B"
  :precision binary64

  :herbie-target
  (if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))

  (/ (* (* x 2.0) y) (- x y)))