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

Percentage Accurate: 78.5% → 100.0%
Time: 5.5s
Alternatives: 9
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 9 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: 78.5% 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} \\ \left(1 + x \cdot y\right) - y \end{array} \]
(FPCore (x y) :precision binary64 (- (+ 1.0 (* x y)) y))
double code(double x, double y) {
	return (1.0 + (x * y)) - y;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (1.0d0 + (x * y)) - y
end function
public static double code(double x, double y) {
	return (1.0 + (x * y)) - y;
}
def code(x, y):
	return (1.0 + (x * y)) - y
function code(x, y)
	return Float64(Float64(1.0 + Float64(x * y)) - y)
end
function tmp = code(x, y)
	tmp = (1.0 + (x * y)) - y;
end
code[x_, y_] := N[(N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

      \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
    8. associate--l+88.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. Step-by-step derivation
    1. distribute-lft-in100.0%

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

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

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

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

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

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

Alternative 2: 61.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{+129}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{+86}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -9500:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -3.55 \cdot 10^{-65}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-162}:\\ \;\;\;\;-y\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+62}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -2.7e+129)
   (* x y)
   (if (<= x -2.3e+86)
     1.0
     (if (<= x -9500.0)
       (* x y)
       (if (<= x -3.55e-65)
         1.0
         (if (<= x 2.8e-162) (- y) (if (<= x 3.7e+62) 1.0 (* x y))))))))
double code(double x, double y) {
	double tmp;
	if (x <= -2.7e+129) {
		tmp = x * y;
	} else if (x <= -2.3e+86) {
		tmp = 1.0;
	} else if (x <= -9500.0) {
		tmp = x * y;
	} else if (x <= -3.55e-65) {
		tmp = 1.0;
	} else if (x <= 2.8e-162) {
		tmp = -y;
	} else if (x <= 3.7e+62) {
		tmp = 1.0;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-2.7d+129)) then
        tmp = x * y
    else if (x <= (-2.3d+86)) then
        tmp = 1.0d0
    else if (x <= (-9500.0d0)) then
        tmp = x * y
    else if (x <= (-3.55d-65)) then
        tmp = 1.0d0
    else if (x <= 2.8d-162) then
        tmp = -y
    else if (x <= 3.7d+62) then
        tmp = 1.0d0
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.7e+129) {
		tmp = x * y;
	} else if (x <= -2.3e+86) {
		tmp = 1.0;
	} else if (x <= -9500.0) {
		tmp = x * y;
	} else if (x <= -3.55e-65) {
		tmp = 1.0;
	} else if (x <= 2.8e-162) {
		tmp = -y;
	} else if (x <= 3.7e+62) {
		tmp = 1.0;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -2.7e+129:
		tmp = x * y
	elif x <= -2.3e+86:
		tmp = 1.0
	elif x <= -9500.0:
		tmp = x * y
	elif x <= -3.55e-65:
		tmp = 1.0
	elif x <= 2.8e-162:
		tmp = -y
	elif x <= 3.7e+62:
		tmp = 1.0
	else:
		tmp = x * y
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -2.7e+129)
		tmp = Float64(x * y);
	elseif (x <= -2.3e+86)
		tmp = 1.0;
	elseif (x <= -9500.0)
		tmp = Float64(x * y);
	elseif (x <= -3.55e-65)
		tmp = 1.0;
	elseif (x <= 2.8e-162)
		tmp = Float64(-y);
	elseif (x <= 3.7e+62)
		tmp = 1.0;
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.7e+129)
		tmp = x * y;
	elseif (x <= -2.3e+86)
		tmp = 1.0;
	elseif (x <= -9500.0)
		tmp = x * y;
	elseif (x <= -3.55e-65)
		tmp = 1.0;
	elseif (x <= 2.8e-162)
		tmp = -y;
	elseif (x <= 3.7e+62)
		tmp = 1.0;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -2.7e+129], N[(x * y), $MachinePrecision], If[LessEqual[x, -2.3e+86], 1.0, If[LessEqual[x, -9500.0], N[(x * y), $MachinePrecision], If[LessEqual[x, -3.55e-65], 1.0, If[LessEqual[x, 2.8e-162], (-y), If[LessEqual[x, 3.7e+62], 1.0, N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -2.3 \cdot 10^{+86}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq -9500:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \leq -3.55 \cdot 10^{-65}:\\
\;\;\;\;1\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-162}:\\
\;\;\;\;-y\\

\mathbf{elif}\;x \leq 3.7 \cdot 10^{+62}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.7000000000000001e129 or -2.2999999999999999e86 < x < -9500 or 3.70000000000000014e62 < x

    1. Initial program 54.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + y \cdot x\right) + \left(-y\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 -2.7000000000000001e129 < x < -2.2999999999999999e86 or -9500 < x < -3.55000000000000014e-65 or 2.80000000000000022e-162 < x < 3.70000000000000014e62

    1. Initial program 82.0%

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

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

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

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

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

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

        \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
      8. associate--l+82.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 y around 0 69.8%

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

    if -3.55000000000000014e-65 < x < 2.80000000000000022e-162

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y} \]
    10. Simplified67.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{+129}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{+86}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -9500:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq -3.55 \cdot 10^{-65}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-162}:\\ \;\;\;\;-y\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+62}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 85.5% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+129} \lor \neg \left(x \leq -1.22 \cdot 10^{+86} \lor \neg \left(x \leq -110000\right) \land x \leq 2.8 \cdot 10^{+65}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.7000000000000001e129 or -1.21999999999999996e86 < x < -1.1e5 or 2.7999999999999999e65 < x

    1. Initial program 54.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + y \cdot x\right) + \left(-y\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 -2.7000000000000001e129 < x < -1.21999999999999996e86 or -1.1e5 < x < 2.7999999999999999e65

    1. Initial program 91.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{+129} \lor \neg \left(x \leq -1.22 \cdot 10^{+86} \lor \neg \left(x \leq -110000\right) \land x \leq 2.8 \cdot 10^{+65}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;1 - y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;1 - y \leq -2000000000 \lor \neg \left(1 - y \leq 1.001\right):\\
\;\;\;\;y \cdot \left(x + -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) y) < -2e9 or 1.0009999999999999 < (-.f64 #s(literal 1 binary64) 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. associate-+r+100.0%

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

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

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

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

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

    if -2e9 < (-.f64 #s(literal 1 binary64) y) < 1.0009999999999999

    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+78.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 inf 99.3%

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

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

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

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

Alternative 5: 98.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;1 - y \leq -2000000000:\\
\;\;\;\;x \cdot y - y\\

\mathbf{elif}\;1 - y \leq 1.001:\\
\;\;\;\;1 + x \cdot y\\

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


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

    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+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. associate-+r+100.0%

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(x - 1\right)} \]
    8. Step-by-step derivation
      1. distribute-rgt-out--99.4%

        \[\leadsto \color{blue}{x \cdot y - 1 \cdot y} \]
      2. *-commutative99.4%

        \[\leadsto \color{blue}{y \cdot x} - 1 \cdot y \]
      3. *-un-lft-identity99.4%

        \[\leadsto y \cdot x - \color{blue}{y} \]
    9. Applied egg-rr99.4%

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

    if -2e9 < (-.f64 #s(literal 1 binary64) y) < 1.0009999999999999

    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+78.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 inf 99.3%

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

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

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

    if 1.0009999999999999 < (-.f64 #s(literal 1 binary64) y)

    1. Initial program 99.8%

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

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

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

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

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

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

        \[\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. associate-+r+100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - y \leq -2000000000:\\ \;\;\;\;x \cdot y - y\\ \mathbf{elif}\;1 - y \leq 1.001:\\ \;\;\;\;1 + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 87.6% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.7999999999999999e-27 or 2.0499999999999999e-26 < y

    1. Initial program 95.7%

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

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

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

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

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

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

        \[\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. associate-+r+100.0%

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

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

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

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

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

    if -1.7999999999999999e-27 < y < 2.0499999999999999e-26

    1. Initial program 55.1%

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

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

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

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

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

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

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

        \[\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 78.8%

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

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

Alternative 7: 61.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 6.5 \cdot 10^{-8}\right):\\
\;\;\;\;-y\\

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

        \[\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. associate-+r+100.0%

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

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

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

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

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

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

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

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

    if -1 < y < 6.49999999999999997e-8

    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.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-identity54.0%

        \[\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 73.9%

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

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

Alternative 8: 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 76.8%

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

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

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

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

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

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

      \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
    8. associate--l+88.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. Add Preprocessing

Alternative 9: 37.4% 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 76.8%

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

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

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

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

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

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

      \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
    8. associate--l+88.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 38.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 2024096 
(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))))