Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3

Percentage Accurate: 77.8% → 100.0%
Time: 5.5s
Alternatives: 7
Speedup: 1.3×

Specification

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

\\
x + \left(1 - x\right) \cdot \left(1 - 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 7 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: 77.8% accurate, 1.0× speedup?

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

\\
x + \left(1 - x\right) \cdot \left(1 - y\right)
\end{array}

Alternative 1: 100.0% accurate, 1.3× speedup?

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

\\
1 + y \cdot \left(x + -1\right)
\end{array}
Derivation
  1. Initial program 77.1%

    \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
  2. Step-by-step derivation
    1. +-commutative77.1%

      \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) + x} \]
    2. remove-double-neg77.1%

      \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
    3. unsub-neg77.1%

      \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
    4. sub-neg77.1%

      \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(1 + \left(-y\right)\right)} - \left(-x\right) \]
    5. +-commutative77.1%

      \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
    6. distribute-rgt-in77.1%

      \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
    7. *-lft-identity77.1%

      \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
    8. associate--l+89.3%

      \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
    9. associate--l-100.0%

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

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

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

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

      \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
    14. distribute-lft-neg-out100.0%

      \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
    15. distribute-rgt-neg-in100.0%

      \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
    16. neg-sub0100.0%

      \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
    17. associate--r-100.0%

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

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

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

    \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 61.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.02 \cdot 10^{+290}:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq -1.22 \cdot 10^{+195}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq -8000:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq -3.45 \cdot 10^{-93}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-147} \lor \neg \left(y \leq 2.9 \cdot 10^{-31}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.02e+290)
   (- y)
   (if (<= y -1.22e+195)
     (* y x)
     (if (<= y -8000.0)
       (- y)
       (if (<= y -3.45e-93)
         1.0
         (if (or (<= y -5.2e-147) (not (<= y 2.9e-31))) (* y x) 1.0))))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.02e+290) {
		tmp = -y;
	} else if (y <= -1.22e+195) {
		tmp = y * x;
	} else if (y <= -8000.0) {
		tmp = -y;
	} else if (y <= -3.45e-93) {
		tmp = 1.0;
	} else if ((y <= -5.2e-147) || !(y <= 2.9e-31)) {
		tmp = y * x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1.02d+290)) then
        tmp = -y
    else if (y <= (-1.22d+195)) then
        tmp = y * x
    else if (y <= (-8000.0d0)) then
        tmp = -y
    else if (y <= (-3.45d-93)) then
        tmp = 1.0d0
    else if ((y <= (-5.2d-147)) .or. (.not. (y <= 2.9d-31))) then
        tmp = y * x
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.02e+290) {
		tmp = -y;
	} else if (y <= -1.22e+195) {
		tmp = y * x;
	} else if (y <= -8000.0) {
		tmp = -y;
	} else if (y <= -3.45e-93) {
		tmp = 1.0;
	} else if ((y <= -5.2e-147) || !(y <= 2.9e-31)) {
		tmp = y * x;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.02e+290:
		tmp = -y
	elif y <= -1.22e+195:
		tmp = y * x
	elif y <= -8000.0:
		tmp = -y
	elif y <= -3.45e-93:
		tmp = 1.0
	elif (y <= -5.2e-147) or not (y <= 2.9e-31):
		tmp = y * x
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.02e+290)
		tmp = Float64(-y);
	elseif (y <= -1.22e+195)
		tmp = Float64(y * x);
	elseif (y <= -8000.0)
		tmp = Float64(-y);
	elseif (y <= -3.45e-93)
		tmp = 1.0;
	elseif ((y <= -5.2e-147) || !(y <= 2.9e-31))
		tmp = Float64(y * x);
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.02e+290)
		tmp = -y;
	elseif (y <= -1.22e+195)
		tmp = y * x;
	elseif (y <= -8000.0)
		tmp = -y;
	elseif (y <= -3.45e-93)
		tmp = 1.0;
	elseif ((y <= -5.2e-147) || ~((y <= 2.9e-31)))
		tmp = y * x;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.02e+290], (-y), If[LessEqual[y, -1.22e+195], N[(y * x), $MachinePrecision], If[LessEqual[y, -8000.0], (-y), If[LessEqual[y, -3.45e-93], 1.0, If[Or[LessEqual[y, -5.2e-147], N[Not[LessEqual[y, 2.9e-31]], $MachinePrecision]], N[(y * x), $MachinePrecision], 1.0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+290}:\\
\;\;\;\;-y\\

\mathbf{elif}\;y \leq -1.22 \cdot 10^{+195}:\\
\;\;\;\;y \cdot x\\

\mathbf{elif}\;y \leq -8000:\\
\;\;\;\;-y\\

\mathbf{elif}\;y \leq -3.45 \cdot 10^{-93}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -5.2 \cdot 10^{-147} \lor \neg \left(y \leq 2.9 \cdot 10^{-31}\right):\\
\;\;\;\;y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.02e290 or -1.2200000000000001e195 < y < -8e3

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg100.0%

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in100.0%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity100.0%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+100.0%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{-1 \cdot y}\right) \]
      3. mul-1-neg100.0%

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{\left(-y\right)}\right) \]
    6. Applied egg-rr100.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot y} \]
    9. Step-by-step derivation
      1. neg-mul-164.3%

        \[\leadsto \color{blue}{-y} \]
    10. Simplified64.3%

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

    if -1.02e290 < y < -1.2200000000000001e195 or -3.45000000000000015e-93 < y < -5.1999999999999997e-147 or 2.9000000000000001e-31 < y

    1. Initial program 86.1%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative86.1%

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in86.1%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity86.1%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+100.0%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{-1 \cdot y}\right) \]
      3. mul-1-neg100.0%

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{\left(-y\right)}\right) \]
    6. Applied egg-rr100.0%

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

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

        \[\leadsto \color{blue}{y \cdot x} \]
    9. Simplified65.1%

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

    if -8e3 < y < -3.45000000000000015e-93 or -5.1999999999999997e-147 < y < 2.9000000000000001e-31

    1. Initial program 62.1%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative62.1%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) + x} \]
      2. remove-double-neg62.1%

        \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      3. unsub-neg62.1%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg62.1%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(1 + \left(-y\right)\right)} - \left(-x\right) \]
      5. +-commutative62.1%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in62.1%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity62.1%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+77.8%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 82.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.02 \cdot 10^{+290}:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq -1.22 \cdot 10^{+195}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq -8000:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq -3.45 \cdot 10^{-93}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-147} \lor \neg \left(y \leq 2.9 \cdot 10^{-31}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 5.6 \cdot 10^{-25}\right):\\
\;\;\;\;1 + y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1 or 5.59999999999999976e-25 < x

    1. Initial program 54.3%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative54.3%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) + x} \]
      2. remove-double-neg54.3%

        \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      3. unsub-neg54.3%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg54.3%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(1 + \left(-y\right)\right)} - \left(-x\right) \]
      5. +-commutative54.3%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in54.3%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity54.3%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+78.6%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 98.5%

      \[\leadsto 1 + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative98.5%

        \[\leadsto 1 + \color{blue}{y \cdot x} \]
    7. Simplified98.5%

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

    if -1 < x < 5.59999999999999976e-25

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg100.0%

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in100.0%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity100.0%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+100.0%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 99.4%

      \[\leadsto \color{blue}{1 + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-199.4%

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

        \[\leadsto \color{blue}{1 - y} \]
    7. Simplified99.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 5.6 \cdot 10^{-25}\right):\\ \;\;\;\;1 + y \cdot x\\ \mathbf{else}:\\ \;\;\;\;1 - y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+22}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{+102}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x + -1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -4.5e+22) (* y x) (if (<= x 4.1e+102) (- 1.0 y) (* y (+ x -1.0)))))
double code(double x, double y) {
	double tmp;
	if (x <= -4.5e+22) {
		tmp = y * x;
	} else if (x <= 4.1e+102) {
		tmp = 1.0 - y;
	} else {
		tmp = y * (x + -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 <= (-4.5d+22)) then
        tmp = y * x
    else if (x <= 4.1d+102) then
        tmp = 1.0d0 - y
    else
        tmp = y * (x + (-1.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -4.5e+22) {
		tmp = y * x;
	} else if (x <= 4.1e+102) {
		tmp = 1.0 - y;
	} else {
		tmp = y * (x + -1.0);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -4.5e+22:
		tmp = y * x
	elif x <= 4.1e+102:
		tmp = 1.0 - y
	else:
		tmp = y * (x + -1.0)
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -4.5e+22)
		tmp = Float64(y * x);
	elseif (x <= 4.1e+102)
		tmp = Float64(1.0 - y);
	else
		tmp = Float64(y * Float64(x + -1.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -4.5e+22)
		tmp = y * x;
	elseif (x <= 4.1e+102)
		tmp = 1.0 - y;
	else
		tmp = y * (x + -1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -4.5e+22], N[(y * x), $MachinePrecision], If[LessEqual[x, 4.1e+102], N[(1.0 - y), $MachinePrecision], N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{+22}:\\
\;\;\;\;y \cdot x\\

\mathbf{elif}\;x \leq 4.1 \cdot 10^{+102}:\\
\;\;\;\;1 - y\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.4999999999999998e22

    1. Initial program 53.1%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative53.1%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) + x} \]
      2. remove-double-neg53.1%

        \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      3. unsub-neg53.1%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg53.1%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(1 + \left(-y\right)\right)} - \left(-x\right) \]
      5. +-commutative53.1%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in53.1%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity53.1%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+80.6%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{-1 \cdot y}\right) \]
      3. mul-1-neg100.0%

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{\left(-y\right)}\right) \]
    6. Applied egg-rr100.0%

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

      \[\leadsto \color{blue}{x \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative80.6%

        \[\leadsto \color{blue}{y \cdot x} \]
    9. Simplified80.6%

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

    if -4.4999999999999998e22 < x < 4.1e102

    1. Initial program 91.9%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative91.9%

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

        \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      3. unsub-neg91.9%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg91.9%

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in91.9%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity91.9%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+92.4%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 92.7%

      \[\leadsto \color{blue}{1 + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-192.7%

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

        \[\leadsto \color{blue}{1 - y} \]
    7. Simplified92.7%

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

    if 4.1e102 < x

    1. Initial program 54.2%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative54.2%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) + x} \]
      2. remove-double-neg54.2%

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in54.2%

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

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+88.4%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{-1 \cdot y}\right) \]
      3. mul-1-neg100.0%

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{\left(-y\right)}\right) \]
    6. Applied egg-rr100.0%

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

      \[\leadsto \color{blue}{y \cdot \left(x - 1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+22}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{+102}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+28} \lor \neg \left(x \leq 3.4 \cdot 10^{+102}\right):\\
\;\;\;\;y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.99999999999999983e28 or 3.4e102 < x

    1. Initial program 53.7%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative53.7%

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

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

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg53.7%

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in53.7%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity53.7%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+84.5%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{-1 \cdot y}\right) \]
      3. mul-1-neg100.0%

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{\left(-y\right)}\right) \]
    6. Applied egg-rr100.0%

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

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

        \[\leadsto \color{blue}{y \cdot x} \]
    9. Simplified84.5%

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

    if -3.99999999999999983e28 < x < 3.4e102

    1. Initial program 91.9%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative91.9%

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

        \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      3. unsub-neg91.9%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg91.9%

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in91.9%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity91.9%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+92.4%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 92.7%

      \[\leadsto \color{blue}{1 + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-192.7%

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

        \[\leadsto \color{blue}{1 - y} \]
    7. Simplified92.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+28} \lor \neg \left(x \leq 3.4 \cdot 10^{+102}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;1 - y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 61.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8000 \lor \neg \left(y \leq 0.0009\right):\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -8000.0) (not (<= y 0.0009))) (- y) 1.0))
double code(double x, double y) {
	double tmp;
	if ((y <= -8000.0) || !(y <= 0.0009)) {
		tmp = -y;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-8000.0d0)) .or. (.not. (y <= 0.0009d0))) then
        tmp = -y
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -8000.0) || !(y <= 0.0009)) {
		tmp = -y;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -8000.0) or not (y <= 0.0009):
		tmp = -y
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -8000.0) || !(y <= 0.0009))
		tmp = Float64(-y);
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -8000.0) || ~((y <= 0.0009)))
		tmp = -y;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -8000.0], N[Not[LessEqual[y, 0.0009]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8000 \lor \neg \left(y \leq 0.0009\right):\\
\;\;\;\;-y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8e3 or 8.9999999999999998e-4 < y

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in99.9%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity99.9%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+100.0%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. distribute-lft-in100.0%

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

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{-1 \cdot y}\right) \]
      3. mul-1-neg100.0%

        \[\leadsto 1 + \left(y \cdot x + \color{blue}{\left(-y\right)}\right) \]
    6. Applied egg-rr100.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot y} \]
    9. Step-by-step derivation
      1. neg-mul-147.9%

        \[\leadsto \color{blue}{-y} \]
    10. Simplified47.9%

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

    if -8e3 < y < 8.9999999999999998e-4

    1. Initial program 57.1%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Step-by-step derivation
      1. +-commutative57.1%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) + x} \]
      2. remove-double-neg57.1%

        \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
      3. unsub-neg57.1%

        \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
      4. sub-neg57.1%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(1 + \left(-y\right)\right)} - \left(-x\right) \]
      5. +-commutative57.1%

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in57.1%

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
      7. *-lft-identity57.1%

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+79.9%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
      9. associate--l-100.0%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
      14. distribute-lft-neg-out100.0%

        \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
      15. distribute-rgt-neg-in100.0%

        \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
      16. neg-sub0100.0%

        \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
      17. associate--r-100.0%

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 75.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8000 \lor \neg \left(y \leq 0.0009\right):\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 38.0% 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 77.1%

    \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
  2. Step-by-step derivation
    1. +-commutative77.1%

      \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) + x} \]
    2. remove-double-neg77.1%

      \[\leadsto \left(1 - x\right) \cdot \left(1 - y\right) + \color{blue}{\left(-\left(-x\right)\right)} \]
    3. unsub-neg77.1%

      \[\leadsto \color{blue}{\left(1 - x\right) \cdot \left(1 - y\right) - \left(-x\right)} \]
    4. sub-neg77.1%

      \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(1 + \left(-y\right)\right)} - \left(-x\right) \]
    5. +-commutative77.1%

      \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
    6. distribute-rgt-in77.1%

      \[\leadsto \color{blue}{\left(\left(-y\right) \cdot \left(1 - x\right) + 1 \cdot \left(1 - x\right)\right)} - \left(-x\right) \]
    7. *-lft-identity77.1%

      \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
    8. associate--l+89.3%

      \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + \left(\left(1 - x\right) - \left(-x\right)\right)} \]
    9. associate--l-100.0%

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

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

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

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

      \[\leadsto \color{blue}{1 + \left(-y\right) \cdot \left(1 - x\right)} \]
    14. distribute-lft-neg-out100.0%

      \[\leadsto 1 + \color{blue}{\left(-y \cdot \left(1 - x\right)\right)} \]
    15. distribute-rgt-neg-in100.0%

      \[\leadsto 1 + \color{blue}{y \cdot \left(-\left(1 - x\right)\right)} \]
    16. neg-sub0100.0%

      \[\leadsto 1 + y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} \]
    17. associate--r-100.0%

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

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

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

    \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 41.4%

    \[\leadsto \color{blue}{1} \]
  6. Add Preprocessing

Developer target: 100.0% accurate, 1.3× speedup?

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

\\
y \cdot x - \left(y - 1\right)
\end{array}

Reproduce

?
herbie shell --seed 2024110 
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
  :precision binary64

  :alt
  (- (* y x) (- y 1.0))

  (+ x (* (- 1.0 x) (- 1.0 y))))