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

Percentage Accurate: 100.0% → 100.0%
Time: 8.5s
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, 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}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 2: 60.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{+34}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -0.076:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-44}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-187}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-280}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-145}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.9:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -5.4e+34)
   -1.0
   (if (<= x -0.076)
     1.0
     (if (<= x -2e-44)
       (* x 0.5)
       (if (<= x -3e-187)
         1.0
         (if (<= x 9.5e-280)
           (* y -0.5)
           (if (<= x 2.15e-145) 1.0 (if (<= x 3.9) (* x 0.5) -1.0))))))))
double code(double x, double y) {
	double tmp;
	if (x <= -5.4e+34) {
		tmp = -1.0;
	} else if (x <= -0.076) {
		tmp = 1.0;
	} else if (x <= -2e-44) {
		tmp = x * 0.5;
	} else if (x <= -3e-187) {
		tmp = 1.0;
	} else if (x <= 9.5e-280) {
		tmp = y * -0.5;
	} else if (x <= 2.15e-145) {
		tmp = 1.0;
	} else if (x <= 3.9) {
		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 <= (-5.4d+34)) then
        tmp = -1.0d0
    else if (x <= (-0.076d0)) then
        tmp = 1.0d0
    else if (x <= (-2d-44)) then
        tmp = x * 0.5d0
    else if (x <= (-3d-187)) then
        tmp = 1.0d0
    else if (x <= 9.5d-280) then
        tmp = y * (-0.5d0)
    else if (x <= 2.15d-145) then
        tmp = 1.0d0
    else if (x <= 3.9d0) 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 <= -5.4e+34) {
		tmp = -1.0;
	} else if (x <= -0.076) {
		tmp = 1.0;
	} else if (x <= -2e-44) {
		tmp = x * 0.5;
	} else if (x <= -3e-187) {
		tmp = 1.0;
	} else if (x <= 9.5e-280) {
		tmp = y * -0.5;
	} else if (x <= 2.15e-145) {
		tmp = 1.0;
	} else if (x <= 3.9) {
		tmp = x * 0.5;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -5.4e+34:
		tmp = -1.0
	elif x <= -0.076:
		tmp = 1.0
	elif x <= -2e-44:
		tmp = x * 0.5
	elif x <= -3e-187:
		tmp = 1.0
	elif x <= 9.5e-280:
		tmp = y * -0.5
	elif x <= 2.15e-145:
		tmp = 1.0
	elif x <= 3.9:
		tmp = x * 0.5
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -5.4e+34)
		tmp = -1.0;
	elseif (x <= -0.076)
		tmp = 1.0;
	elseif (x <= -2e-44)
		tmp = Float64(x * 0.5);
	elseif (x <= -3e-187)
		tmp = 1.0;
	elseif (x <= 9.5e-280)
		tmp = Float64(y * -0.5);
	elseif (x <= 2.15e-145)
		tmp = 1.0;
	elseif (x <= 3.9)
		tmp = Float64(x * 0.5);
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5.4e+34)
		tmp = -1.0;
	elseif (x <= -0.076)
		tmp = 1.0;
	elseif (x <= -2e-44)
		tmp = x * 0.5;
	elseif (x <= -3e-187)
		tmp = 1.0;
	elseif (x <= 9.5e-280)
		tmp = y * -0.5;
	elseif (x <= 2.15e-145)
		tmp = 1.0;
	elseif (x <= 3.9)
		tmp = x * 0.5;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -5.4e+34], -1.0, If[LessEqual[x, -0.076], 1.0, If[LessEqual[x, -2e-44], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, -3e-187], 1.0, If[LessEqual[x, 9.5e-280], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 2.15e-145], 1.0, If[LessEqual[x, 3.9], N[(x * 0.5), $MachinePrecision], -1.0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -0.076:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq -2 \cdot 10^{-44}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq -3 \cdot 10^{-187}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{-280}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;x \leq 2.15 \cdot 10^{-145}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -5.4000000000000001e34 or 3.89999999999999991 < x

    1. Initial program 100.0%

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

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

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

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

    if -5.4000000000000001e34 < x < -0.0759999999999999981 or -1.99999999999999991e-44 < x < -3.00000000000000004e-187 or 9.50000000000000082e-280 < x < 2.15e-145

    1. Initial program 100.0%

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

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

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

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

    if -0.0759999999999999981 < x < -1.99999999999999991e-44 or 2.15e-145 < x < 3.89999999999999991

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified58.7%

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

    if -3.00000000000000004e-187 < x < 9.50000000000000082e-280

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{2 - y}} \]
      2. neg-mul-196.8%

        \[\leadsto \frac{\color{blue}{-y}}{2 - y} \]
    6. Simplified96.8%

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

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative60.3%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    9. Simplified60.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{+34}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -0.076:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-44}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-187}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-280}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-145}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.9:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 3: 60.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{x}{y}\\ \mathbf{if}\;x \leq -5.1 \cdot 10^{+34}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -0.076:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-46}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{-187}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-280}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 10^{-144}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 9.2:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ x y))))
   (if (<= x -5.1e+34)
     -1.0
     (if (<= x -0.076)
       t_0
       (if (<= x -5.5e-46)
         (* x 0.5)
         (if (<= x -7.8e-187)
           t_0
           (if (<= x 9e-280)
             (* y -0.5)
             (if (<= x 1e-144) 1.0 (if (<= x 9.2) (* x 0.5) -1.0)))))))))
double code(double x, double y) {
	double t_0 = 1.0 - (x / y);
	double tmp;
	if (x <= -5.1e+34) {
		tmp = -1.0;
	} else if (x <= -0.076) {
		tmp = t_0;
	} else if (x <= -5.5e-46) {
		tmp = x * 0.5;
	} else if (x <= -7.8e-187) {
		tmp = t_0;
	} else if (x <= 9e-280) {
		tmp = y * -0.5;
	} else if (x <= 1e-144) {
		tmp = 1.0;
	} else if (x <= 9.2) {
		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) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - (x / y)
    if (x <= (-5.1d+34)) then
        tmp = -1.0d0
    else if (x <= (-0.076d0)) then
        tmp = t_0
    else if (x <= (-5.5d-46)) then
        tmp = x * 0.5d0
    else if (x <= (-7.8d-187)) then
        tmp = t_0
    else if (x <= 9d-280) then
        tmp = y * (-0.5d0)
    else if (x <= 1d-144) then
        tmp = 1.0d0
    else if (x <= 9.2d0) then
        tmp = x * 0.5d0
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 1.0 - (x / y);
	double tmp;
	if (x <= -5.1e+34) {
		tmp = -1.0;
	} else if (x <= -0.076) {
		tmp = t_0;
	} else if (x <= -5.5e-46) {
		tmp = x * 0.5;
	} else if (x <= -7.8e-187) {
		tmp = t_0;
	} else if (x <= 9e-280) {
		tmp = y * -0.5;
	} else if (x <= 1e-144) {
		tmp = 1.0;
	} else if (x <= 9.2) {
		tmp = x * 0.5;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 - (x / y)
	tmp = 0
	if x <= -5.1e+34:
		tmp = -1.0
	elif x <= -0.076:
		tmp = t_0
	elif x <= -5.5e-46:
		tmp = x * 0.5
	elif x <= -7.8e-187:
		tmp = t_0
	elif x <= 9e-280:
		tmp = y * -0.5
	elif x <= 1e-144:
		tmp = 1.0
	elif x <= 9.2:
		tmp = x * 0.5
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	t_0 = Float64(1.0 - Float64(x / y))
	tmp = 0.0
	if (x <= -5.1e+34)
		tmp = -1.0;
	elseif (x <= -0.076)
		tmp = t_0;
	elseif (x <= -5.5e-46)
		tmp = Float64(x * 0.5);
	elseif (x <= -7.8e-187)
		tmp = t_0;
	elseif (x <= 9e-280)
		tmp = Float64(y * -0.5);
	elseif (x <= 1e-144)
		tmp = 1.0;
	elseif (x <= 9.2)
		tmp = Float64(x * 0.5);
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 - (x / y);
	tmp = 0.0;
	if (x <= -5.1e+34)
		tmp = -1.0;
	elseif (x <= -0.076)
		tmp = t_0;
	elseif (x <= -5.5e-46)
		tmp = x * 0.5;
	elseif (x <= -7.8e-187)
		tmp = t_0;
	elseif (x <= 9e-280)
		tmp = y * -0.5;
	elseif (x <= 1e-144)
		tmp = 1.0;
	elseif (x <= 9.2)
		tmp = x * 0.5;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.1e+34], -1.0, If[LessEqual[x, -0.076], t$95$0, If[LessEqual[x, -5.5e-46], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, -7.8e-187], t$95$0, If[LessEqual[x, 9e-280], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 1e-144], 1.0, If[LessEqual[x, 9.2], N[(x * 0.5), $MachinePrecision], -1.0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -0.076:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -5.5 \cdot 10^{-46}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq -7.8 \cdot 10^{-187}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 9 \cdot 10^{-280}:\\
\;\;\;\;y \cdot -0.5\\

\mathbf{elif}\;x \leq 10^{-144}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -5.10000000000000036e34 or 9.1999999999999993 < x

    1. Initial program 100.0%

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

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

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

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

    if -5.10000000000000036e34 < x < -0.0759999999999999981 or -5.49999999999999983e-46 < x < -7.7999999999999998e-187

    1. Initial program 100.0%

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

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

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

      \[\leadsto \frac{x - y}{\color{blue}{-1 \cdot y}} \]
    5. Step-by-step derivation
      1. neg-mul-169.5%

        \[\leadsto \frac{x - y}{\color{blue}{-y}} \]
    6. Simplified69.5%

      \[\leadsto \frac{x - y}{\color{blue}{-y}} \]
    7. Taylor expanded in x around 0 69.5%

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{x}{y}} \]
    8. Step-by-step derivation
      1. mul-1-neg69.5%

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

        \[\leadsto \color{blue}{1 - \frac{x}{y}} \]
    9. Simplified69.5%

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

    if -0.0759999999999999981 < x < -5.49999999999999983e-46 or 9.9999999999999995e-145 < x < 9.1999999999999993

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified58.7%

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

    if -7.7999999999999998e-187 < x < 8.9999999999999991e-280

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{2 - y}} \]
      2. neg-mul-196.8%

        \[\leadsto \frac{\color{blue}{-y}}{2 - y} \]
    6. Simplified96.8%

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

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative60.3%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    9. Simplified60.3%

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

    if 8.9999999999999991e-280 < x < 9.9999999999999995e-145

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.1 \cdot 10^{+34}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -0.076:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-46}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{-187}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-280}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 10^{-144}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 9.2:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 4: 60.5% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;x \leq -3.9 \cdot 10^{-187}:\\
\;\;\;\;1 - \frac{x}{y}\\

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

\mathbf{elif}\;x \leq 9.8 \cdot 10^{-145}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -1.1499999999999999e35 or 2.2000000000000002 < x

    1. Initial program 100.0%

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

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

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

      \[\leadsto \frac{x - y}{\color{blue}{-1 \cdot x}} \]
    5. Step-by-step derivation
      1. neg-mul-182.9%

        \[\leadsto \frac{x - y}{\color{blue}{-x}} \]
    6. Simplified82.9%

      \[\leadsto \frac{x - y}{\color{blue}{-x}} \]
    7. Taylor expanded in x around 0 82.9%

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

    if -1.1499999999999999e35 < x < -3.8999999999999999e-187

    1. Initial program 99.9%

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

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

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

      \[\leadsto \frac{x - y}{\color{blue}{-1 \cdot y}} \]
    5. Step-by-step derivation
      1. neg-mul-158.4%

        \[\leadsto \frac{x - y}{\color{blue}{-y}} \]
    6. Simplified58.4%

      \[\leadsto \frac{x - y}{\color{blue}{-y}} \]
    7. Taylor expanded in x around 0 58.4%

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

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

        \[\leadsto \color{blue}{1 - \frac{x}{y}} \]
    9. Simplified58.4%

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

    if -3.8999999999999999e-187 < x < 1.00000000000000006e-279

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{2 - y}} \]
      2. neg-mul-196.8%

        \[\leadsto \frac{\color{blue}{-y}}{2 - y} \]
    6. Simplified96.8%

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

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative60.3%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    9. Simplified60.3%

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

    if 1.00000000000000006e-279 < x < 9.79999999999999934e-145

    1. Initial program 100.0%

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

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

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

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

    if 9.79999999999999934e-145 < x < 2.2000000000000002

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified58.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+35}:\\ \;\;\;\;\frac{y}{x} + -1\\ \mathbf{elif}\;x \leq -3.9 \cdot 10^{-187}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;x \leq 10^{-279}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 9.8 \cdot 10^{-145}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.2:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x} + -1\\ \end{array} \]

Alternative 5: 60.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+35}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -0.076:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-45}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{-147}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.3:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -2e+35)
   -1.0
   (if (<= x -0.076)
     1.0
     (if (<= x -5.2e-45)
       (* x 0.5)
       (if (<= x 3.7e-147) 1.0 (if (<= x 3.3) (* x 0.5) -1.0))))))
double code(double x, double y) {
	double tmp;
	if (x <= -2e+35) {
		tmp = -1.0;
	} else if (x <= -0.076) {
		tmp = 1.0;
	} else if (x <= -5.2e-45) {
		tmp = x * 0.5;
	} else if (x <= 3.7e-147) {
		tmp = 1.0;
	} else if (x <= 3.3) {
		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 <= (-2d+35)) then
        tmp = -1.0d0
    else if (x <= (-0.076d0)) then
        tmp = 1.0d0
    else if (x <= (-5.2d-45)) then
        tmp = x * 0.5d0
    else if (x <= 3.7d-147) then
        tmp = 1.0d0
    else if (x <= 3.3d0) 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 <= -2e+35) {
		tmp = -1.0;
	} else if (x <= -0.076) {
		tmp = 1.0;
	} else if (x <= -5.2e-45) {
		tmp = x * 0.5;
	} else if (x <= 3.7e-147) {
		tmp = 1.0;
	} else if (x <= 3.3) {
		tmp = x * 0.5;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -2e+35:
		tmp = -1.0
	elif x <= -0.076:
		tmp = 1.0
	elif x <= -5.2e-45:
		tmp = x * 0.5
	elif x <= 3.7e-147:
		tmp = 1.0
	elif x <= 3.3:
		tmp = x * 0.5
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -2e+35)
		tmp = -1.0;
	elseif (x <= -0.076)
		tmp = 1.0;
	elseif (x <= -5.2e-45)
		tmp = Float64(x * 0.5);
	elseif (x <= 3.7e-147)
		tmp = 1.0;
	elseif (x <= 3.3)
		tmp = Float64(x * 0.5);
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2e+35)
		tmp = -1.0;
	elseif (x <= -0.076)
		tmp = 1.0;
	elseif (x <= -5.2e-45)
		tmp = x * 0.5;
	elseif (x <= 3.7e-147)
		tmp = 1.0;
	elseif (x <= 3.3)
		tmp = x * 0.5;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -2e+35], -1.0, If[LessEqual[x, -0.076], 1.0, If[LessEqual[x, -5.2e-45], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 3.7e-147], 1.0, If[LessEqual[x, 3.3], N[(x * 0.5), $MachinePrecision], -1.0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -0.076:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq -5.2 \cdot 10^{-45}:\\
\;\;\;\;x \cdot 0.5\\

\mathbf{elif}\;x \leq 3.7 \cdot 10^{-147}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.9999999999999999e35 or 3.2999999999999998 < x

    1. Initial program 100.0%

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

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

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

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

    if -1.9999999999999999e35 < x < -0.0759999999999999981 or -5.19999999999999973e-45 < x < 3.7000000000000002e-147

    1. Initial program 100.0%

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

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

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

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

    if -0.0759999999999999981 < x < -5.19999999999999973e-45 or 3.7000000000000002e-147 < x < 3.2999999999999998

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot 0.5} \]
    7. Simplified58.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+35}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -0.076:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-45}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{-147}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.3:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 6: 86.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.1 \cdot 10^{+34} \lor \neg \left(x \leq 1.1 \cdot 10^{+29}\right):\\ \;\;\;\;\frac{y}{x} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{2 - y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -5.1e+34) (not (<= x 1.1e+29)))
   (+ (/ y x) -1.0)
   (/ (- x y) (- 2.0 y))))
double code(double x, double y) {
	double tmp;
	if ((x <= -5.1e+34) || !(x <= 1.1e+29)) {
		tmp = (y / x) + -1.0;
	} else {
		tmp = (x - y) / (2.0 - y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-5.1d+34)) .or. (.not. (x <= 1.1d+29))) then
        tmp = (y / x) + (-1.0d0)
    else
        tmp = (x - y) / (2.0d0 - y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -5.1e+34) || !(x <= 1.1e+29)) {
		tmp = (y / x) + -1.0;
	} else {
		tmp = (x - y) / (2.0 - y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -5.1e+34) or not (x <= 1.1e+29):
		tmp = (y / x) + -1.0
	else:
		tmp = (x - y) / (2.0 - y)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -5.1e+34) || !(x <= 1.1e+29))
		tmp = Float64(Float64(y / x) + -1.0);
	else
		tmp = Float64(Float64(x - y) / Float64(2.0 - y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -5.1e+34) || ~((x <= 1.1e+29)))
		tmp = (y / x) + -1.0;
	else
		tmp = (x - y) / (2.0 - y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -5.1e+34], N[Not[LessEqual[x, 1.1e+29]], $MachinePrecision]], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / N[(2.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.1 \cdot 10^{+34} \lor \neg \left(x \leq 1.1 \cdot 10^{+29}\right):\\
\;\;\;\;\frac{y}{x} + -1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.10000000000000036e34 or 1.1000000000000001e29 < x

    1. Initial program 99.9%

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

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

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

      \[\leadsto \frac{x - y}{\color{blue}{-1 \cdot x}} \]
    5. Step-by-step derivation
      1. neg-mul-185.8%

        \[\leadsto \frac{x - y}{\color{blue}{-x}} \]
    6. Simplified85.8%

      \[\leadsto \frac{x - y}{\color{blue}{-x}} \]
    7. Taylor expanded in x around 0 85.8%

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

    if -5.10000000000000036e34 < x < 1.1000000000000001e29

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.1 \cdot 10^{+34} \lor \neg \left(x \leq 1.1 \cdot 10^{+29}\right):\\ \;\;\;\;\frac{y}{x} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{2 - y}\\ \end{array} \]

Alternative 7: 73.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+102} \lor \neg \left(y \leq 2.35 \cdot 10^{+32}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -7.5e+102) (not (<= y 2.35e+32)))
   (- 1.0 (/ x y))
   (/ x (- 2.0 x))))
double code(double x, double y) {
	double tmp;
	if ((y <= -7.5e+102) || !(y <= 2.35e+32)) {
		tmp = 1.0 - (x / y);
	} 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 ((y <= (-7.5d+102)) .or. (.not. (y <= 2.35d+32))) then
        tmp = 1.0d0 - (x / y)
    else
        tmp = x / (2.0d0 - x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -7.5e+102) || !(y <= 2.35e+32)) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = x / (2.0 - x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -7.5e+102) or not (y <= 2.35e+32):
		tmp = 1.0 - (x / y)
	else:
		tmp = x / (2.0 - x)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -7.5e+102) || !(y <= 2.35e+32))
		tmp = Float64(1.0 - Float64(x / y));
	else
		tmp = Float64(x / Float64(2.0 - x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -7.5e+102) || ~((y <= 2.35e+32)))
		tmp = 1.0 - (x / y);
	else
		tmp = x / (2.0 - x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -7.5e+102], N[Not[LessEqual[y, 2.35e+32]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+102} \lor \neg \left(y \leq 2.35 \cdot 10^{+32}\right):\\
\;\;\;\;1 - \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.5e102 or 2.35000000000000012e32 < y

    1. Initial program 100.0%

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

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

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

      \[\leadsto \frac{x - y}{\color{blue}{-1 \cdot y}} \]
    5. Step-by-step derivation
      1. neg-mul-184.6%

        \[\leadsto \frac{x - y}{\color{blue}{-y}} \]
    6. Simplified84.6%

      \[\leadsto \frac{x - y}{\color{blue}{-y}} \]
    7. Taylor expanded in x around 0 84.6%

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{x}{y}} \]
    8. Step-by-step derivation
      1. mul-1-neg84.6%

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

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

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

    if -7.5e102 < y < 2.35000000000000012e32

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+102} \lor \neg \left(y \leq 2.35 \cdot 10^{+32}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{2 - x}\\ \end{array} \]

Alternative 8: 74.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.6 \cdot 10^{-45} \lor \neg \left(x \leq 5.5 \cdot 10^{-81}\right):\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y + -2}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -2.6e-45) (not (<= x 5.5e-81)))
   (/ x (- 2.0 x))
   (/ y (+ y -2.0))))
double code(double x, double y) {
	double tmp;
	if ((x <= -2.6e-45) || !(x <= 5.5e-81)) {
		tmp = x / (2.0 - x);
	} else {
		tmp = y / (y + -2.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-2.6d-45)) .or. (.not. (x <= 5.5d-81))) then
        tmp = x / (2.0d0 - x)
    else
        tmp = y / (y + (-2.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((x <= -2.6e-45) || !(x <= 5.5e-81)) {
		tmp = x / (2.0 - x);
	} else {
		tmp = y / (y + -2.0);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (x <= -2.6e-45) or not (x <= 5.5e-81):
		tmp = x / (2.0 - x)
	else:
		tmp = y / (y + -2.0)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((x <= -2.6e-45) || !(x <= 5.5e-81))
		tmp = Float64(x / Float64(2.0 - x));
	else
		tmp = Float64(y / Float64(y + -2.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -2.6e-45) || ~((x <= 5.5e-81)))
		tmp = x / (2.0 - x);
	else
		tmp = y / (y + -2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[x, -2.6e-45], N[Not[LessEqual[x, 5.5e-81]], $MachinePrecision]], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-45} \lor \neg \left(x \leq 5.5 \cdot 10^{-81}\right):\\
\;\;\;\;\frac{x}{2 - x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.59999999999999987e-45 or 5.50000000000000026e-81 < x

    1. Initial program 99.9%

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

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

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

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

    if -2.59999999999999987e-45 < x < 5.50000000000000026e-81

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{2 - y}} \]
      2. neg-mul-186.9%

        \[\leadsto \frac{\color{blue}{-y}}{2 - y} \]
    6. Simplified86.9%

      \[\leadsto \color{blue}{\frac{-y}{2 - y}} \]
    7. Step-by-step derivation
      1. frac-2neg86.9%

        \[\leadsto \color{blue}{\frac{-\left(-y\right)}{-\left(2 - y\right)}} \]
      2. div-inv86.8%

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

        \[\leadsto \color{blue}{y} \cdot \frac{1}{-\left(2 - y\right)} \]
      4. sub-neg86.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot 1}{-2 + y}} \]
      2. *-rgt-identity86.9%

        \[\leadsto \frac{\color{blue}{y}}{-2 + y} \]
      3. +-commutative86.9%

        \[\leadsto \frac{y}{\color{blue}{y + -2}} \]
    10. Simplified86.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.6 \cdot 10^{-45} \lor \neg \left(x \leq 5.5 \cdot 10^{-81}\right):\\ \;\;\;\;\frac{x}{2 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y + -2}\\ \end{array} \]

Alternative 9: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 10: 62.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+35}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+28}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -1e+35) -1.0 (if (<= x 1.4e+28) 1.0 -1.0)))
double code(double x, double y) {
	double tmp;
	if (x <= -1e+35) {
		tmp = -1.0;
	} else if (x <= 1.4e+28) {
		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 <= (-1d+35)) then
        tmp = -1.0d0
    else if (x <= 1.4d+28) 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 <= -1e+35) {
		tmp = -1.0;
	} else if (x <= 1.4e+28) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -1e+35:
		tmp = -1.0
	elif x <= 1.4e+28:
		tmp = 1.0
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -1e+35)
		tmp = -1.0;
	elseif (x <= 1.4e+28)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1e+35)
		tmp = -1.0;
	elseif (x <= 1.4e+28)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -1e+35], -1.0, If[LessEqual[x, 1.4e+28], 1.0, -1.0]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.4 \cdot 10^{+28}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.9999999999999997e34 or 1.4000000000000001e28 < x

    1. Initial program 99.9%

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

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

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

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

    if -9.9999999999999997e34 < x < 1.4000000000000001e28

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+35}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+28}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 11: 39.1% accurate, 9.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
	return -1.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -1.0d0
end function
public static double code(double x, double y) {
	return -1.0;
}
def code(x, y):
	return -1.0
function code(x, y)
	return -1.0
end
function tmp = code(x, y)
	tmp = -1.0;
end
code[x_, y_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

    \[\leadsto \color{blue}{-1} \]
  5. Final simplification39.4%

    \[\leadsto -1 \]

Developer target: 100.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t_0} - \frac{y}{t_0}
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023285 
(FPCore (x y)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
  :precision binary64

  :herbie-target
  (- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))

  (/ (- x y) (- 2.0 (+ x y))))