Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3

Percentage Accurate: 98.0% → 100.0%
Time: 4.1s
Alternatives: 7
Speedup: 1.4×

Specification

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

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

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

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

Alternative 1: 100.0% accurate, 1.4× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{\left(y + z\right) \cdot x} + -1 \cdot z \]
    3. lower-fma.f64N/A

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{z + y}, x, -1 \cdot z\right) \]
    5. lower-+.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{z + y}, x, -1 \cdot z\right) \]
    6. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(z + y, x, \color{blue}{\mathsf{neg}\left(z\right)}\right) \]
    7. lower-neg.f64100.0

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

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

Alternative 2: 84.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \lor \neg \left(x \leq 7.8 \cdot 10^{-11}\right):\\
\;\;\;\;\left(z + y\right) \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.2999999999999998 or 7.80000000000000021e-11 < x

    1. Initial program 93.5%

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

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

        \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
      2. lower-*.f64N/A

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

        \[\leadsto \color{blue}{\left(z + y\right)} \cdot x \]
      4. lower-+.f6498.9

        \[\leadsto \color{blue}{\left(z + y\right)} \cdot x \]
    5. Applied rewrites98.9%

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

    if -2.2999999999999998 < x < 7.80000000000000021e-11

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\left(x - 1\right) \cdot z} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(x - 1\right) \cdot z} \]
      3. lower--.f6475.6

        \[\leadsto \color{blue}{\left(x - 1\right)} \cdot z \]
    5. Applied rewrites75.6%

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

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

Alternative 3: 84.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-40} \lor \neg \left(x \leq 6.8 \cdot 10^{-12}\right):\\
\;\;\;\;\left(z + y\right) \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.5000000000000006e-40 or 6.8000000000000001e-12 < x

    1. Initial program 93.9%

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

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

        \[\leadsto \color{blue}{\left(y + z\right) \cdot x} \]
      2. lower-*.f64N/A

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

        \[\leadsto \color{blue}{\left(z + y\right)} \cdot x \]
      4. lower-+.f6496.0

        \[\leadsto \color{blue}{\left(z + y\right)} \cdot x \]
    5. Applied rewrites96.0%

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

    if -9.5000000000000006e-40 < x < 6.8000000000000001e-12

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
      2. lower-neg.f6476.5

        \[\leadsto \color{blue}{-z} \]
    5. Applied rewrites76.5%

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

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

Alternative 4: 61.0% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.46 \lor \neg \left(x \leq 6.8 \cdot 10^{-12}\right):\\
\;\;\;\;y \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.46000000000000002 or 6.8000000000000001e-12 < x

    1. Initial program 93.5%

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

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

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

        \[\leadsto \color{blue}{\left(y + z\right) \cdot x} + -1 \cdot z \]
      3. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + y}, x, -1 \cdot z\right) \]
      5. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + y}, x, -1 \cdot z\right) \]
      6. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z + y, x, \color{blue}{\mathsf{neg}\left(z\right)}\right) \]
      7. lower-neg.f64100.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + y, x, -z\right)} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{x \cdot y} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{y \cdot x} \]
    8. Applied rewrites58.6%

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

    if -0.46000000000000002 < x < 6.8000000000000001e-12

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
      2. lower-neg.f6473.9

        \[\leadsto \color{blue}{-z} \]
    5. Applied rewrites73.9%

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

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

Alternative 5: 60.9% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

        \[\leadsto \color{blue}{\left(x - 1\right) \cdot z} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(x - 1\right) \cdot z} \]
      3. lower--.f6444.9

        \[\leadsto \color{blue}{\left(x - 1\right)} \cdot z \]
    5. Applied rewrites44.9%

      \[\leadsto \color{blue}{\left(x - 1\right) \cdot z} \]
    6. Taylor expanded in x around inf

      \[\leadsto x \cdot \color{blue}{z} \]
    7. Step-by-step derivation
      1. Applied rewrites44.5%

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

      if -72000 < x < 1

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{-1 \cdot z} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
        2. lower-neg.f6471.1

          \[\leadsto \color{blue}{-z} \]
      5. Applied rewrites71.1%

        \[\leadsto \color{blue}{-z} \]
    8. Recombined 2 regimes into one program.
    9. Final simplification57.1%

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

    Alternative 6: 36.5% accurate, 5.7× speedup?

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

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
      2. lower-neg.f6435.1

        \[\leadsto \color{blue}{-z} \]
    5. Applied rewrites35.1%

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

    Alternative 7: 2.6% accurate, 17.0× speedup?

    \[\begin{array}{l} \\ z \end{array} \]
    (FPCore (x y z) :precision binary64 z)
    double code(double x, double y, double z) {
    	return z;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        code = z
    end function
    
    public static double code(double x, double y, double z) {
    	return z;
    }
    
    def code(x, y, z):
    	return z
    
    function code(x, y, z)
    	return z
    end
    
    function tmp = code(x, y, z)
    	tmp = z;
    end
    
    code[x_, y_, z_] := z
    
    \begin{array}{l}
    
    \\
    z
    \end{array}
    
    Derivation
    1. Initial program 96.4%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
      2. lower-neg.f6435.1

        \[\leadsto \color{blue}{-z} \]
    5. Applied rewrites35.1%

      \[\leadsto \color{blue}{-z} \]
    6. Step-by-step derivation
      1. Applied rewrites2.6%

        \[\leadsto z \]
      2. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2024313 
      (FPCore (x y z)
        :name "Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3"
        :precision binary64
        (+ (* x y) (* (- x 1.0) z)))