Average Error: 15.1 → 1.1
Time: 1.8s
Precision: binary64
\[\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 -5.7247183736428316 \cdot 10^{-67} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -1.22106957429828852 \cdot 10^{-283} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 1.8415218432721044 \cdot 10^{-305}\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 7.3297235194227525 \cdot 10^{-50}\right):\\ \;\;\;\;x \cdot \left(2 \cdot \frac{y}{x - y}\right)\\ \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 -5.7247183736428316 \cdot 10^{-67} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -1.22106957429828852 \cdot 10^{-283} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 1.8415218432721044 \cdot 10^{-305}\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 7.3297235194227525 \cdot 10^{-50}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \frac{y}{x - y}\right)\\

\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)))) <= -5.7247183736428316e-67) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -1.2210695742982885e-283) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 1.8415218432721044e-305) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 7.3297235194227525e-50))))) {
		VAR = ((double) (x * ((double) (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

Original15.1
Target0.4
Herbie1.1
\[\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)) < -5.7247183736428316e-67 or -1.22106957429828852e-283 < (/ (* (* x 2.0) y) (- x y)) < 1.8415218432721044e-305 or 7.3297235194227525e-50 < (/ (* (* x 2.0) y) (- x y))

    1. Initial program 30.0

      \[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]
    2. Simplified1.7

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

    if -5.7247183736428316e-67 < (/ (* (* x 2.0) y) (- x y)) < -1.22106957429828852e-283 or 1.8415218432721044e-305 < (/ (* (* x 2.0) y) (- x y)) < 7.3297235194227525e-50

    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.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -5.7247183736428316 \cdot 10^{-67} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -1.22106957429828852 \cdot 10^{-283} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 1.8415218432721044 \cdot 10^{-305}\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 7.3297235194227525 \cdot 10^{-50}\right):\\ \;\;\;\;x \cdot \left(2 \cdot \frac{y}{x - y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020184 
(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)))