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

Percentage Accurate: 98.0% → 100.0%
Time: 3.4s
Alternatives: 6
Speedup: 1.3×

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 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: 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.3× speedup?

\[\begin{array}{l} \\ x \cdot \left(y + z\right) - z \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x (+ y z)) z))
double code(double x, double y, double z) {
	return (x * (y + z)) - 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 + z)) - z
end function
public static double code(double x, double y, double z) {
	return (x * (y + z)) - z;
}
def code(x, y, z):
	return (x * (y + z)) - z
function code(x, y, z)
	return Float64(Float64(x * Float64(y + z)) - z)
end
function tmp = code(x, y, z)
	tmp = (x * (y + z)) - z;
end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}

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

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

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

      \[\leadsto x \cdot y + z \cdot \color{blue}{\left(x + \left(-1\right)\right)} \]
    3. distribute-rgt-in95.7%

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

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

      \[\leadsto x \cdot y + \left(x \cdot z + \color{blue}{\left(-z\right)}\right) \]
    6. associate-+r+95.7%

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

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

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

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

Alternative 2: 84.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{-10} \lor \neg \left(x \leq -5.7 \cdot 10^{-34} \lor \neg \left(x \leq -6.2 \cdot 10^{-74}\right) \land x \leq 1.25 \cdot 10^{-15}\right):\\ \;\;\;\;x \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -7.8e-10)
         (not
          (or (<= x -5.7e-34) (and (not (<= x -6.2e-74)) (<= x 1.25e-15)))))
   (* x (+ y z))
   (- z)))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -7.8e-10) || !((x <= -5.7e-34) || (!(x <= -6.2e-74) && (x <= 1.25e-15)))) {
		tmp = x * (y + z);
	} 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 <= (-7.8d-10)) .or. (.not. (x <= (-5.7d-34)) .or. (.not. (x <= (-6.2d-74))) .and. (x <= 1.25d-15))) then
        tmp = x * (y + z)
    else
        tmp = -z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -7.8e-10) || !((x <= -5.7e-34) || (!(x <= -6.2e-74) && (x <= 1.25e-15)))) {
		tmp = x * (y + z);
	} else {
		tmp = -z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -7.8e-10) or not ((x <= -5.7e-34) or (not (x <= -6.2e-74) and (x <= 1.25e-15))):
		tmp = x * (y + z)
	else:
		tmp = -z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -7.8e-10) || !((x <= -5.7e-34) || (!(x <= -6.2e-74) && (x <= 1.25e-15))))
		tmp = Float64(x * Float64(y + z));
	else
		tmp = Float64(-z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -7.8e-10) || ~(((x <= -5.7e-34) || (~((x <= -6.2e-74)) && (x <= 1.25e-15)))))
		tmp = x * (y + z);
	else
		tmp = -z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.8e-10], N[Not[Or[LessEqual[x, -5.7e-34], And[N[Not[LessEqual[x, -6.2e-74]], $MachinePrecision], LessEqual[x, 1.25e-15]]]], $MachinePrecision]], N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision], (-z)]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-10} \lor \neg \left(x \leq -5.7 \cdot 10^{-34} \lor \neg \left(x \leq -6.2 \cdot 10^{-74}\right) \land x \leq 1.25 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \left(y + z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.7999999999999999e-10 or -5.69999999999999974e-34 < x < -6.2000000000000003e-74 or 1.25e-15 < x

    1. Initial program 92.2%

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

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

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

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

    if -7.7999999999999999e-10 < x < -5.69999999999999974e-34 or -6.2000000000000003e-74 < x < 1.25e-15

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg73.4%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified73.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{-10} \lor \neg \left(x \leq -5.7 \cdot 10^{-34} \lor \neg \left(x \leq -6.2 \cdot 10^{-74}\right) \land x \leq 1.25 \cdot 10^{-15}\right):\\ \;\;\;\;x \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 61.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+96}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-9}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-16}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{+98}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2.4e+96)
   (* x z)
   (if (<= x -2.4e-9)
     (* x y)
     (if (<= x 1.6e-16) (- z) (if (<= x 2.5e+98) (* x y) (* x z))))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.4e+96) {
		tmp = x * z;
	} else if (x <= -2.4e-9) {
		tmp = x * y;
	} else if (x <= 1.6e-16) {
		tmp = -z;
	} else if (x <= 2.5e+98) {
		tmp = x * y;
	} else {
		tmp = x * 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.4d+96)) then
        tmp = x * z
    else if (x <= (-2.4d-9)) then
        tmp = x * y
    else if (x <= 1.6d-16) then
        tmp = -z
    else if (x <= 2.5d+98) then
        tmp = x * y
    else
        tmp = x * z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.4e+96) {
		tmp = x * z;
	} else if (x <= -2.4e-9) {
		tmp = x * y;
	} else if (x <= 1.6e-16) {
		tmp = -z;
	} else if (x <= 2.5e+98) {
		tmp = x * y;
	} else {
		tmp = x * z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2.4e+96:
		tmp = x * z
	elif x <= -2.4e-9:
		tmp = x * y
	elif x <= 1.6e-16:
		tmp = -z
	elif x <= 2.5e+98:
		tmp = x * y
	else:
		tmp = x * z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2.4e+96)
		tmp = Float64(x * z);
	elseif (x <= -2.4e-9)
		tmp = Float64(x * y);
	elseif (x <= 1.6e-16)
		tmp = Float64(-z);
	elseif (x <= 2.5e+98)
		tmp = Float64(x * y);
	else
		tmp = Float64(x * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2.4e+96)
		tmp = x * z;
	elseif (x <= -2.4e-9)
		tmp = x * y;
	elseif (x <= 1.6e-16)
		tmp = -z;
	elseif (x <= 2.5e+98)
		tmp = x * y;
	else
		tmp = x * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2.4e+96], N[(x * z), $MachinePrecision], If[LessEqual[x, -2.4e-9], N[(x * y), $MachinePrecision], If[LessEqual[x, 1.6e-16], (-z), If[LessEqual[x, 2.5e+98], N[(x * y), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+96}:\\
\;\;\;\;x \cdot z\\

\mathbf{elif}\;x \leq -2.4 \cdot 10^{-9}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-16}:\\
\;\;\;\;-z\\

\mathbf{elif}\;x \leq 2.5 \cdot 10^{+98}:\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.39999999999999993e96 or 2.4999999999999999e98 < x

    1. Initial program 87.8%

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

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

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

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

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

    if -2.39999999999999993e96 < x < -2.4e-9 or 1.60000000000000011e-16 < x < 2.4999999999999999e98

    1. Initial program 99.9%

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

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

    if -2.4e-9 < x < 1.60000000000000011e-16

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg70.4%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified70.4%

      \[\leadsto \color{blue}{-z} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 78.7% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.50000000000000004e23 or 9.9999999999999995e32 < y

    1. Initial program 91.2%

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

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

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

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

    if -5.50000000000000004e23 < y < 9.9999999999999995e32

    1. Initial program 100.0%

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

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

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

Alternative 5: 56.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+24} \lor \neg \left(y \leq 2.4 \cdot 10^{+31}\right):\\
\;\;\;\;x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.4000000000000001e24 or 2.39999999999999982e31 < y

    1. Initial program 91.2%

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

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

    if -1.4000000000000001e24 < y < 2.39999999999999982e31

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{-1 \cdot z} \]
    4. Step-by-step derivation
      1. mul-1-neg50.3%

        \[\leadsto \color{blue}{-z} \]
    5. Simplified50.3%

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

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

Alternative 6: 36.5% accurate, 4.5× 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 95.7%

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

    \[\leadsto \color{blue}{-1 \cdot z} \]
  4. Step-by-step derivation
    1. mul-1-neg35.5%

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

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

Reproduce

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