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

Percentage Accurate: 77.8% → 100.0%
Time: 5.2s
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 75.3%

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

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

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

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

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

      \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
    6. distribute-rgt-in75.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-identity75.3%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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. Final simplification100.0%

    \[\leadsto 1 + y \cdot \left(x + -1\right) \]
  6. Add Preprocessing

Alternative 2: 61.8% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq -1.15 \cdot 10^{+241}:\\
\;\;\;\;-y\\

\mathbf{elif}\;y \leq -1.65 \cdot 10^{-50} \lor \neg \left(y \leq 6.3 \cdot 10^{-74}\right):\\
\;\;\;\;y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.00000000000000013e268 or -1.15e241 < y < -1.6499999999999999e-50 or 6.30000000000000003e-74 < y

    1. Initial program 92.3%

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

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in92.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-identity92.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 84.8%

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

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

        \[\leadsto \color{blue}{y \cdot x} \]
    8. Simplified57.2%

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

    if -9.00000000000000013e268 < y < -1.15e241

    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-+r-100.0%

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 33.6%

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \left(1 - \frac{1}{x}\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative33.4%

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(x + \left(-\frac{1}{x}\right) \cdot x\right)} \]
      6. distribute-lft-neg-out99.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y} \]
    11. Simplified86.8%

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

    if -1.6499999999999999e-50 < y < 6.30000000000000003e-74

    1. Initial program 50.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 81.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+268}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq -1.15 \cdot 10^{+241}:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq -1.65 \cdot 10^{-50} \lor \neg \left(y \leq 6.3 \cdot 10^{-74}\right):\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.7% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) y) < -5.00000000000000003e40 or 2 < (-.f64 #s(literal 1 binary64) y)

    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-+r-100.0%

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 78.9%

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \left(1 - \frac{1}{x}\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative78.3%

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

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

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

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

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

        \[\leadsto y \cdot \left(x + \color{blue}{\left(-\frac{1}{x} \cdot x\right)}\right) \]
      7. lft-mult-inverse99.4%

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

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

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

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

    if -5.00000000000000003e40 < (-.f64 #s(literal 1 binary64) y) < 2

    1. Initial program 51.7%

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

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in51.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-identity51.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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.8%

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

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

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

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

Alternative 4: 86.7% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.85e-50 or 21 < y

    1. Initial program 96.3%

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

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in96.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-identity96.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 80.8%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(x + \color{blue}{\left(-\frac{1}{x} \cdot x\right)}\right) \]
      7. lft-mult-inverse96.8%

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

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

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

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

    if -1.85e-50 < y < 21

    1. Initial program 51.0%

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

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in51.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-identity51.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 78.9%

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

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

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

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

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

Alternative 5: 86.7% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.99999999999999946e48 or 450 < x

    1. Initial program 54.0%

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

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in54.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-identity54.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 99.9%

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

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

        \[\leadsto \color{blue}{y \cdot x} \]
    8. Simplified74.8%

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

    if -9.99999999999999946e48 < x < 450

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 96.4%

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

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

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

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

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

Alternative 6: 62.1% accurate, 0.7× speedup?

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

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

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


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

    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-+r-100.0%

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 79.3%

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \left(1 - \frac{1}{x}\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative78.7%

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

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

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

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

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

        \[\leadsto y \cdot \left(x + \color{blue}{\left(-\frac{1}{x} \cdot x\right)}\right) \]
      7. lft-mult-inverse99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{-y} \]
    11. Simplified44.7%

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

    if -1 < y < 4.4e12

    1. Initial program 50.9%

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

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

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

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

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

        \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
      6. distribute-rgt-in50.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-identity50.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 74.6%

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

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

Alternative 7: 39.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 75.3%

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

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

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

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

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

      \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(-y\right) + 1\right)} - \left(-x\right) \]
    6. distribute-rgt-in75.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-identity75.3%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-y\right) \cdot \left(1 - x\right) + 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 38.9%

    \[\leadsto \color{blue}{1} \]
  6. Final simplification38.9%

    \[\leadsto 1 \]
  7. 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 2024115 
(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))))