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

Percentage Accurate: 100.0% → 100.0%
Time: 6.9s
Alternatives: 11
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 11 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 99.9%

    \[\frac{x - y}{2 - \left(x + y\right)} \]
  2. Add Preprocessing
  3. Final simplification99.9%

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

Alternative 2: 59.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+64}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-68}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-136}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-63}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 14:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -6.5e+147)
   -1.0
   (if (<= x -6e+129)
     1.0
     (if (<= x -6.2e+64)
       -1.0
       (if (<= x -1.75e-68)
         1.0
         (if (<= x -1.3e-136)
           (* x 0.5)
           (if (<= x 1.65e-63) 1.0 (if (<= x 14.0) (* x 0.5) -1.0))))))))
double code(double x, double y) {
	double tmp;
	if (x <= -6.5e+147) {
		tmp = -1.0;
	} else if (x <= -6e+129) {
		tmp = 1.0;
	} else if (x <= -6.2e+64) {
		tmp = -1.0;
	} else if (x <= -1.75e-68) {
		tmp = 1.0;
	} else if (x <= -1.3e-136) {
		tmp = x * 0.5;
	} else if (x <= 1.65e-63) {
		tmp = 1.0;
	} else if (x <= 14.0) {
		tmp = x * 0.5;
	} 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 (x <= (-6.5d+147)) then
        tmp = -1.0d0
    else if (x <= (-6d+129)) then
        tmp = 1.0d0
    else if (x <= (-6.2d+64)) then
        tmp = -1.0d0
    else if (x <= (-1.75d-68)) then
        tmp = 1.0d0
    else if (x <= (-1.3d-136)) then
        tmp = x * 0.5d0
    else if (x <= 1.65d-63) then
        tmp = 1.0d0
    else if (x <= 14.0d0) then
        tmp = x * 0.5d0
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -6.5e+147) {
		tmp = -1.0;
	} else if (x <= -6e+129) {
		tmp = 1.0;
	} else if (x <= -6.2e+64) {
		tmp = -1.0;
	} else if (x <= -1.75e-68) {
		tmp = 1.0;
	} else if (x <= -1.3e-136) {
		tmp = x * 0.5;
	} else if (x <= 1.65e-63) {
		tmp = 1.0;
	} else if (x <= 14.0) {
		tmp = x * 0.5;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -6.5e+147:
		tmp = -1.0
	elif x <= -6e+129:
		tmp = 1.0
	elif x <= -6.2e+64:
		tmp = -1.0
	elif x <= -1.75e-68:
		tmp = 1.0
	elif x <= -1.3e-136:
		tmp = x * 0.5
	elif x <= 1.65e-63:
		tmp = 1.0
	elif x <= 14.0:
		tmp = x * 0.5
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -6.5e+147)
		tmp = -1.0;
	elseif (x <= -6e+129)
		tmp = 1.0;
	elseif (x <= -6.2e+64)
		tmp = -1.0;
	elseif (x <= -1.75e-68)
		tmp = 1.0;
	elseif (x <= -1.3e-136)
		tmp = Float64(x * 0.5);
	elseif (x <= 1.65e-63)
		tmp = 1.0;
	elseif (x <= 14.0)
		tmp = Float64(x * 0.5);
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.5e+147)
		tmp = -1.0;
	elseif (x <= -6e+129)
		tmp = 1.0;
	elseif (x <= -6.2e+64)
		tmp = -1.0;
	elseif (x <= -1.75e-68)
		tmp = 1.0;
	elseif (x <= -1.3e-136)
		tmp = x * 0.5;
	elseif (x <= 1.65e-63)
		tmp = 1.0;
	elseif (x <= 14.0)
		tmp = x * 0.5;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -6.5e+147], -1.0, If[LessEqual[x, -6e+129], 1.0, If[LessEqual[x, -6.2e+64], -1.0, If[LessEqual[x, -1.75e-68], 1.0, If[LessEqual[x, -1.3e-136], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 1.65e-63], 1.0, If[LessEqual[x, 14.0], N[(x * 0.5), $MachinePrecision], -1.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq -6.2 \cdot 10^{+64}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq -1.75 \cdot 10^{-68}:\\
\;\;\;\;1\\

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

\mathbf{elif}\;x \leq 1.65 \cdot 10^{-63}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 14:\\
\;\;\;\;x \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.5e147 or -6.0000000000000006e129 < x < -6.1999999999999998e64 or 14 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around inf 81.4%

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

    if -6.5e147 < x < -6.0000000000000006e129 or -6.1999999999999998e64 < x < -1.75000000000000006e-68 or -1.29999999999999998e-136 < x < 1.64999999999999997e-63

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 58.4%

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

    if -1.75000000000000006e-68 < x < -1.29999999999999998e-136 or 1.64999999999999997e-63 < x < 14

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around 0 70.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    6. Step-by-step derivation
      1. mul-1-neg70.4%

        \[\leadsto \color{blue}{-\frac{x}{x - 2}} \]
      2. distribute-neg-frac270.4%

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

        \[\leadsto \frac{x}{\color{blue}{0 - \left(x - 2\right)}} \]
      4. associate-+l-70.4%

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

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

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

        \[\leadsto \frac{x}{\color{blue}{2 - x}} \]
    7. Simplified70.4%

      \[\leadsto \color{blue}{\frac{x}{2 - x}} \]
    8. Taylor expanded in x around 0 64.1%

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

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    10. Simplified64.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+64}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-68}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-136}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-63}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 14:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 85.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -1 - \frac{y \cdot -2}{x}\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+148}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{+85}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{y - 2} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- -1.0 (/ (* y -2.0) x))))
   (if (<= x -1.25e+148)
     t_0
     (if (<= x -6e+129)
       (+ 1.0 (/ (* x -2.0) y))
       (if (<= x -2.8e+85)
         t_0
         (if (<= x 5e-6) (* (/ 1.0 (- y 2.0)) (- y x)) (/ x (- 2.0 x))))))))
double code(double x, double y) {
	double t_0 = -1.0 - ((y * -2.0) / x);
	double tmp;
	if (x <= -1.25e+148) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -2.8e+85) {
		tmp = t_0;
	} else if (x <= 5e-6) {
		tmp = (1.0 / (y - 2.0)) * (y - x);
	} else {
		tmp = x / (2.0 - x);
	}
	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 = (-1.0d0) - ((y * (-2.0d0)) / x)
    if (x <= (-1.25d+148)) then
        tmp = t_0
    else if (x <= (-6d+129)) then
        tmp = 1.0d0 + ((x * (-2.0d0)) / y)
    else if (x <= (-2.8d+85)) then
        tmp = t_0
    else if (x <= 5d-6) then
        tmp = (1.0d0 / (y - 2.0d0)) * (y - x)
    else
        tmp = x / (2.0d0 - x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = -1.0 - ((y * -2.0) / x);
	double tmp;
	if (x <= -1.25e+148) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -2.8e+85) {
		tmp = t_0;
	} else if (x <= 5e-6) {
		tmp = (1.0 / (y - 2.0)) * (y - x);
	} else {
		tmp = x / (2.0 - x);
	}
	return tmp;
}
def code(x, y):
	t_0 = -1.0 - ((y * -2.0) / x)
	tmp = 0
	if x <= -1.25e+148:
		tmp = t_0
	elif x <= -6e+129:
		tmp = 1.0 + ((x * -2.0) / y)
	elif x <= -2.8e+85:
		tmp = t_0
	elif x <= 5e-6:
		tmp = (1.0 / (y - 2.0)) * (y - x)
	else:
		tmp = x / (2.0 - x)
	return tmp
function code(x, y)
	t_0 = Float64(-1.0 - Float64(Float64(y * -2.0) / x))
	tmp = 0.0
	if (x <= -1.25e+148)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = Float64(1.0 + Float64(Float64(x * -2.0) / y));
	elseif (x <= -2.8e+85)
		tmp = t_0;
	elseif (x <= 5e-6)
		tmp = Float64(Float64(1.0 / Float64(y - 2.0)) * Float64(y - x));
	else
		tmp = Float64(x / Float64(2.0 - x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = -1.0 - ((y * -2.0) / x);
	tmp = 0.0;
	if (x <= -1.25e+148)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = 1.0 + ((x * -2.0) / y);
	elseif (x <= -2.8e+85)
		tmp = t_0;
	elseif (x <= 5e-6)
		tmp = (1.0 / (y - 2.0)) * (y - x);
	else
		tmp = x / (2.0 - x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 - N[(N[(y * -2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.25e+148], t$95$0, If[LessEqual[x, -6e+129], N[(1.0 + N[(N[(x * -2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.8e+85], t$95$0, If[LessEqual[x, 5e-6], N[(N[(1.0 / N[(y - 2.0), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -1 - \frac{y \cdot -2}{x}\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+148}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -2.8 \cdot 10^{+85}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{y - 2} \cdot \left(y - x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.25000000000000006e148 or -6.0000000000000006e129 < x < -2.7999999999999999e85

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around inf 86.0%

      \[\leadsto \color{blue}{\frac{y}{x} - \left(1 + -1 \cdot \frac{y - 2}{x}\right)} \]
    6. Step-by-step derivation
      1. sub-neg86.0%

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

        \[\leadsto \color{blue}{\left(-\left(1 + -1 \cdot \frac{y - 2}{x}\right)\right) + \frac{y}{x}} \]
      3. distribute-neg-in86.0%

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

        \[\leadsto \left(\color{blue}{-1} + \left(--1 \cdot \frac{y - 2}{x}\right)\right) + \frac{y}{x} \]
      5. mul-1-neg86.0%

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

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

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

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

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

        \[\leadsto -1 + \left(\color{blue}{\left(0 - -1 \cdot \frac{y - 2}{x}\right)} + \frac{y}{x}\right) \]
      11. associate--r-86.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 - \frac{2 + y \cdot -2}{x}} \]
    8. Taylor expanded in y around inf 86.0%

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

        \[\leadsto -1 - \color{blue}{\frac{-2 \cdot y}{x}} \]
      2. *-commutative86.0%

        \[\leadsto -1 - \frac{\color{blue}{y \cdot -2}}{x} \]
    10. Simplified86.0%

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

    if -1.25000000000000006e148 < x < -6.0000000000000006e129

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \frac{2 + \color{blue}{\left(\left(-x\right) + \left(-x\right)\right)}}{y} \]
      14. mul-1-neg86.7%

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

        \[\leadsto 1 + \frac{2 + \left(-1 \cdot x + \color{blue}{-1 \cdot x}\right)}{y} \]
      16. distribute-rgt-out86.7%

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

        \[\leadsto 1 + \frac{2 + x \cdot \color{blue}{-2}}{y} \]
    7. Simplified86.7%

      \[\leadsto \color{blue}{1 + \frac{2 + x \cdot -2}{y}} \]
    8. Taylor expanded in x around inf 86.7%

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

        \[\leadsto 1 + \color{blue}{\frac{-2 \cdot x}{y}} \]
      2. *-commutative86.7%

        \[\leadsto 1 + \frac{\color{blue}{x \cdot -2}}{y} \]
    10. Simplified86.7%

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

    if -2.7999999999999999e85 < x < 5.00000000000000041e-6

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. 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) \]
    6. Applied egg-rr99.8%

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

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

    if 5.00000000000000041e-6 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around 0 83.1%

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

        \[\leadsto \color{blue}{-\frac{x}{x - 2}} \]
      2. distribute-neg-frac283.1%

        \[\leadsto \color{blue}{\frac{x}{-\left(x - 2\right)}} \]
      3. neg-sub083.1%

        \[\leadsto \frac{x}{\color{blue}{0 - \left(x - 2\right)}} \]
      4. associate-+l-83.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{2 - x}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification90.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{+148}:\\ \;\;\;\;-1 - \frac{y \cdot -2}{x}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{+85}:\\ \;\;\;\;-1 - \frac{y \cdot -2}{x}\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{y - 2} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -1 - \frac{y \cdot -2}{x}\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 260000:\\ \;\;\;\;\frac{1}{y - 2} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;-1 - \frac{2 + y \cdot -2}{x}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- -1.0 (/ (* y -2.0) x))))
   (if (<= x -6.5e+147)
     t_0
     (if (<= x -6e+129)
       (+ 1.0 (/ (* x -2.0) y))
       (if (<= x -2.7e+85)
         t_0
         (if (<= x 260000.0)
           (* (/ 1.0 (- y 2.0)) (- y x))
           (- -1.0 (/ (+ 2.0 (* y -2.0)) x))))))))
double code(double x, double y) {
	double t_0 = -1.0 - ((y * -2.0) / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -2.7e+85) {
		tmp = t_0;
	} else if (x <= 260000.0) {
		tmp = (1.0 / (y - 2.0)) * (y - x);
	} else {
		tmp = -1.0 - ((2.0 + (y * -2.0)) / x);
	}
	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 = (-1.0d0) - ((y * (-2.0d0)) / x)
    if (x <= (-6.5d+147)) then
        tmp = t_0
    else if (x <= (-6d+129)) then
        tmp = 1.0d0 + ((x * (-2.0d0)) / y)
    else if (x <= (-2.7d+85)) then
        tmp = t_0
    else if (x <= 260000.0d0) then
        tmp = (1.0d0 / (y - 2.0d0)) * (y - x)
    else
        tmp = (-1.0d0) - ((2.0d0 + (y * (-2.0d0))) / x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = -1.0 - ((y * -2.0) / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -2.7e+85) {
		tmp = t_0;
	} else if (x <= 260000.0) {
		tmp = (1.0 / (y - 2.0)) * (y - x);
	} else {
		tmp = -1.0 - ((2.0 + (y * -2.0)) / x);
	}
	return tmp;
}
def code(x, y):
	t_0 = -1.0 - ((y * -2.0) / x)
	tmp = 0
	if x <= -6.5e+147:
		tmp = t_0
	elif x <= -6e+129:
		tmp = 1.0 + ((x * -2.0) / y)
	elif x <= -2.7e+85:
		tmp = t_0
	elif x <= 260000.0:
		tmp = (1.0 / (y - 2.0)) * (y - x)
	else:
		tmp = -1.0 - ((2.0 + (y * -2.0)) / x)
	return tmp
function code(x, y)
	t_0 = Float64(-1.0 - Float64(Float64(y * -2.0) / x))
	tmp = 0.0
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = Float64(1.0 + Float64(Float64(x * -2.0) / y));
	elseif (x <= -2.7e+85)
		tmp = t_0;
	elseif (x <= 260000.0)
		tmp = Float64(Float64(1.0 / Float64(y - 2.0)) * Float64(y - x));
	else
		tmp = Float64(-1.0 - Float64(Float64(2.0 + Float64(y * -2.0)) / x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = -1.0 - ((y * -2.0) / x);
	tmp = 0.0;
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = 1.0 + ((x * -2.0) / y);
	elseif (x <= -2.7e+85)
		tmp = t_0;
	elseif (x <= 260000.0)
		tmp = (1.0 / (y - 2.0)) * (y - x);
	else
		tmp = -1.0 - ((2.0 + (y * -2.0)) / x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 - N[(N[(y * -2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+147], t$95$0, If[LessEqual[x, -6e+129], N[(1.0 + N[(N[(x * -2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.7e+85], t$95$0, If[LessEqual[x, 260000.0], N[(N[(1.0 / N[(y - 2.0), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision], N[(-1.0 - N[(N[(2.0 + N[(y * -2.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -1 - \frac{y \cdot -2}{x}\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 260000:\\
\;\;\;\;\frac{1}{y - 2} \cdot \left(y - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.5e147 or -6.0000000000000006e129 < x < -2.69999999999999983e85

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around inf 86.0%

      \[\leadsto \color{blue}{\frac{y}{x} - \left(1 + -1 \cdot \frac{y - 2}{x}\right)} \]
    6. Step-by-step derivation
      1. sub-neg86.0%

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

        \[\leadsto \color{blue}{\left(-\left(1 + -1 \cdot \frac{y - 2}{x}\right)\right) + \frac{y}{x}} \]
      3. distribute-neg-in86.0%

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

        \[\leadsto \left(\color{blue}{-1} + \left(--1 \cdot \frac{y - 2}{x}\right)\right) + \frac{y}{x} \]
      5. mul-1-neg86.0%

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

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

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

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

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

        \[\leadsto -1 + \left(\color{blue}{\left(0 - -1 \cdot \frac{y - 2}{x}\right)} + \frac{y}{x}\right) \]
      11. associate--r-86.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 - \frac{2 + y \cdot -2}{x}} \]
    8. Taylor expanded in y around inf 86.0%

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

        \[\leadsto -1 - \color{blue}{\frac{-2 \cdot y}{x}} \]
      2. *-commutative86.0%

        \[\leadsto -1 - \frac{\color{blue}{y \cdot -2}}{x} \]
    10. Simplified86.0%

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

    if -6.5e147 < x < -6.0000000000000006e129

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \frac{2 + \color{blue}{\left(\left(-x\right) + \left(-x\right)\right)}}{y} \]
      14. mul-1-neg86.7%

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

        \[\leadsto 1 + \frac{2 + \left(-1 \cdot x + \color{blue}{-1 \cdot x}\right)}{y} \]
      16. distribute-rgt-out86.7%

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

        \[\leadsto 1 + \frac{2 + x \cdot \color{blue}{-2}}{y} \]
    7. Simplified86.7%

      \[\leadsto \color{blue}{1 + \frac{2 + x \cdot -2}{y}} \]
    8. Taylor expanded in x around inf 86.7%

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

        \[\leadsto 1 + \color{blue}{\frac{-2 \cdot x}{y}} \]
      2. *-commutative86.7%

        \[\leadsto 1 + \frac{\color{blue}{x \cdot -2}}{y} \]
    10. Simplified86.7%

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

    if -2.69999999999999983e85 < x < 2.6e5

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. 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) \]
    6. Applied egg-rr99.8%

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

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

    if 2.6e5 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around inf 84.9%

      \[\leadsto \color{blue}{\frac{y}{x} - \left(1 + -1 \cdot \frac{y - 2}{x}\right)} \]
    6. Step-by-step derivation
      1. sub-neg84.9%

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

        \[\leadsto \color{blue}{\left(-\left(1 + -1 \cdot \frac{y - 2}{x}\right)\right) + \frac{y}{x}} \]
      3. distribute-neg-in84.9%

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

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

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

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

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

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

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

        \[\leadsto -1 + \left(\color{blue}{\left(0 - -1 \cdot \frac{y - 2}{x}\right)} + \frac{y}{x}\right) \]
      11. associate--r-84.9%

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

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

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

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

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

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

        \[\leadsto -1 + \left(0 - \left(\frac{\color{blue}{2} + -1 \cdot y}{x} - \frac{y}{x}\right)\right) \]
      18. div-sub84.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1 - \frac{y \cdot -2}{x}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\ \;\;\;\;-1 - \frac{y \cdot -2}{x}\\ \mathbf{elif}\;x \leq 260000:\\ \;\;\;\;\frac{1}{y - 2} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;-1 - \frac{2 + y \cdot -2}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{2 - x}\\ \mathbf{if}\;y \leq -2.8 \cdot 10^{+71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -3 \cdot 10^{-22}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-104}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+15}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ x (- 2.0 x))))
   (if (<= y -2.8e+71)
     1.0
     (if (<= y -3e-22)
       t_0
       (if (<= y -7e-104) (* y -0.5) (if (<= y 2.2e+15) t_0 1.0))))))
double code(double x, double y) {
	double t_0 = x / (2.0 - x);
	double tmp;
	if (y <= -2.8e+71) {
		tmp = 1.0;
	} else if (y <= -3e-22) {
		tmp = t_0;
	} else if (y <= -7e-104) {
		tmp = y * -0.5;
	} else if (y <= 2.2e+15) {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = x / (2.0d0 - x)
    if (y <= (-2.8d+71)) then
        tmp = 1.0d0
    else if (y <= (-3d-22)) then
        tmp = t_0
    else if (y <= (-7d-104)) then
        tmp = y * (-0.5d0)
    else if (y <= 2.2d+15) then
        tmp = t_0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x / (2.0 - x);
	double tmp;
	if (y <= -2.8e+71) {
		tmp = 1.0;
	} else if (y <= -3e-22) {
		tmp = t_0;
	} else if (y <= -7e-104) {
		tmp = y * -0.5;
	} else if (y <= 2.2e+15) {
		tmp = t_0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x / (2.0 - x)
	tmp = 0
	if y <= -2.8e+71:
		tmp = 1.0
	elif y <= -3e-22:
		tmp = t_0
	elif y <= -7e-104:
		tmp = y * -0.5
	elif y <= 2.2e+15:
		tmp = t_0
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	t_0 = Float64(x / Float64(2.0 - x))
	tmp = 0.0
	if (y <= -2.8e+71)
		tmp = 1.0;
	elseif (y <= -3e-22)
		tmp = t_0;
	elseif (y <= -7e-104)
		tmp = Float64(y * -0.5);
	elseif (y <= 2.2e+15)
		tmp = t_0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x / (2.0 - x);
	tmp = 0.0;
	if (y <= -2.8e+71)
		tmp = 1.0;
	elseif (y <= -3e-22)
		tmp = t_0;
	elseif (y <= -7e-104)
		tmp = y * -0.5;
	elseif (y <= 2.2e+15)
		tmp = t_0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.8e+71], 1.0, If[LessEqual[y, -3e-22], t$95$0, If[LessEqual[y, -7e-104], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 2.2e+15], t$95$0, 1.0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -3 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -7 \cdot 10^{-104}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.80000000000000002e71 or 2.2e15 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 75.5%

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

    if -2.80000000000000002e71 < y < -2.9999999999999999e-22 or -7.00000000000000057e-104 < y < 2.2e15

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around 0 73.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    6. Step-by-step derivation
      1. mul-1-neg73.7%

        \[\leadsto \color{blue}{-\frac{x}{x - 2}} \]
      2. distribute-neg-frac273.7%

        \[\leadsto \color{blue}{\frac{x}{-\left(x - 2\right)}} \]
      3. neg-sub073.7%

        \[\leadsto \frac{x}{\color{blue}{0 - \left(x - 2\right)}} \]
      4. associate-+l-73.7%

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

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

        \[\leadsto \frac{x}{\color{blue}{2 + \left(-x\right)}} \]
      7. unsub-neg73.7%

        \[\leadsto \frac{x}{\color{blue}{2 - x}} \]
    7. Simplified73.7%

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

    if -2.9999999999999999e-22 < y < -7.00000000000000057e-104

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around 0 70.5%

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

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative70.5%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    8. Simplified70.5%

      \[\leadsto \color{blue}{y \cdot -0.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -3 \cdot 10^{-22}:\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-104}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 72.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+128}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 1.96 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -6.5e+147)
   -1.0
   (if (<= x -5e+128)
     1.0
     (if (<= x -2.7e+85)
       -1.0
       (if (<= x 1.96e-63) (/ y (- y 2.0)) (/ x (- 2.0 x)))))))
double code(double x, double y) {
	double tmp;
	if (x <= -6.5e+147) {
		tmp = -1.0;
	} else if (x <= -5e+128) {
		tmp = 1.0;
	} else if (x <= -2.7e+85) {
		tmp = -1.0;
	} else if (x <= 1.96e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-6.5d+147)) then
        tmp = -1.0d0
    else if (x <= (-5d+128)) then
        tmp = 1.0d0
    else if (x <= (-2.7d+85)) then
        tmp = -1.0d0
    else if (x <= 1.96d-63) then
        tmp = y / (y - 2.0d0)
    else
        tmp = x / (2.0d0 - x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -6.5e+147) {
		tmp = -1.0;
	} else if (x <= -5e+128) {
		tmp = 1.0;
	} else if (x <= -2.7e+85) {
		tmp = -1.0;
	} else if (x <= 1.96e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -6.5e+147:
		tmp = -1.0
	elif x <= -5e+128:
		tmp = 1.0
	elif x <= -2.7e+85:
		tmp = -1.0
	elif x <= 1.96e-63:
		tmp = y / (y - 2.0)
	else:
		tmp = x / (2.0 - x)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -6.5e+147)
		tmp = -1.0;
	elseif (x <= -5e+128)
		tmp = 1.0;
	elseif (x <= -2.7e+85)
		tmp = -1.0;
	elseif (x <= 1.96e-63)
		tmp = Float64(y / Float64(y - 2.0));
	else
		tmp = Float64(x / Float64(2.0 - x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.5e+147)
		tmp = -1.0;
	elseif (x <= -5e+128)
		tmp = 1.0;
	elseif (x <= -2.7e+85)
		tmp = -1.0;
	elseif (x <= 1.96e-63)
		tmp = y / (y - 2.0);
	else
		tmp = x / (2.0 - x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -6.5e+147], -1.0, If[LessEqual[x, -5e+128], 1.0, If[LessEqual[x, -2.7e+85], -1.0, If[LessEqual[x, 1.96e-63], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq -5 \cdot 10^{+128}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq 1.96 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{y - 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.5e147 or -5e128 < x < -2.69999999999999983e85

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around inf 84.5%

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

    if -6.5e147 < x < -5e128

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 80.1%

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

    if -2.69999999999999983e85 < x < 1.9600000000000001e-63

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around 0 79.3%

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

    if 1.9600000000000001e-63 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around 0 82.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    6. Step-by-step derivation
      1. mul-1-neg82.6%

        \[\leadsto \color{blue}{-\frac{x}{x - 2}} \]
      2. distribute-neg-frac282.6%

        \[\leadsto \color{blue}{\frac{x}{-\left(x - 2\right)}} \]
      3. neg-sub082.6%

        \[\leadsto \frac{x}{\color{blue}{0 - \left(x - 2\right)}} \]
      4. associate-+l-82.6%

        \[\leadsto \frac{x}{\color{blue}{\left(0 - x\right) + 2}} \]
      5. neg-sub082.6%

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

        \[\leadsto \frac{x}{\color{blue}{2 + \left(-x\right)}} \]
      7. unsub-neg82.6%

        \[\leadsto \frac{x}{\color{blue}{2 - x}} \]
    7. Simplified82.6%

      \[\leadsto \color{blue}{\frac{x}{2 - x}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification80.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+128}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 1.96 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 72.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y - x\right) \cdot \frac{1}{x}\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+64}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.08 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (- y x) (/ 1.0 x))))
   (if (<= x -6.5e+147)
     t_0
     (if (<= x -6e+129)
       1.0
       (if (<= x -9e+64)
         t_0
         (if (<= x 1.08e-63) (/ y (- y 2.0)) (/ x (- 2.0 x))))))))
double code(double x, double y) {
	double t_0 = (y - x) * (1.0 / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0;
	} else if (x <= -9e+64) {
		tmp = t_0;
	} else if (x <= 1.08e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	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 - x) * (1.0d0 / x)
    if (x <= (-6.5d+147)) then
        tmp = t_0
    else if (x <= (-6d+129)) then
        tmp = 1.0d0
    else if (x <= (-9d+64)) then
        tmp = t_0
    else if (x <= 1.08d-63) then
        tmp = y / (y - 2.0d0)
    else
        tmp = x / (2.0d0 - x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (y - x) * (1.0 / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0;
	} else if (x <= -9e+64) {
		tmp = t_0;
	} else if (x <= 1.08e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	return tmp;
}
def code(x, y):
	t_0 = (y - x) * (1.0 / x)
	tmp = 0
	if x <= -6.5e+147:
		tmp = t_0
	elif x <= -6e+129:
		tmp = 1.0
	elif x <= -9e+64:
		tmp = t_0
	elif x <= 1.08e-63:
		tmp = y / (y - 2.0)
	else:
		tmp = x / (2.0 - x)
	return tmp
function code(x, y)
	t_0 = Float64(Float64(y - x) * Float64(1.0 / x))
	tmp = 0.0
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = 1.0;
	elseif (x <= -9e+64)
		tmp = t_0;
	elseif (x <= 1.08e-63)
		tmp = Float64(y / Float64(y - 2.0));
	else
		tmp = Float64(x / Float64(2.0 - x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (y - x) * (1.0 / x);
	tmp = 0.0;
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = 1.0;
	elseif (x <= -9e+64)
		tmp = t_0;
	elseif (x <= 1.08e-63)
		tmp = y / (y - 2.0);
	else
		tmp = x / (2.0 - x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+147], t$95$0, If[LessEqual[x, -6e+129], 1.0, If[LessEqual[x, -9e+64], t$95$0, If[LessEqual[x, 1.08e-63], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y - x\right) \cdot \frac{1}{x}\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq -9 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.08 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{y - 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.5e147 or -6.0000000000000006e129 < x < -8.99999999999999946e64

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. 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.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) \]
    6. Applied egg-rr99.7%

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

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

    if -6.5e147 < x < -6.0000000000000006e129

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 80.1%

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

    if -8.99999999999999946e64 < x < 1.07999999999999994e-63

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around 0 80.4%

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

    if 1.07999999999999994e-63 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around 0 82.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    6. Step-by-step derivation
      1. mul-1-neg82.6%

        \[\leadsto \color{blue}{-\frac{x}{x - 2}} \]
      2. distribute-neg-frac282.6%

        \[\leadsto \color{blue}{\frac{x}{-\left(x - 2\right)}} \]
      3. neg-sub082.6%

        \[\leadsto \frac{x}{\color{blue}{0 - \left(x - 2\right)}} \]
      4. associate-+l-82.6%

        \[\leadsto \frac{x}{\color{blue}{\left(0 - x\right) + 2}} \]
      5. neg-sub082.6%

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

        \[\leadsto \frac{x}{\color{blue}{2 + \left(-x\right)}} \]
      7. unsub-neg82.6%

        \[\leadsto \frac{x}{\color{blue}{2 - x}} \]
    7. Simplified82.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;\left(y - x\right) \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+64}:\\ \;\;\;\;\left(y - x\right) \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq 1.08 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 73.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y - x\right) \cdot \frac{1}{x}\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+64}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (- y x) (/ 1.0 x))))
   (if (<= x -6.5e+147)
     t_0
     (if (<= x -6e+129)
       (+ 1.0 (/ (* x -2.0) y))
       (if (<= x -9e+64)
         t_0
         (if (<= x 1.9e-63) (/ y (- y 2.0)) (/ x (- 2.0 x))))))))
double code(double x, double y) {
	double t_0 = (y - x) * (1.0 / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -9e+64) {
		tmp = t_0;
	} else if (x <= 1.9e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	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 - x) * (1.0d0 / x)
    if (x <= (-6.5d+147)) then
        tmp = t_0
    else if (x <= (-6d+129)) then
        tmp = 1.0d0 + ((x * (-2.0d0)) / y)
    else if (x <= (-9d+64)) then
        tmp = t_0
    else if (x <= 1.9d-63) then
        tmp = y / (y - 2.0d0)
    else
        tmp = x / (2.0d0 - x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (y - x) * (1.0 / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -9e+64) {
		tmp = t_0;
	} else if (x <= 1.9e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	return tmp;
}
def code(x, y):
	t_0 = (y - x) * (1.0 / x)
	tmp = 0
	if x <= -6.5e+147:
		tmp = t_0
	elif x <= -6e+129:
		tmp = 1.0 + ((x * -2.0) / y)
	elif x <= -9e+64:
		tmp = t_0
	elif x <= 1.9e-63:
		tmp = y / (y - 2.0)
	else:
		tmp = x / (2.0 - x)
	return tmp
function code(x, y)
	t_0 = Float64(Float64(y - x) * Float64(1.0 / x))
	tmp = 0.0
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = Float64(1.0 + Float64(Float64(x * -2.0) / y));
	elseif (x <= -9e+64)
		tmp = t_0;
	elseif (x <= 1.9e-63)
		tmp = Float64(y / Float64(y - 2.0));
	else
		tmp = Float64(x / Float64(2.0 - x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (y - x) * (1.0 / x);
	tmp = 0.0;
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = 1.0 + ((x * -2.0) / y);
	elseif (x <= -9e+64)
		tmp = t_0;
	elseif (x <= 1.9e-63)
		tmp = y / (y - 2.0);
	else
		tmp = x / (2.0 - x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+147], t$95$0, If[LessEqual[x, -6e+129], N[(1.0 + N[(N[(x * -2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9e+64], t$95$0, If[LessEqual[x, 1.9e-63], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y - x\right) \cdot \frac{1}{x}\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -9 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.9 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{y - 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.5e147 or -6.0000000000000006e129 < x < -8.99999999999999946e64

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. 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.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) \]
    6. Applied egg-rr99.7%

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

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

    if -6.5e147 < x < -6.0000000000000006e129

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \frac{2 + \color{blue}{\left(\left(-x\right) + \left(-x\right)\right)}}{y} \]
      14. mul-1-neg86.7%

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

        \[\leadsto 1 + \frac{2 + \left(-1 \cdot x + \color{blue}{-1 \cdot x}\right)}{y} \]
      16. distribute-rgt-out86.7%

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

        \[\leadsto 1 + \frac{2 + x \cdot \color{blue}{-2}}{y} \]
    7. Simplified86.7%

      \[\leadsto \color{blue}{1 + \frac{2 + x \cdot -2}{y}} \]
    8. Taylor expanded in x around inf 86.7%

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

        \[\leadsto 1 + \color{blue}{\frac{-2 \cdot x}{y}} \]
      2. *-commutative86.7%

        \[\leadsto 1 + \frac{\color{blue}{x \cdot -2}}{y} \]
    10. Simplified86.7%

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

    if -8.99999999999999946e64 < x < 1.90000000000000009e-63

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around 0 80.4%

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

    if 1.90000000000000009e-63 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around 0 82.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    6. Step-by-step derivation
      1. mul-1-neg82.6%

        \[\leadsto \color{blue}{-\frac{x}{x - 2}} \]
      2. distribute-neg-frac282.6%

        \[\leadsto \color{blue}{\frac{x}{-\left(x - 2\right)}} \]
      3. neg-sub082.6%

        \[\leadsto \frac{x}{\color{blue}{0 - \left(x - 2\right)}} \]
      4. associate-+l-82.6%

        \[\leadsto \frac{x}{\color{blue}{\left(0 - x\right) + 2}} \]
      5. neg-sub082.6%

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

        \[\leadsto \frac{x}{\color{blue}{2 + \left(-x\right)}} \]
      7. unsub-neg82.6%

        \[\leadsto \frac{x}{\color{blue}{2 - x}} \]
    7. Simplified82.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;\left(y - x\right) \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{+64}:\\ \;\;\;\;\left(y - x\right) \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 73.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -1 - \frac{y \cdot -2}{x}\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{+64}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.96 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- -1.0 (/ (* y -2.0) x))))
   (if (<= x -6.5e+147)
     t_0
     (if (<= x -6e+129)
       (+ 1.0 (/ (* x -2.0) y))
       (if (<= x -8.6e+64)
         t_0
         (if (<= x 1.96e-63) (/ y (- y 2.0)) (/ x (- 2.0 x))))))))
double code(double x, double y) {
	double t_0 = -1.0 - ((y * -2.0) / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -8.6e+64) {
		tmp = t_0;
	} else if (x <= 1.96e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	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 = (-1.0d0) - ((y * (-2.0d0)) / x)
    if (x <= (-6.5d+147)) then
        tmp = t_0
    else if (x <= (-6d+129)) then
        tmp = 1.0d0 + ((x * (-2.0d0)) / y)
    else if (x <= (-8.6d+64)) then
        tmp = t_0
    else if (x <= 1.96d-63) then
        tmp = y / (y - 2.0d0)
    else
        tmp = x / (2.0d0 - x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = -1.0 - ((y * -2.0) / x);
	double tmp;
	if (x <= -6.5e+147) {
		tmp = t_0;
	} else if (x <= -6e+129) {
		tmp = 1.0 + ((x * -2.0) / y);
	} else if (x <= -8.6e+64) {
		tmp = t_0;
	} else if (x <= 1.96e-63) {
		tmp = y / (y - 2.0);
	} else {
		tmp = x / (2.0 - x);
	}
	return tmp;
}
def code(x, y):
	t_0 = -1.0 - ((y * -2.0) / x)
	tmp = 0
	if x <= -6.5e+147:
		tmp = t_0
	elif x <= -6e+129:
		tmp = 1.0 + ((x * -2.0) / y)
	elif x <= -8.6e+64:
		tmp = t_0
	elif x <= 1.96e-63:
		tmp = y / (y - 2.0)
	else:
		tmp = x / (2.0 - x)
	return tmp
function code(x, y)
	t_0 = Float64(-1.0 - Float64(Float64(y * -2.0) / x))
	tmp = 0.0
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = Float64(1.0 + Float64(Float64(x * -2.0) / y));
	elseif (x <= -8.6e+64)
		tmp = t_0;
	elseif (x <= 1.96e-63)
		tmp = Float64(y / Float64(y - 2.0));
	else
		tmp = Float64(x / Float64(2.0 - x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = -1.0 - ((y * -2.0) / x);
	tmp = 0.0;
	if (x <= -6.5e+147)
		tmp = t_0;
	elseif (x <= -6e+129)
		tmp = 1.0 + ((x * -2.0) / y);
	elseif (x <= -8.6e+64)
		tmp = t_0;
	elseif (x <= 1.96e-63)
		tmp = y / (y - 2.0);
	else
		tmp = x / (2.0 - x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 - N[(N[(y * -2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+147], t$95$0, If[LessEqual[x, -6e+129], N[(1.0 + N[(N[(x * -2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.6e+64], t$95$0, If[LessEqual[x, 1.96e-63], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -1 - \frac{y \cdot -2}{x}\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -8.6 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.96 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{y - 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.5e147 or -6.0000000000000006e129 < x < -8.5999999999999995e64

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around inf 81.7%

      \[\leadsto \color{blue}{\frac{y}{x} - \left(1 + -1 \cdot \frac{y - 2}{x}\right)} \]
    6. Step-by-step derivation
      1. sub-neg81.7%

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

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

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

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

        \[\leadsto \left(-1 + \left(-\color{blue}{\left(-\frac{y - 2}{x}\right)}\right)\right) + \frac{y}{x} \]
      6. remove-double-neg81.7%

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

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

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

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

        \[\leadsto -1 + \left(\color{blue}{\left(0 - -1 \cdot \frac{y - 2}{x}\right)} + \frac{y}{x}\right) \]
      11. associate--r-81.7%

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

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

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

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

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

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

        \[\leadsto -1 + \left(0 - \left(\frac{\color{blue}{2} + -1 \cdot y}{x} - \frac{y}{x}\right)\right) \]
      18. div-sub81.7%

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

      \[\leadsto \color{blue}{-1 - \frac{2 + y \cdot -2}{x}} \]
    8. Taylor expanded in y around inf 81.7%

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

        \[\leadsto -1 - \color{blue}{\frac{-2 \cdot y}{x}} \]
      2. *-commutative81.7%

        \[\leadsto -1 - \frac{\color{blue}{y \cdot -2}}{x} \]
    10. Simplified81.7%

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

    if -6.5e147 < x < -6.0000000000000006e129

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \frac{2 + \color{blue}{\left(\left(-x\right) + \left(-x\right)\right)}}{y} \]
      14. mul-1-neg86.7%

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

        \[\leadsto 1 + \frac{2 + \left(-1 \cdot x + \color{blue}{-1 \cdot x}\right)}{y} \]
      16. distribute-rgt-out86.7%

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

        \[\leadsto 1 + \frac{2 + x \cdot \color{blue}{-2}}{y} \]
    7. Simplified86.7%

      \[\leadsto \color{blue}{1 + \frac{2 + x \cdot -2}{y}} \]
    8. Taylor expanded in x around inf 86.7%

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

        \[\leadsto 1 + \color{blue}{\frac{-2 \cdot x}{y}} \]
      2. *-commutative86.7%

        \[\leadsto 1 + \frac{\color{blue}{x \cdot -2}}{y} \]
    10. Simplified86.7%

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

    if -8.5999999999999995e64 < x < 1.9600000000000001e-63

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around 0 80.4%

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

    if 1.9600000000000001e-63 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around 0 82.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{x - 2}} \]
    6. Step-by-step derivation
      1. mul-1-neg82.6%

        \[\leadsto \color{blue}{-\frac{x}{x - 2}} \]
      2. distribute-neg-frac282.6%

        \[\leadsto \color{blue}{\frac{x}{-\left(x - 2\right)}} \]
      3. neg-sub082.6%

        \[\leadsto \frac{x}{\color{blue}{0 - \left(x - 2\right)}} \]
      4. associate-+l-82.6%

        \[\leadsto \frac{x}{\color{blue}{\left(0 - x\right) + 2}} \]
      5. neg-sub082.6%

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

        \[\leadsto \frac{x}{\color{blue}{2 + \left(-x\right)}} \]
      7. unsub-neg82.6%

        \[\leadsto \frac{x}{\color{blue}{2 - x}} \]
    7. Simplified82.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1 - \frac{y \cdot -2}{x}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1 + \frac{x \cdot -2}{y}\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{+64}:\\ \;\;\;\;-1 - \frac{y \cdot -2}{x}\\ \mathbf{elif}\;x \leq 1.96 \cdot 10^{-63}:\\ \;\;\;\;\frac{y}{y - 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 60.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 260000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -6.5e+147)
   -1.0
   (if (<= x -6e+129)
     1.0
     (if (<= x -2.7e+85) -1.0 (if (<= x 260000.0) 1.0 -1.0)))))
double code(double x, double y) {
	double tmp;
	if (x <= -6.5e+147) {
		tmp = -1.0;
	} else if (x <= -6e+129) {
		tmp = 1.0;
	} else if (x <= -2.7e+85) {
		tmp = -1.0;
	} else if (x <= 260000.0) {
		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 (x <= (-6.5d+147)) then
        tmp = -1.0d0
    else if (x <= (-6d+129)) then
        tmp = 1.0d0
    else if (x <= (-2.7d+85)) then
        tmp = -1.0d0
    else if (x <= 260000.0d0) 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 (x <= -6.5e+147) {
		tmp = -1.0;
	} else if (x <= -6e+129) {
		tmp = 1.0;
	} else if (x <= -2.7e+85) {
		tmp = -1.0;
	} else if (x <= 260000.0) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -6.5e+147:
		tmp = -1.0
	elif x <= -6e+129:
		tmp = 1.0
	elif x <= -2.7e+85:
		tmp = -1.0
	elif x <= 260000.0:
		tmp = 1.0
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -6.5e+147)
		tmp = -1.0;
	elseif (x <= -6e+129)
		tmp = 1.0;
	elseif (x <= -2.7e+85)
		tmp = -1.0;
	elseif (x <= 260000.0)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.5e+147)
		tmp = -1.0;
	elseif (x <= -6e+129)
		tmp = 1.0;
	elseif (x <= -2.7e+85)
		tmp = -1.0;
	elseif (x <= 260000.0)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -6.5e+147], -1.0, If[LessEqual[x, -6e+129], 1.0, If[LessEqual[x, -2.7e+85], -1.0, If[LessEqual[x, 260000.0], 1.0, -1.0]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq 260000:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.5e147 or -6.0000000000000006e129 < x < -2.69999999999999983e85 or 2.6e5 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in x around inf 83.4%

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

    if -6.5e147 < x < -6.0000000000000006e129 or -2.69999999999999983e85 < x < 2.6e5

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
      17. 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. Add Preprocessing
    5. Taylor expanded in y around inf 53.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+147}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+129}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{+85}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 260000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 36.9% 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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y - x}{\color{blue}{x + \left(y + \left(-2\right)\right)}} \]
    17. 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. Add Preprocessing
  5. Taylor expanded in x around inf 34.4%

    \[\leadsto \color{blue}{-1} \]
  6. Final simplification34.4%

    \[\leadsto -1 \]
  7. Add Preprocessing

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 2024071 
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
  :precision binary64

  :alt
  (- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))

  (/ (- x y) (- 2.0 (+ x y))))