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

Percentage Accurate: 77.8% → 100.0%
Time: 8.2s
Alternatives: 6
Speedup: 1.5×

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 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 77.8% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y, x, 1\right) - y \end{array} \]
(FPCore (x y) :precision binary64 (- (fma y x 1.0) y))
double code(double x, double y) {
	return fma(y, x, 1.0) - y;
}
function code(x, y)
	return Float64(fma(y, x, 1.0) - y)
end
code[x_, y_] := N[(N[(y * x + 1.0), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y, x, 1\right) - y
\end{array}
Derivation
  1. Initial program 78.2%

    \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\left(1 + x \cdot \left(1 + -1 \cdot \left(1 - y\right)\right)\right) - y} \]
  4. Step-by-step derivation
    1. lower--.f64N/A

      \[\leadsto \color{blue}{\left(1 + x \cdot \left(1 + -1 \cdot \left(1 - y\right)\right)\right) - y} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{\left(x \cdot \left(1 + -1 \cdot \left(1 - y\right)\right) + 1\right)} - y \]
    3. *-commutativeN/A

      \[\leadsto \left(\color{blue}{\left(1 + -1 \cdot \left(1 - y\right)\right) \cdot x} + 1\right) - y \]
    4. mul-1-negN/A

      \[\leadsto \left(\left(1 + \color{blue}{\left(\mathsf{neg}\left(\left(1 - y\right)\right)\right)}\right) \cdot x + 1\right) - y \]
    5. unsub-negN/A

      \[\leadsto \left(\color{blue}{\left(1 - \left(1 - y\right)\right)} \cdot x + 1\right) - y \]
    6. associate--r-N/A

      \[\leadsto \left(\color{blue}{\left(\left(1 - 1\right) + y\right)} \cdot x + 1\right) - y \]
    7. metadata-evalN/A

      \[\leadsto \left(\left(\color{blue}{0} + y\right) \cdot x + 1\right) - y \]
    8. +-lft-identityN/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, 1\right)} - y \]
  5. Applied rewrites100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, 1\right) - y} \]
  6. Add Preprocessing

Alternative 2: 88.5% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := x + \left(1 - x\right) \cdot \left(1 - y\right)\\
t_1 := x \cdot y - y\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+14}:\\
\;\;\;\;1 - y\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < -2e20 or 5e14 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y)))

    1. Initial program 99.5%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(1 - x\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-1 \cdot y\right) \cdot \left(1 - x\right)} \]
      2. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(1 - x\right) \]
      3. sub-negN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right)} \]
      5. distribute-lft-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(y\right)\right) \cdot 1} \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) - y \cdot 1} \]
      7. *-rgt-identityN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) - \color{blue}{y} \]
      8. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) - y} \]
      9. distribute-rgt-neg-outN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot x\right)\right)} - y \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) \cdot x} - y \]
      11. remove-double-negN/A

        \[\leadsto \color{blue}{y} \cdot x - y \]
      12. lower-*.f64100.0

        \[\leadsto \color{blue}{y \cdot x} - y \]
    5. Applied rewrites100.0%

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

    if -2e20 < (+.f64 x (*.f64 (-.f64 #s(literal 1 binary64) x) (-.f64 #s(literal 1 binary64) y))) < 5e14

    1. Initial program 61.0%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1 - y} \]
    4. Step-by-step derivation
      1. lower--.f6482.4

        \[\leadsto \color{blue}{1 - y} \]
    5. Applied rewrites82.4%

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

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

Alternative 3: 86.2% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 54.7%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \left(1 - y\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(1 + -1 \cdot \left(1 - y\right)\right) \cdot x} \]
      2. mul-1-negN/A

        \[\leadsto \left(1 + \color{blue}{\left(\mathsf{neg}\left(\left(1 - y\right)\right)\right)}\right) \cdot x \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(1 - \left(1 - y\right)\right)} \cdot x \]
      4. associate--r-N/A

        \[\leadsto \color{blue}{\left(\left(1 - 1\right) + y\right)} \cdot x \]
      5. metadata-evalN/A

        \[\leadsto \left(\color{blue}{0} + y\right) \cdot x \]
      6. +-lft-identityN/A

        \[\leadsto \color{blue}{y} \cdot x \]
      7. lower-*.f6477.6

        \[\leadsto \color{blue}{y \cdot x} \]
    5. Applied rewrites77.6%

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

    if -5.29999999999999961e78 < x < 3.4e28

    1. Initial program 94.2%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1 - y} \]
    4. Step-by-step derivation
      1. lower--.f6493.9

        \[\leadsto \color{blue}{1 - y} \]
    5. Applied rewrites93.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.3 \cdot 10^{+78}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{+28}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 61.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -28000000000000:\\ \;\;\;\;-y\\ \mathbf{elif}\;y \leq 0.0145:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -28000000000000.0) (- y) (if (<= y 0.0145) 1.0 (- y))))
double code(double x, double y) {
	double tmp;
	if (y <= -28000000000000.0) {
		tmp = -y;
	} else if (y <= 0.0145) {
		tmp = 1.0;
	} 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 <= (-28000000000000.0d0)) then
        tmp = -y
    else if (y <= 0.0145d0) then
        tmp = 1.0d0
    else
        tmp = -y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -28000000000000.0) {
		tmp = -y;
	} else if (y <= 0.0145) {
		tmp = 1.0;
	} else {
		tmp = -y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -28000000000000.0:
		tmp = -y
	elif y <= 0.0145:
		tmp = 1.0
	else:
		tmp = -y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -28000000000000.0)
		tmp = Float64(-y);
	elseif (y <= 0.0145)
		tmp = 1.0;
	else
		tmp = Float64(-y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -28000000000000.0)
		tmp = -y;
	elseif (y <= 0.0145)
		tmp = 1.0;
	else
		tmp = -y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -28000000000000.0], (-y), If[LessEqual[y, 0.0145], 1.0, (-y)]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -28000000000000:\\
\;\;\;\;-y\\

\mathbf{elif}\;y \leq 0.0145:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.8e13 or 0.0145000000000000007 < y

    1. Initial program 99.9%

      \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(1 - x\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-1 \cdot y\right) \cdot \left(1 - x\right)} \]
      2. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(1 - x\right) \]
      3. sub-negN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right)} \]
      5. distribute-lft-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) + \left(\mathsf{neg}\left(y\right)\right) \cdot 1} \]
      6. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) - y \cdot 1} \]
      7. *-rgt-identityN/A

        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) - \color{blue}{y} \]
      8. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right) - y} \]
      9. distribute-rgt-neg-outN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot x\right)\right)} - y \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) \cdot x} - y \]
      11. remove-double-negN/A

        \[\leadsto \color{blue}{y} \cdot x - y \]
      12. lower-*.f6499.1

        \[\leadsto \color{blue}{y \cdot x} - y \]
    5. Applied rewrites99.1%

      \[\leadsto \color{blue}{y \cdot x - y} \]
    6. Taylor expanded in x around 0

      \[\leadsto -1 \cdot \color{blue}{y} \]
    7. Step-by-step derivation
      1. Applied rewrites46.9%

        \[\leadsto -y \]

      if -2.8e13 < y < 0.0145000000000000007

      1. Initial program 60.7%

        \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{1} \]
      4. Step-by-step derivation
        1. Applied rewrites79.2%

          \[\leadsto \color{blue}{1} \]
      5. Recombined 2 regimes into one program.
      6. Add Preprocessing

      Alternative 5: 63.2% accurate, 3.8× speedup?

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

        \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{1 - y} \]
      4. Step-by-step derivation
        1. lower--.f6465.5

          \[\leadsto \color{blue}{1 - y} \]
      5. Applied rewrites65.5%

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

      Alternative 6: 38.2% accurate, 15.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 78.2%

        \[x + \left(1 - x\right) \cdot \left(1 - y\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{1} \]
      4. Step-by-step derivation
        1. Applied rewrites44.9%

          \[\leadsto \color{blue}{1} \]
        2. 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 2024219 
        (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))))