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

Percentage Accurate: 77.1% → 100.0%
Time: 7.0s
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.1% 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 71.5%

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

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

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

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

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

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

      \[\leadsto \left(\left(-y\right) \cdot \left(1 - x\right) + \color{blue}{\left(1 - x\right)}\right) - \left(-x\right) \]
    8. associate--l+86.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 2: 61.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-71}:\\
\;\;\;\;y \cdot x\\

\mathbf{elif}\;y \leq 2 \cdot 10^{-79}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 1.35 \cdot 10^{+181}:\\
\;\;\;\;y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.99999999999999998e-71 or 2e-79 < y < 1.35000000000000004e181

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999998e-71 < y < 2e-79

    1. Initial program 48.8%

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

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

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

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

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

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

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

        \[\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.3%

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

    if 1.35000000000000004e181 < 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--l+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{y} + y \cdot \left(-\frac{1}{x}\right)\right) \]
      4. distribute-rgt-neg-out70.1%

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

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

        \[\leadsto x \cdot \left(y + \left(-\frac{\color{blue}{y}}{x}\right)\right) \]
      7. neg-mul-170.1%

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

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

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

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

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

        \[\leadsto \color{blue}{-y} \]
    11. Simplified62.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-71}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-79}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+181}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.8% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.2e10 or 1 < x

    1. Initial program 48.7%

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

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

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

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

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

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

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

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

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

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

    if -6.2e10 < x < 1

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 85.6% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.9999999999999995e-73 or 8.49999999999999939e-80 < y

    1. Initial program 88.1%

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

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

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

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

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

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

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

      \[\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 x \cdot \color{blue}{\left(y \cdot \left(1 - \frac{1}{x}\right)\right)} \]
    7. Step-by-step derivation
      1. sub-neg78.3%

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

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

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

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

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

        \[\leadsto x \cdot \left(y + \left(-\frac{\color{blue}{y}}{x}\right)\right) \]
      7. neg-mul-178.3%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot y + x \cdot y} \]
    10. Step-by-step derivation
      1. distribute-rgt-out92.9%

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

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

    if -6.9999999999999995e-73 < y < 8.49999999999999939e-80

    1. Initial program 48.8%

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

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

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

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

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

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

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

        \[\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.3%

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

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

Alternative 5: 86.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+15} \lor \neg \left(x \leq 9.6 \cdot 10^{+20}\right):\\
\;\;\;\;y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3e15 or 9.6e20 < x

    1. Initial program 47.6%

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

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

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

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

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

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

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

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

    if -3e15 < x < 9.6e20

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 61.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1300000000\right):\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -1.0) (not (<= y 1300000000.0))) (- y) 1.0))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.0) || !(y <= 1300000000.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 <= 1300000000.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 <= 1300000000.0)) {
		tmp = -y;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -1.0) or not (y <= 1300000000.0):
		tmp = -y
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -1.0) || !(y <= 1300000000.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 <= 1300000000.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, 1300000000.0]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1.3e9 < 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--l+100.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{1 + y \cdot \left(x + -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 81.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 80.7%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(y + \left(-\frac{\color{blue}{y}}{x}\right)\right) \]
      7. neg-mul-180.7%

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

        \[\leadsto x \cdot \left(y + \color{blue}{\left(-\frac{y}{x}\right)}\right) \]
      9. unsub-neg80.7%

        \[\leadsto x \cdot \color{blue}{\left(y - \frac{y}{x}\right)} \]
    8. Simplified80.7%

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

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

        \[\leadsto \color{blue}{-y} \]
    11. Simplified47.1%

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

    if -1 < y < 1.3e9

    1. Initial program 46.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 38.7% 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 71.5%

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

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

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

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

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

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

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

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

Developer Target 1: 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 2024137 
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
  :precision binary64

  :alt
  (! :herbie-platform default (- (* y x) (- y 1)))

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