Data.Colour.RGB:hslsv from colour-2.3.3, C

Percentage Accurate: 100.0% → 100.0%
Time: 7.1s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x - y}{2 - \left(x + y\right)} \end{array} \]
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
def code(x, y):
	return (x - y) / (2.0 - (x + y))
function code(x, y)
	return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y)))
end
function tmp = code(x, y)
	tmp = (x - y) / (2.0 - (x + y));
end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x - y}{2 - \left(x + y\right)} \end{array} \]
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
def code(x, y):
	return (x - y) / (2.0 - (x + y))
function code(x, y)
	return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y)))
end
function tmp = code(x, y)
	tmp = (x - y) / (2.0 - (x + y));
end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x - y}{2 - \left(x + y\right)} \end{array} \]
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
	return (x - y) / (2.0 - (x + y));
}
def code(x, y):
	return (x - y) / (2.0 - (x + y))
function code(x, y)
	return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y)))
end
function tmp = code(x, y)
	tmp = (x - y) / (2.0 - (x + y));
end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{x - y}{2 - \left(x + y\right)} \]
  2. Final simplification100.0%

    \[\leadsto \frac{x - y}{2 - \left(x + y\right)} \]

Alternative 2: 74.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -1 + \frac{y}{x}\\ t_1 := \frac{y}{y - 2}\\ \mathbf{if}\;x \leq -1.95 \cdot 10^{+15}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -8.8 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-56}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{-37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-16}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 9.6 \cdot 10^{+42}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ -1.0 (/ y x))) (t_1 (/ y (- y 2.0))))
   (if (<= x -1.95e+15)
     t_0
     (if (<= x -8.8e-41)
       t_1
       (if (<= x -3.2e-56)
         (* x 0.5)
         (if (<= x 3.7e-37)
           t_1
           (if (<= x 6.5e-16) (* x 0.5) (if (<= x 9.6e+42) 1.0 t_0))))))))
double code(double x, double y) {
	double t_0 = -1.0 + (y / x);
	double t_1 = y / (y - 2.0);
	double tmp;
	if (x <= -1.95e+15) {
		tmp = t_0;
	} else if (x <= -8.8e-41) {
		tmp = t_1;
	} else if (x <= -3.2e-56) {
		tmp = x * 0.5;
	} else if (x <= 3.7e-37) {
		tmp = t_1;
	} else if (x <= 6.5e-16) {
		tmp = x * 0.5;
	} else if (x <= 9.6e+42) {
		tmp = 1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-1.0d0) + (y / x)
    t_1 = y / (y - 2.0d0)
    if (x <= (-1.95d+15)) then
        tmp = t_0
    else if (x <= (-8.8d-41)) then
        tmp = t_1
    else if (x <= (-3.2d-56)) then
        tmp = x * 0.5d0
    else if (x <= 3.7d-37) then
        tmp = t_1
    else if (x <= 6.5d-16) then
        tmp = x * 0.5d0
    else if (x <= 9.6d+42) then
        tmp = 1.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = -1.0 + (y / x);
	double t_1 = y / (y - 2.0);
	double tmp;
	if (x <= -1.95e+15) {
		tmp = t_0;
	} else if (x <= -8.8e-41) {
		tmp = t_1;
	} else if (x <= -3.2e-56) {
		tmp = x * 0.5;
	} else if (x <= 3.7e-37) {
		tmp = t_1;
	} else if (x <= 6.5e-16) {
		tmp = x * 0.5;
	} else if (x <= 9.6e+42) {
		tmp = 1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = -1.0 + (y / x)
	t_1 = y / (y - 2.0)
	tmp = 0
	if x <= -1.95e+15:
		tmp = t_0
	elif x <= -8.8e-41:
		tmp = t_1
	elif x <= -3.2e-56:
		tmp = x * 0.5
	elif x <= 3.7e-37:
		tmp = t_1
	elif x <= 6.5e-16:
		tmp = x * 0.5
	elif x <= 9.6e+42:
		tmp = 1.0
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(-1.0 + Float64(y / x))
	t_1 = Float64(y / Float64(y - 2.0))
	tmp = 0.0
	if (x <= -1.95e+15)
		tmp = t_0;
	elseif (x <= -8.8e-41)
		tmp = t_1;
	elseif (x <= -3.2e-56)
		tmp = Float64(x * 0.5);
	elseif (x <= 3.7e-37)
		tmp = t_1;
	elseif (x <= 6.5e-16)
		tmp = Float64(x * 0.5);
	elseif (x <= 9.6e+42)
		tmp = 1.0;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = -1.0 + (y / x);
	t_1 = y / (y - 2.0);
	tmp = 0.0;
	if (x <= -1.95e+15)
		tmp = t_0;
	elseif (x <= -8.8e-41)
		tmp = t_1;
	elseif (x <= -3.2e-56)
		tmp = x * 0.5;
	elseif (x <= 3.7e-37)
		tmp = t_1;
	elseif (x <= 6.5e-16)
		tmp = x * 0.5;
	elseif (x <= 9.6e+42)
		tmp = 1.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e+15], t$95$0, If[LessEqual[x, -8.8e-41], t$95$1, If[LessEqual[x, -3.2e-56], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 3.7e-37], t$95$1, If[LessEqual[x, 6.5e-16], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 9.6e+42], 1.0, t$95$0]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -1 + \frac{y}{x}\\
t_1 := \frac{y}{y - 2}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+15}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -8.8 \cdot 10^{-41}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -3.2 \cdot 10^{-56}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq 3.7 \cdot 10^{-37}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 6.5 \cdot 10^{-16}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq 9.6 \cdot 10^{+42}:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.95e15 or 9.5999999999999994e42 < x

    1. Initial program 99.9%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.9%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.9%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.9%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.9%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.9%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Step-by-step derivation
      1. clear-num100.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + -2\right)}{y - x}}} \]
      2. associate-/r/99.7%

        \[\leadsto \color{blue}{\frac{1}{x + \left(y + -2\right)} \cdot \left(y - x\right)} \]
      3. +-commutative99.7%

        \[\leadsto \frac{1}{\color{blue}{\left(y + -2\right) + x}} \cdot \left(y - x\right) \]
      4. associate-+l+99.7%

        \[\leadsto \frac{1}{\color{blue}{y + \left(-2 + x\right)}} \cdot \left(y - x\right) \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{1}{y + \left(-2 + x\right)} \cdot \left(y - x\right)} \]
    6. Taylor expanded in x around inf 75.2%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \left(y - x\right) \]
    7. Taylor expanded in x around 0 75.4%

      \[\leadsto \color{blue}{\frac{y}{x} - 1} \]

    if -1.95e15 < x < -8.7999999999999999e-41 or -3.19999999999999986e-56 < x < 3.7e-37

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 82.3%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]

    if -8.7999999999999999e-41 < x < -3.19999999999999986e-56 or 3.7e-37 < x < 6.50000000000000011e-16

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 99.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/99.4%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg99.4%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg99.4%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval99.4%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified99.4%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]
    7. Taylor expanded in x around 0 99.4%

      \[\leadsto \color{blue}{0.5 \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative99.4%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    9. Simplified99.4%

      \[\leadsto \color{blue}{x \cdot 0.5} \]

    if 6.50000000000000011e-16 < x < 9.5999999999999994e42

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 58.8%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification79.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{+15}:\\ \;\;\;\;-1 + \frac{y}{x}\\ \mathbf{elif}\;x \leq -8.8 \cdot 10^{-41}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-56}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{-37}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-16}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 9.6 \cdot 10^{+42}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{y}{x}\\ \end{array} \]

Alternative 3: 74.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x}{x + -2}\\ \mathbf{if}\;y \leq -2.2 \cdot 10^{-60}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+41}:\\ \;\;\;\;y \cdot \frac{1}{y + -2}\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+52}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1 + -2 \cdot \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (- x) (+ x -2.0))))
   (if (<= y -2.2e-60)
     (/ y (- y 2.0))
     (if (<= y 9.5e-18)
       t_0
       (if (<= y 5.6e+41)
         (* y (/ 1.0 (+ y -2.0)))
         (if (<= y 2.6e+52) t_0 (+ 1.0 (* -2.0 (/ x y)))))))))
double code(double x, double y) {
	double t_0 = -x / (x + -2.0);
	double tmp;
	if (y <= -2.2e-60) {
		tmp = y / (y - 2.0);
	} else if (y <= 9.5e-18) {
		tmp = t_0;
	} else if (y <= 5.6e+41) {
		tmp = y * (1.0 / (y + -2.0));
	} else if (y <= 2.6e+52) {
		tmp = t_0;
	} else {
		tmp = 1.0 + (-2.0 * (x / y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -x / (x + (-2.0d0))
    if (y <= (-2.2d-60)) then
        tmp = y / (y - 2.0d0)
    else if (y <= 9.5d-18) then
        tmp = t_0
    else if (y <= 5.6d+41) then
        tmp = y * (1.0d0 / (y + (-2.0d0)))
    else if (y <= 2.6d+52) then
        tmp = t_0
    else
        tmp = 1.0d0 + ((-2.0d0) * (x / y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = -x / (x + -2.0);
	double tmp;
	if (y <= -2.2e-60) {
		tmp = y / (y - 2.0);
	} else if (y <= 9.5e-18) {
		tmp = t_0;
	} else if (y <= 5.6e+41) {
		tmp = y * (1.0 / (y + -2.0));
	} else if (y <= 2.6e+52) {
		tmp = t_0;
	} else {
		tmp = 1.0 + (-2.0 * (x / y));
	}
	return tmp;
}
def code(x, y):
	t_0 = -x / (x + -2.0)
	tmp = 0
	if y <= -2.2e-60:
		tmp = y / (y - 2.0)
	elif y <= 9.5e-18:
		tmp = t_0
	elif y <= 5.6e+41:
		tmp = y * (1.0 / (y + -2.0))
	elif y <= 2.6e+52:
		tmp = t_0
	else:
		tmp = 1.0 + (-2.0 * (x / y))
	return tmp
function code(x, y)
	t_0 = Float64(Float64(-x) / Float64(x + -2.0))
	tmp = 0.0
	if (y <= -2.2e-60)
		tmp = Float64(y / Float64(y - 2.0));
	elseif (y <= 9.5e-18)
		tmp = t_0;
	elseif (y <= 5.6e+41)
		tmp = Float64(y * Float64(1.0 / Float64(y + -2.0)));
	elseif (y <= 2.6e+52)
		tmp = t_0;
	else
		tmp = Float64(1.0 + Float64(-2.0 * Float64(x / y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = -x / (x + -2.0);
	tmp = 0.0;
	if (y <= -2.2e-60)
		tmp = y / (y - 2.0);
	elseif (y <= 9.5e-18)
		tmp = t_0;
	elseif (y <= 5.6e+41)
		tmp = y * (1.0 / (y + -2.0));
	elseif (y <= 2.6e+52)
		tmp = t_0;
	else
		tmp = 1.0 + (-2.0 * (x / y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[((-x) / N[(x + -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e-60], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-18], t$95$0, If[LessEqual[y, 5.6e+41], N[(y * N[(1.0 / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+52], t$95$0, N[(1.0 + N[(-2.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x}{x + -2}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{-60}:\\
\;\;\;\;\frac{y}{y - 2}\\

\mathbf{elif}\;y \leq 9.5 \cdot 10^{-18}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 5.6 \cdot 10^{+41}:\\
\;\;\;\;y \cdot \frac{1}{y + -2}\\

\mathbf{elif}\;y \leq 2.6 \cdot 10^{+52}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2.1999999999999999e-60

    1. Initial program 99.9%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.9%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.9%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.9%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.9%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.9%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 75.5%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]

    if -2.1999999999999999e-60 < y < 9.5000000000000003e-18 or 5.5999999999999999e41 < y < 2.6e52

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 84.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/84.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg84.1%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg84.1%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval84.1%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified84.1%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]

    if 9.5000000000000003e-18 < y < 5.5999999999999999e41

    1. Initial program 99.9%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.9%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.9%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.9%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.9%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.9%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 72.6%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]
    5. Step-by-step derivation
      1. div-inv72.8%

        \[\leadsto \color{blue}{y \cdot \frac{1}{y - 2}} \]
      2. sub-neg72.8%

        \[\leadsto y \cdot \frac{1}{\color{blue}{y + \left(-2\right)}} \]
      3. metadata-eval72.8%

        \[\leadsto y \cdot \frac{1}{y + \color{blue}{-2}} \]
    6. Applied egg-rr72.8%

      \[\leadsto \color{blue}{y \cdot \frac{1}{y + -2}} \]

    if 2.6e52 < y

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 84.4%

      \[\leadsto \color{blue}{\left(1 + \left(-1 \cdot \frac{x}{y} + 2 \cdot \frac{1}{y}\right)\right) - \frac{x}{y}} \]
    5. Step-by-step derivation
      1. associate--l+84.4%

        \[\leadsto \color{blue}{1 + \left(\left(-1 \cdot \frac{x}{y} + 2 \cdot \frac{1}{y}\right) - \frac{x}{y}\right)} \]
      2. +-commutative84.4%

        \[\leadsto 1 + \left(\color{blue}{\left(2 \cdot \frac{1}{y} + -1 \cdot \frac{x}{y}\right)} - \frac{x}{y}\right) \]
      3. mul-1-neg84.4%

        \[\leadsto 1 + \left(\left(2 \cdot \frac{1}{y} + \color{blue}{\left(-\frac{x}{y}\right)}\right) - \frac{x}{y}\right) \]
      4. unsub-neg84.4%

        \[\leadsto 1 + \left(\color{blue}{\left(2 \cdot \frac{1}{y} - \frac{x}{y}\right)} - \frac{x}{y}\right) \]
      5. associate-*r/84.4%

        \[\leadsto 1 + \left(\left(\color{blue}{\frac{2 \cdot 1}{y}} - \frac{x}{y}\right) - \frac{x}{y}\right) \]
      6. metadata-eval84.4%

        \[\leadsto 1 + \left(\left(\frac{\color{blue}{2}}{y} - \frac{x}{y}\right) - \frac{x}{y}\right) \]
    6. Simplified84.4%

      \[\leadsto \color{blue}{1 + \left(\left(\frac{2}{y} - \frac{x}{y}\right) - \frac{x}{y}\right)} \]
    7. Taylor expanded in x around inf 84.4%

      \[\leadsto 1 + \color{blue}{-2 \cdot \frac{x}{y}} \]
    8. Step-by-step derivation
      1. *-commutative84.4%

        \[\leadsto 1 + \color{blue}{\frac{x}{y} \cdot -2} \]
    9. Simplified84.4%

      \[\leadsto 1 + \color{blue}{\frac{x}{y} \cdot -2} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification81.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-60}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-18}:\\ \;\;\;\;\frac{-x}{x + -2}\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+41}:\\ \;\;\;\;y \cdot \frac{1}{y + -2}\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+52}:\\ \;\;\;\;\frac{-x}{x + -2}\\ \mathbf{else}:\\ \;\;\;\;1 + -2 \cdot \frac{x}{y}\\ \end{array} \]

Alternative 4: 74.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{y - 2}\\ \mathbf{if}\;y \leq -6.9 \cdot 10^{-59}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-17}:\\ \;\;\;\;\frac{-x}{x + -2}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+44}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+55}:\\ \;\;\;\;-1 + \frac{-2}{x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ y (- y 2.0))))
   (if (<= y -6.9e-59)
     t_0
     (if (<= y 9e-17)
       (/ (- x) (+ x -2.0))
       (if (<= y 2.3e+44) t_0 (if (<= y 4.6e+55) (+ -1.0 (/ -2.0 x)) 1.0))))))
double code(double x, double y) {
	double t_0 = y / (y - 2.0);
	double tmp;
	if (y <= -6.9e-59) {
		tmp = t_0;
	} else if (y <= 9e-17) {
		tmp = -x / (x + -2.0);
	} else if (y <= 2.3e+44) {
		tmp = t_0;
	} else if (y <= 4.6e+55) {
		tmp = -1.0 + (-2.0 / x);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y / (y - 2.0d0)
    if (y <= (-6.9d-59)) then
        tmp = t_0
    else if (y <= 9d-17) then
        tmp = -x / (x + (-2.0d0))
    else if (y <= 2.3d+44) then
        tmp = t_0
    else if (y <= 4.6d+55) then
        tmp = (-1.0d0) + ((-2.0d0) / x)
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y / (y - 2.0);
	double tmp;
	if (y <= -6.9e-59) {
		tmp = t_0;
	} else if (y <= 9e-17) {
		tmp = -x / (x + -2.0);
	} else if (y <= 2.3e+44) {
		tmp = t_0;
	} else if (y <= 4.6e+55) {
		tmp = -1.0 + (-2.0 / x);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	t_0 = y / (y - 2.0)
	tmp = 0
	if y <= -6.9e-59:
		tmp = t_0
	elif y <= 9e-17:
		tmp = -x / (x + -2.0)
	elif y <= 2.3e+44:
		tmp = t_0
	elif y <= 4.6e+55:
		tmp = -1.0 + (-2.0 / x)
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	t_0 = Float64(y / Float64(y - 2.0))
	tmp = 0.0
	if (y <= -6.9e-59)
		tmp = t_0;
	elseif (y <= 9e-17)
		tmp = Float64(Float64(-x) / Float64(x + -2.0));
	elseif (y <= 2.3e+44)
		tmp = t_0;
	elseif (y <= 4.6e+55)
		tmp = Float64(-1.0 + Float64(-2.0 / x));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y / (y - 2.0);
	tmp = 0.0;
	if (y <= -6.9e-59)
		tmp = t_0;
	elseif (y <= 9e-17)
		tmp = -x / (x + -2.0);
	elseif (y <= 2.3e+44)
		tmp = t_0;
	elseif (y <= 4.6e+55)
		tmp = -1.0 + (-2.0 / x);
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.9e-59], t$95$0, If[LessEqual[y, 9e-17], N[((-x) / N[(x + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+44], t$95$0, If[LessEqual[y, 4.6e+55], N[(-1.0 + N[(-2.0 / x), $MachinePrecision]), $MachinePrecision], 1.0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y}{y - 2}\\
\mathbf{if}\;y \leq -6.9 \cdot 10^{-59}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 9 \cdot 10^{-17}:\\
\;\;\;\;\frac{-x}{x + -2}\\

\mathbf{elif}\;y \leq 2.3 \cdot 10^{+44}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 4.6 \cdot 10^{+55}:\\
\;\;\;\;-1 + \frac{-2}{x}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -6.89999999999999982e-59 or 8.99999999999999957e-17 < y < 2.30000000000000004e44

    1. Initial program 99.9%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.9%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.9%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.9%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.9%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.9%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 74.5%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]

    if -6.89999999999999982e-59 < y < 8.99999999999999957e-17

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 84.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/84.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg84.1%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg84.1%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval84.1%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified84.1%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]

    if 2.30000000000000004e44 < y < 4.59999999999999975e55

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 83.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/83.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg83.6%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg83.6%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval83.6%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified83.6%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]
    7. Taylor expanded in x around inf 84.7%

      \[\leadsto \color{blue}{-\left(1 + 2 \cdot \frac{1}{x}\right)} \]
    8. Step-by-step derivation
      1. distribute-neg-in84.7%

        \[\leadsto \color{blue}{\left(-1\right) + \left(-2 \cdot \frac{1}{x}\right)} \]
      2. metadata-eval84.7%

        \[\leadsto \color{blue}{-1} + \left(-2 \cdot \frac{1}{x}\right) \]
      3. associate-*r/84.7%

        \[\leadsto -1 + \left(-\color{blue}{\frac{2 \cdot 1}{x}}\right) \]
      4. metadata-eval84.7%

        \[\leadsto -1 + \left(-\frac{\color{blue}{2}}{x}\right) \]
      5. distribute-neg-frac84.7%

        \[\leadsto -1 + \color{blue}{\frac{-2}{x}} \]
      6. metadata-eval84.7%

        \[\leadsto -1 + \frac{\color{blue}{-2}}{x} \]
    9. Simplified84.7%

      \[\leadsto \color{blue}{-1 + \frac{-2}{x}} \]

    if 4.59999999999999975e55 < y

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 85.2%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification81.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.9 \cdot 10^{-59}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-17}:\\ \;\;\;\;\frac{-x}{x + -2}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+44}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+55}:\\ \;\;\;\;-1 + \frac{-2}{x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 5: 74.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{-59}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;y \leq 1.04 \cdot 10^{-16}:\\ \;\;\;\;\frac{-x}{x + -2}\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+41}:\\ \;\;\;\;y \cdot \frac{1}{y + -2}\\ \mathbf{elif}\;y \leq 2.45 \cdot 10^{+58}:\\ \;\;\;\;-1 + \frac{-2}{x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -4.6e-59)
   (/ y (- y 2.0))
   (if (<= y 1.04e-16)
     (/ (- x) (+ x -2.0))
     (if (<= y 5.6e+41)
       (* y (/ 1.0 (+ y -2.0)))
       (if (<= y 2.45e+58) (+ -1.0 (/ -2.0 x)) 1.0)))))
double code(double x, double y) {
	double tmp;
	if (y <= -4.6e-59) {
		tmp = y / (y - 2.0);
	} else if (y <= 1.04e-16) {
		tmp = -x / (x + -2.0);
	} else if (y <= 5.6e+41) {
		tmp = y * (1.0 / (y + -2.0));
	} else if (y <= 2.45e+58) {
		tmp = -1.0 + (-2.0 / x);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-4.6d-59)) then
        tmp = y / (y - 2.0d0)
    else if (y <= 1.04d-16) then
        tmp = -x / (x + (-2.0d0))
    else if (y <= 5.6d+41) then
        tmp = y * (1.0d0 / (y + (-2.0d0)))
    else if (y <= 2.45d+58) then
        tmp = (-1.0d0) + ((-2.0d0) / x)
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -4.6e-59) {
		tmp = y / (y - 2.0);
	} else if (y <= 1.04e-16) {
		tmp = -x / (x + -2.0);
	} else if (y <= 5.6e+41) {
		tmp = y * (1.0 / (y + -2.0));
	} else if (y <= 2.45e+58) {
		tmp = -1.0 + (-2.0 / x);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -4.6e-59:
		tmp = y / (y - 2.0)
	elif y <= 1.04e-16:
		tmp = -x / (x + -2.0)
	elif y <= 5.6e+41:
		tmp = y * (1.0 / (y + -2.0))
	elif y <= 2.45e+58:
		tmp = -1.0 + (-2.0 / x)
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -4.6e-59)
		tmp = Float64(y / Float64(y - 2.0));
	elseif (y <= 1.04e-16)
		tmp = Float64(Float64(-x) / Float64(x + -2.0));
	elseif (y <= 5.6e+41)
		tmp = Float64(y * Float64(1.0 / Float64(y + -2.0)));
	elseif (y <= 2.45e+58)
		tmp = Float64(-1.0 + Float64(-2.0 / x));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -4.6e-59)
		tmp = y / (y - 2.0);
	elseif (y <= 1.04e-16)
		tmp = -x / (x + -2.0);
	elseif (y <= 5.6e+41)
		tmp = y * (1.0 / (y + -2.0));
	elseif (y <= 2.45e+58)
		tmp = -1.0 + (-2.0 / x);
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -4.6e-59], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.04e-16], N[((-x) / N[(x + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e+41], N[(y * N[(1.0 / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.45e+58], N[(-1.0 + N[(-2.0 / x), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{-59}:\\
\;\;\;\;\frac{y}{y - 2}\\

\mathbf{elif}\;y \leq 1.04 \cdot 10^{-16}:\\
\;\;\;\;\frac{-x}{x + -2}\\

\mathbf{elif}\;y \leq 5.6 \cdot 10^{+41}:\\
\;\;\;\;y \cdot \frac{1}{y + -2}\\

\mathbf{elif}\;y \leq 2.45 \cdot 10^{+58}:\\
\;\;\;\;-1 + \frac{-2}{x}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -4.59999999999999959e-59

    1. Initial program 99.9%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.9%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.9%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.9%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.9%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.9%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 75.5%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]

    if -4.59999999999999959e-59 < y < 1.04000000000000001e-16

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 84.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/84.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg84.1%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg84.1%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval84.1%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified84.1%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]

    if 1.04000000000000001e-16 < y < 5.5999999999999999e41

    1. Initial program 99.9%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.9%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.9%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.9%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.9%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.9%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.9%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.9%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.9%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.9%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 72.6%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]
    5. Step-by-step derivation
      1. div-inv72.8%

        \[\leadsto \color{blue}{y \cdot \frac{1}{y - 2}} \]
      2. sub-neg72.8%

        \[\leadsto y \cdot \frac{1}{\color{blue}{y + \left(-2\right)}} \]
      3. metadata-eval72.8%

        \[\leadsto y \cdot \frac{1}{y + \color{blue}{-2}} \]
    6. Applied egg-rr72.8%

      \[\leadsto \color{blue}{y \cdot \frac{1}{y + -2}} \]

    if 5.5999999999999999e41 < y < 2.45000000000000009e58

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 75.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/75.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg75.9%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg75.9%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval75.9%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified75.9%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]
    7. Taylor expanded in x around inf 76.1%

      \[\leadsto \color{blue}{-\left(1 + 2 \cdot \frac{1}{x}\right)} \]
    8. Step-by-step derivation
      1. distribute-neg-in76.1%

        \[\leadsto \color{blue}{\left(-1\right) + \left(-2 \cdot \frac{1}{x}\right)} \]
      2. metadata-eval76.1%

        \[\leadsto \color{blue}{-1} + \left(-2 \cdot \frac{1}{x}\right) \]
      3. associate-*r/76.1%

        \[\leadsto -1 + \left(-\color{blue}{\frac{2 \cdot 1}{x}}\right) \]
      4. metadata-eval76.1%

        \[\leadsto -1 + \left(-\frac{\color{blue}{2}}{x}\right) \]
      5. distribute-neg-frac76.1%

        \[\leadsto -1 + \color{blue}{\frac{-2}{x}} \]
      6. metadata-eval76.1%

        \[\leadsto -1 + \frac{\color{blue}{-2}}{x} \]
    9. Simplified76.1%

      \[\leadsto \color{blue}{-1 + \frac{-2}{x}} \]

    if 2.45000000000000009e58 < y

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 85.2%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification81.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{-59}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{elif}\;y \leq 1.04 \cdot 10^{-16}:\\ \;\;\;\;\frac{-x}{x + -2}\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+41}:\\ \;\;\;\;y \cdot \frac{1}{y + -2}\\ \mathbf{elif}\;y \leq 2.45 \cdot 10^{+58}:\\ \;\;\;\;-1 + \frac{-2}{x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 6: 60.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -4.4 \cdot 10^{-67}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.85 \cdot 10^{-241}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-237}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+52}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -2.0)
   1.0
   (if (<= y -4.4e-67)
     (* y -0.5)
     (if (<= y -2.85e-241)
       -1.0
       (if (<= y 1.3e-237) (* x 0.5) (if (<= y 4e+52) -1.0 1.0))))))
double code(double x, double y) {
	double tmp;
	if (y <= -2.0) {
		tmp = 1.0;
	} else if (y <= -4.4e-67) {
		tmp = y * -0.5;
	} else if (y <= -2.85e-241) {
		tmp = -1.0;
	} else if (y <= 1.3e-237) {
		tmp = x * 0.5;
	} else if (y <= 4e+52) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-2.0d0)) then
        tmp = 1.0d0
    else if (y <= (-4.4d-67)) then
        tmp = y * (-0.5d0)
    else if (y <= (-2.85d-241)) then
        tmp = -1.0d0
    else if (y <= 1.3d-237) then
        tmp = x * 0.5d0
    else if (y <= 4d+52) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -2.0) {
		tmp = 1.0;
	} else if (y <= -4.4e-67) {
		tmp = y * -0.5;
	} else if (y <= -2.85e-241) {
		tmp = -1.0;
	} else if (y <= 1.3e-237) {
		tmp = x * 0.5;
	} else if (y <= 4e+52) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -2.0:
		tmp = 1.0
	elif y <= -4.4e-67:
		tmp = y * -0.5
	elif y <= -2.85e-241:
		tmp = -1.0
	elif y <= 1.3e-237:
		tmp = x * 0.5
	elif y <= 4e+52:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -2.0)
		tmp = 1.0;
	elseif (y <= -4.4e-67)
		tmp = Float64(y * -0.5);
	elseif (y <= -2.85e-241)
		tmp = -1.0;
	elseif (y <= 1.3e-237)
		tmp = Float64(x * 0.5);
	elseif (y <= 4e+52)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -2.0)
		tmp = 1.0;
	elseif (y <= -4.4e-67)
		tmp = y * -0.5;
	elseif (y <= -2.85e-241)
		tmp = -1.0;
	elseif (y <= 1.3e-237)
		tmp = x * 0.5;
	elseif (y <= 4e+52)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -2.0], 1.0, If[LessEqual[y, -4.4e-67], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -2.85e-241], -1.0, If[LessEqual[y, 1.3e-237], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 4e+52], -1.0, 1.0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -4.4 \cdot 10^{-67}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -2.85 \cdot 10^{-241}:\\
\;\;\;\;-1\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{-237}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;y \leq 4 \cdot 10^{+52}:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2 or 4e52 < y

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 80.9%

      \[\leadsto \color{blue}{1} \]

    if -2 < y < -4.4000000000000002e-67

    1. Initial program 99.8%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.8%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.8%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.8%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.8%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.8%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.8%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.8%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.8%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.8%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.8%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 66.0%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]
    5. Taylor expanded in y around 0 57.2%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative57.2%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    7. Simplified57.2%

      \[\leadsto \color{blue}{y \cdot -0.5} \]

    if -4.4000000000000002e-67 < y < -2.8499999999999999e-241 or 1.3000000000000001e-237 < y < 4e52

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around inf 62.9%

      \[\leadsto \color{blue}{-1} \]

    if -2.8499999999999999e-241 < y < 1.3000000000000001e-237

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 97.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/97.3%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg97.3%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg97.3%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified97.3%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]
    7. Taylor expanded in x around 0 78.5%

      \[\leadsto \color{blue}{0.5 \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative78.5%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    9. Simplified78.5%

      \[\leadsto \color{blue}{x \cdot 0.5} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification72.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -4.4 \cdot 10^{-67}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -2.85 \cdot 10^{-241}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-237}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+52}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 7: 60.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -7.8 \cdot 10^{-67}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-240}:\\ \;\;\;\;-1 + \frac{y}{x}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-237}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+52}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -2.0)
   1.0
   (if (<= y -7.8e-67)
     (* y -0.5)
     (if (<= y -1.02e-240)
       (+ -1.0 (/ y x))
       (if (<= y 1.5e-237) (* x 0.5) (if (<= y 4.6e+52) -1.0 1.0))))))
double code(double x, double y) {
	double tmp;
	if (y <= -2.0) {
		tmp = 1.0;
	} else if (y <= -7.8e-67) {
		tmp = y * -0.5;
	} else if (y <= -1.02e-240) {
		tmp = -1.0 + (y / x);
	} else if (y <= 1.5e-237) {
		tmp = x * 0.5;
	} else if (y <= 4.6e+52) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-2.0d0)) then
        tmp = 1.0d0
    else if (y <= (-7.8d-67)) then
        tmp = y * (-0.5d0)
    else if (y <= (-1.02d-240)) then
        tmp = (-1.0d0) + (y / x)
    else if (y <= 1.5d-237) then
        tmp = x * 0.5d0
    else if (y <= 4.6d+52) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -2.0) {
		tmp = 1.0;
	} else if (y <= -7.8e-67) {
		tmp = y * -0.5;
	} else if (y <= -1.02e-240) {
		tmp = -1.0 + (y / x);
	} else if (y <= 1.5e-237) {
		tmp = x * 0.5;
	} else if (y <= 4.6e+52) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -2.0:
		tmp = 1.0
	elif y <= -7.8e-67:
		tmp = y * -0.5
	elif y <= -1.02e-240:
		tmp = -1.0 + (y / x)
	elif y <= 1.5e-237:
		tmp = x * 0.5
	elif y <= 4.6e+52:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -2.0)
		tmp = 1.0;
	elseif (y <= -7.8e-67)
		tmp = Float64(y * -0.5);
	elseif (y <= -1.02e-240)
		tmp = Float64(-1.0 + Float64(y / x));
	elseif (y <= 1.5e-237)
		tmp = Float64(x * 0.5);
	elseif (y <= 4.6e+52)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -2.0)
		tmp = 1.0;
	elseif (y <= -7.8e-67)
		tmp = y * -0.5;
	elseif (y <= -1.02e-240)
		tmp = -1.0 + (y / x);
	elseif (y <= 1.5e-237)
		tmp = x * 0.5;
	elseif (y <= 4.6e+52)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -2.0], 1.0, If[LessEqual[y, -7.8e-67], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.02e-240], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e-237], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 4.6e+52], -1.0, 1.0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -7.8 \cdot 10^{-67}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq -1.02 \cdot 10^{-240}:\\
\;\;\;\;-1 + \frac{y}{x}\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{-237}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;y \leq 4.6 \cdot 10^{+52}:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -2 or 4.6e52 < y

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 80.9%

      \[\leadsto \color{blue}{1} \]

    if -2 < y < -7.7999999999999997e-67

    1. Initial program 99.8%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg99.8%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg99.8%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in99.8%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-199.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative99.8%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*99.8%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative99.8%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg99.8%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval99.8%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-199.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity99.8%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative99.8%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+99.8%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval99.8%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around 0 66.0%

      \[\leadsto \color{blue}{\frac{y}{y - 2}} \]
    5. Taylor expanded in y around 0 57.2%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative57.2%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    7. Simplified57.2%

      \[\leadsto \color{blue}{y \cdot -0.5} \]

    if -7.7999999999999997e-67 < y < -1.02e-240

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Step-by-step derivation
      1. clear-num99.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + -2\right)}{y - x}}} \]
      2. associate-/r/99.8%

        \[\leadsto \color{blue}{\frac{1}{x + \left(y + -2\right)} \cdot \left(y - x\right)} \]
      3. +-commutative99.8%

        \[\leadsto \frac{1}{\color{blue}{\left(y + -2\right) + x}} \cdot \left(y - x\right) \]
      4. associate-+l+99.8%

        \[\leadsto \frac{1}{\color{blue}{y + \left(-2 + x\right)}} \cdot \left(y - x\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{1}{y + \left(-2 + x\right)} \cdot \left(y - x\right)} \]
    6. Taylor expanded in x around inf 65.1%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \left(y - x\right) \]
    7. Taylor expanded in x around 0 65.3%

      \[\leadsto \color{blue}{\frac{y}{x} - 1} \]

    if -1.02e-240 < y < 1.50000000000000012e-237

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 97.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/97.3%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg97.3%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg97.3%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified97.3%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]
    7. Taylor expanded in x around 0 78.5%

      \[\leadsto \color{blue}{0.5 \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative78.5%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    9. Simplified78.5%

      \[\leadsto \color{blue}{x \cdot 0.5} \]

    if 1.50000000000000012e-237 < y < 4.6e52

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around inf 61.8%

      \[\leadsto \color{blue}{-1} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification72.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -7.8 \cdot 10^{-67}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-240}:\\ \;\;\;\;-1 + \frac{y}{x}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-237}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+52}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 8: 61.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{+35}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-238}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-236}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+53}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -6.5e+35)
   1.0
   (if (<= y -2.8e-238)
     -1.0
     (if (<= y 6e-236) (* x 0.5) (if (<= y 5.2e+53) -1.0 1.0)))))
double code(double x, double y) {
	double tmp;
	if (y <= -6.5e+35) {
		tmp = 1.0;
	} else if (y <= -2.8e-238) {
		tmp = -1.0;
	} else if (y <= 6e-236) {
		tmp = x * 0.5;
	} else if (y <= 5.2e+53) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-6.5d+35)) then
        tmp = 1.0d0
    else if (y <= (-2.8d-238)) then
        tmp = -1.0d0
    else if (y <= 6d-236) then
        tmp = x * 0.5d0
    else if (y <= 5.2d+53) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -6.5e+35) {
		tmp = 1.0;
	} else if (y <= -2.8e-238) {
		tmp = -1.0;
	} else if (y <= 6e-236) {
		tmp = x * 0.5;
	} else if (y <= 5.2e+53) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -6.5e+35:
		tmp = 1.0
	elif y <= -2.8e-238:
		tmp = -1.0
	elif y <= 6e-236:
		tmp = x * 0.5
	elif y <= 5.2e+53:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -6.5e+35)
		tmp = 1.0;
	elseif (y <= -2.8e-238)
		tmp = -1.0;
	elseif (y <= 6e-236)
		tmp = Float64(x * 0.5);
	elseif (y <= 5.2e+53)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -6.5e+35)
		tmp = 1.0;
	elseif (y <= -2.8e-238)
		tmp = -1.0;
	elseif (y <= 6e-236)
		tmp = x * 0.5;
	elseif (y <= 5.2e+53)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -6.5e+35], 1.0, If[LessEqual[y, -2.8e-238], -1.0, If[LessEqual[y, 6e-236], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 5.2e+53], -1.0, 1.0]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+35}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -2.8 \cdot 10^{-238}:\\
\;\;\;\;-1\\

\mathbf{elif}\;y \leq 6 \cdot 10^{-236}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;y \leq 5.2 \cdot 10^{+53}:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.5000000000000003e35 or 5.19999999999999996e53 < y

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 82.8%

      \[\leadsto \color{blue}{1} \]

    if -6.5000000000000003e35 < y < -2.80000000000000004e-238 or 6.00000000000000027e-236 < y < 5.19999999999999996e53

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around inf 56.9%

      \[\leadsto \color{blue}{-1} \]

    if -2.80000000000000004e-238 < y < 6.00000000000000027e-236

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around 0 97.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    5. Step-by-step derivation
      1. associate-*r/97.3%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{x - 2}} \]
      2. mul-1-neg97.3%

        \[\leadsto \frac{\color{blue}{-x}}{x - 2} \]
      3. sub-neg97.3%

        \[\leadsto \frac{-x}{\color{blue}{x + \left(-2\right)}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{-x}{x + \color{blue}{-2}} \]
    6. Simplified97.3%

      \[\leadsto \color{blue}{\frac{-x}{x + -2}} \]
    7. Taylor expanded in x around 0 78.5%

      \[\leadsto \color{blue}{0.5 \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative78.5%

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    9. Simplified78.5%

      \[\leadsto \color{blue}{x \cdot 0.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification70.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{+35}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-238}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-236}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+53}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 9: 62.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{+38}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+52}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -6e+38) 1.0 (if (<= y 2.2e+52) -1.0 1.0)))
double code(double x, double y) {
	double tmp;
	if (y <= -6e+38) {
		tmp = 1.0;
	} else if (y <= 2.2e+52) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-6d+38)) then
        tmp = 1.0d0
    else if (y <= 2.2d+52) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -6e+38) {
		tmp = 1.0;
	} else if (y <= 2.2e+52) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -6e+38:
		tmp = 1.0
	elif y <= 2.2e+52:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -6e+38)
		tmp = 1.0;
	elseif (y <= 2.2e+52)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -6e+38)
		tmp = 1.0;
	elseif (y <= 2.2e+52)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -6e+38], 1.0, If[LessEqual[y, 2.2e+52], -1.0, 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+38}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{+52}:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.0000000000000002e38 or 2.2e52 < y

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in y around inf 82.8%

      \[\leadsto \color{blue}{1} \]

    if -6.0000000000000002e38 < y < 2.2e52

    1. Initial program 100.0%

      \[\frac{x - y}{2 - \left(x + y\right)} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
      2. remove-double-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
      3. unsub-neg100.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
      4. distribute-neg-in100.0%

        \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      5. neg-mul-1100.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
      6. *-commutative100.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
      7. associate-/l*100.0%

        \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
      8. +-commutative100.0%

        \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
      9. sub-neg100.0%

        \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
      10. div-sub100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
      11. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
      12. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
      13. sub-neg100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
      14. distribute-frac-neg100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
      15. neg-mul-1100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
      16. *-commutative100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
      17. associate-/l*100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
      18. metadata-eval100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
      19. /-rgt-identity100.0%

        \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
      20. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
      21. +-commutative100.0%

        \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
      22. associate-+r+100.0%

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      23. metadata-eval100.0%

        \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
    4. Taylor expanded in x around inf 50.1%

      \[\leadsto \color{blue}{-1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{+38}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+52}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 10: 38.6% accurate, 9.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
	return -1.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -1.0d0
end function
public static double code(double x, double y) {
	return -1.0;
}
def code(x, y):
	return -1.0
function code(x, y)
	return -1.0
end
function tmp = code(x, y)
	tmp = -1.0;
end
code[x_, y_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{x - y}{2 - \left(x + y\right)} \]
  2. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto \frac{x - y}{2 - \color{blue}{\left(y + x\right)}} \]
    2. remove-double-neg100.0%

      \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right)} - y}{2 - \left(y + x\right)} \]
    3. unsub-neg100.0%

      \[\leadsto \frac{\color{blue}{\left(-\left(-x\right)\right) + \left(-y\right)}}{2 - \left(y + x\right)} \]
    4. distribute-neg-in100.0%

      \[\leadsto \frac{\color{blue}{-\left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
    5. neg-mul-1100.0%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-x\right) + y\right)}}{2 - \left(y + x\right)} \]
    6. *-commutative100.0%

      \[\leadsto \frac{\color{blue}{\left(\left(-x\right) + y\right) \cdot -1}}{2 - \left(y + x\right)} \]
    7. associate-/l*100.0%

      \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{\frac{2 - \left(y + x\right)}{-1}}} \]
    8. +-commutative100.0%

      \[\leadsto \frac{\color{blue}{y + \left(-x\right)}}{\frac{2 - \left(y + x\right)}{-1}} \]
    9. sub-neg100.0%

      \[\leadsto \frac{\color{blue}{y - x}}{\frac{2 - \left(y + x\right)}{-1}} \]
    10. div-sub100.0%

      \[\leadsto \frac{y - x}{\color{blue}{\frac{2}{-1} - \frac{y + x}{-1}}} \]
    11. metadata-eval100.0%

      \[\leadsto \frac{y - x}{\color{blue}{-2} - \frac{y + x}{-1}} \]
    12. metadata-eval100.0%

      \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right)} - \frac{y + x}{-1}} \]
    13. sub-neg100.0%

      \[\leadsto \frac{y - x}{\color{blue}{\left(-2\right) + \left(-\frac{y + x}{-1}\right)}} \]
    14. distribute-frac-neg100.0%

      \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{-\left(y + x\right)}{-1}}} \]
    15. neg-mul-1100.0%

      \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{-1 \cdot \left(y + x\right)}}{-1}} \]
    16. *-commutative100.0%

      \[\leadsto \frac{y - x}{\left(-2\right) + \frac{\color{blue}{\left(y + x\right) \cdot -1}}{-1}} \]
    17. associate-/l*100.0%

      \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\frac{y + x}{\frac{-1}{-1}}}} \]
    18. metadata-eval100.0%

      \[\leadsto \frac{y - x}{\left(-2\right) + \frac{y + x}{\color{blue}{1}}} \]
    19. /-rgt-identity100.0%

      \[\leadsto \frac{y - x}{\left(-2\right) + \color{blue}{\left(y + x\right)}} \]
    20. +-commutative100.0%

      \[\leadsto \frac{y - x}{\color{blue}{\left(y + x\right) + \left(-2\right)}} \]
    21. +-commutative100.0%

      \[\leadsto \frac{y - x}{\color{blue}{\left(x + y\right)} + \left(-2\right)} \]
    22. associate-+r+100.0%

      \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
    23. metadata-eval100.0%

      \[\leadsto \frac{y - x}{x + \left(y + \color{blue}{-2}\right)} \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{\frac{y - x}{x + \left(y + -2\right)}} \]
  4. Taylor expanded in x around inf 34.8%

    \[\leadsto \color{blue}{-1} \]
  5. Final simplification34.8%

    \[\leadsto -1 \]

Developer target: 100.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 - \left(x + y\right)\\ \frac{x}{t_0} - \frac{y}{t_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- 2.0 (+ x y)))) (- (/ x t_0) (/ y t_0))))
double code(double x, double y) {
	double t_0 = 2.0 - (x + y);
	return (x / t_0) - (y / t_0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = 2.0d0 - (x + y)
    code = (x / t_0) - (y / t_0)
end function
public static double code(double x, double y) {
	double t_0 = 2.0 - (x + y);
	return (x / t_0) - (y / t_0);
}
def code(x, y):
	t_0 = 2.0 - (x + y)
	return (x / t_0) - (y / t_0)
function code(x, y)
	t_0 = Float64(2.0 - Float64(x + y))
	return Float64(Float64(x / t_0) - Float64(y / t_0))
end
function tmp = code(x, y)
	t_0 = 2.0 - (x + y);
	tmp = (x / t_0) - (y / t_0);
end
code[x_, y_] := Block[{t$95$0 = N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / t$95$0), $MachinePrecision] - N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t_0} - \frac{y}{t_0}
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023311 
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
  :precision binary64

  :herbie-target
  (- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))

  (/ (- x y) (- 2.0 (+ x y))))