Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D

Percentage Accurate: 99.5% → 99.7%
Time: 9.9s
Alternatives: 14
Speedup: 1.2×

Specification

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

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\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 14 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: 99.5% accurate, 1.0× speedup?

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

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}

Alternative 1: 99.7% accurate, 0.1× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. +-commutative99.6%

      \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
    2. associate-*l*99.8%

      \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
    3. fma-define99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
    4. sub-neg99.9%

      \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
    5. +-commutative99.9%

      \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
    6. distribute-lft-in99.9%

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
    7. distribute-rgt-neg-out99.9%

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
    8. *-commutative99.9%

      \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
    9. distribute-rgt-neg-in99.9%

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
    10. fma-define99.8%

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
    11. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
    12. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
    13. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
  3. Simplified99.8%

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

Alternative 2: 50.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -2.8 \cdot 10^{+177}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{+141}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -60000000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-86}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+87} \lor \neg \left(z \leq 1.1 \cdot 10^{+157}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))) (t_1 (* -6.0 (* y z))))
   (if (<= z -2.8e+177)
     t_0
     (if (<= z -2.8e+141)
       t_1
       (if (<= z -60000000000000.0)
         t_0
         (if (<= z 2.6e-86)
           (* y 4.0)
           (if (<= z 0.5)
             (* x -3.0)
             (if (or (<= z 7e+87) (not (<= z 1.1e+157))) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -2.8e+177) {
		tmp = t_0;
	} else if (z <= -2.8e+141) {
		tmp = t_1;
	} else if (z <= -60000000000000.0) {
		tmp = t_0;
	} else if (z <= 2.6e-86) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if ((z <= 7e+87) || !(z <= 1.1e+157)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (z * 6.0d0)
    t_1 = (-6.0d0) * (y * z)
    if (z <= (-2.8d+177)) then
        tmp = t_0
    else if (z <= (-2.8d+141)) then
        tmp = t_1
    else if (z <= (-60000000000000.0d0)) then
        tmp = t_0
    else if (z <= 2.6d-86) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if ((z <= 7d+87) .or. (.not. (z <= 1.1d+157))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -2.8e+177) {
		tmp = t_0;
	} else if (z <= -2.8e+141) {
		tmp = t_1;
	} else if (z <= -60000000000000.0) {
		tmp = t_0;
	} else if (z <= 2.6e-86) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if ((z <= 7e+87) || !(z <= 1.1e+157)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	t_1 = -6.0 * (y * z)
	tmp = 0
	if z <= -2.8e+177:
		tmp = t_0
	elif z <= -2.8e+141:
		tmp = t_1
	elif z <= -60000000000000.0:
		tmp = t_0
	elif z <= 2.6e-86:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.0
	elif (z <= 7e+87) or not (z <= 1.1e+157):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	t_1 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -2.8e+177)
		tmp = t_0;
	elseif (z <= -2.8e+141)
		tmp = t_1;
	elseif (z <= -60000000000000.0)
		tmp = t_0;
	elseif (z <= 2.6e-86)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif ((z <= 7e+87) || !(z <= 1.1e+157))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	t_1 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -2.8e+177)
		tmp = t_0;
	elseif (z <= -2.8e+141)
		tmp = t_1;
	elseif (z <= -60000000000000.0)
		tmp = t_0;
	elseif (z <= 2.6e-86)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif ((z <= 7e+87) || ~((z <= 1.1e+157)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.8e+177], t$95$0, If[LessEqual[z, -2.8e+141], t$95$1, If[LessEqual[z, -60000000000000.0], t$95$0, If[LessEqual[z, 2.6e-86], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[Or[LessEqual[z, 7e+87], N[Not[LessEqual[z, 1.1e+157]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
t_1 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+177}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -2.8 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -60000000000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{-86}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 7 \cdot 10^{+87} \lor \neg \left(z \leq 1.1 \cdot 10^{+157}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.80000000000000002e177 or -2.79999999999999991e141 < z < -6e13 or 0.5 < z < 6.99999999999999972e87 or 1.1000000000000001e157 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 68.8%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative68.8%

        \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
      2. sub-neg68.8%

        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
      3. distribute-rgt-in68.8%

        \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
      4. metadata-eval68.8%

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*68.8%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative68.8%

        \[\leadsto x \cdot \left(\left(-4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
      8. metadata-eval68.8%

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in68.8%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative68.8%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in68.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(4 \cdot -1 + \left(-6 \cdot z\right) \cdot -1\right)}\right) \]
      12. metadata-eval68.8%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+68.8%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      14. metadata-eval68.8%

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative68.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*68.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval68.8%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified68.8%

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

      \[\leadsto x \cdot \color{blue}{\left(6 \cdot z\right)} \]
    7. Step-by-step derivation
      1. *-commutative67.7%

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
    8. Simplified67.7%

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

    if -2.80000000000000002e177 < z < -2.79999999999999991e141 or 6.99999999999999972e87 < z < 1.1000000000000001e157

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.7%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.7%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.7%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 85.5%

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

      \[\leadsto \color{blue}{-6 \cdot \left(y \cdot z\right)} \]

    if -6e13 < z < 2.6000000000000001e-86

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.4%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.9%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 65.6%

      \[\leadsto \color{blue}{y \cdot \left(4 + -6 \cdot z\right)} \]
    6. Taylor expanded in z around 0 63.8%

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

    if 2.6000000000000001e-86 < z < 0.5

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 66.6%

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

        \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
      2. sub-neg66.6%

        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
      3. distribute-rgt-in66.6%

        \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
      4. metadata-eval66.6%

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*66.6%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative66.6%

        \[\leadsto x \cdot \left(\left(-4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
      8. metadata-eval66.6%

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in66.6%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative66.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in66.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(4 \cdot -1 + \left(-6 \cdot z\right) \cdot -1\right)}\right) \]
      12. metadata-eval66.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+66.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      14. metadata-eval66.6%

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative66.6%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*66.6%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval66.6%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified66.6%

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

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutative62.5%

        \[\leadsto \color{blue}{x \cdot -3} \]
    8. Simplified62.5%

      \[\leadsto \color{blue}{x \cdot -3} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification67.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{+177}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{+141}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -60000000000000:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-86}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+87} \lor \neg \left(z \leq 1.1 \cdot 10^{+157}\right):\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 50.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -3.8 \cdot 10^{+182}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+141}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -60000000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-87}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+88} \lor \neg \left(z \leq 4.6 \cdot 10^{+156}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))) (t_1 (* -6.0 (* y z))))
   (if (<= z -3.8e+182)
     t_0
     (if (<= z -2.9e+141)
       t_1
       (if (<= z -60000000000000.0)
         t_0
         (if (<= z 1.4e-87)
           (* y 4.0)
           (if (<= z 0.5)
             (* x -3.0)
             (if (or (<= z 1.35e+88) (not (<= z 4.6e+156))) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -3.8e+182) {
		tmp = t_0;
	} else if (z <= -2.9e+141) {
		tmp = t_1;
	} else if (z <= -60000000000000.0) {
		tmp = t_0;
	} else if (z <= 1.4e-87) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if ((z <= 1.35e+88) || !(z <= 4.6e+156)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    t_1 = (-6.0d0) * (y * z)
    if (z <= (-3.8d+182)) then
        tmp = t_0
    else if (z <= (-2.9d+141)) then
        tmp = t_1
    else if (z <= (-60000000000000.0d0)) then
        tmp = t_0
    else if (z <= 1.4d-87) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if ((z <= 1.35d+88) .or. (.not. (z <= 4.6d+156))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -3.8e+182) {
		tmp = t_0;
	} else if (z <= -2.9e+141) {
		tmp = t_1;
	} else if (z <= -60000000000000.0) {
		tmp = t_0;
	} else if (z <= 1.4e-87) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if ((z <= 1.35e+88) || !(z <= 4.6e+156)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	t_1 = -6.0 * (y * z)
	tmp = 0
	if z <= -3.8e+182:
		tmp = t_0
	elif z <= -2.9e+141:
		tmp = t_1
	elif z <= -60000000000000.0:
		tmp = t_0
	elif z <= 1.4e-87:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.0
	elif (z <= 1.35e+88) or not (z <= 4.6e+156):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	t_1 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -3.8e+182)
		tmp = t_0;
	elseif (z <= -2.9e+141)
		tmp = t_1;
	elseif (z <= -60000000000000.0)
		tmp = t_0;
	elseif (z <= 1.4e-87)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif ((z <= 1.35e+88) || !(z <= 4.6e+156))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	t_1 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -3.8e+182)
		tmp = t_0;
	elseif (z <= -2.9e+141)
		tmp = t_1;
	elseif (z <= -60000000000000.0)
		tmp = t_0;
	elseif (z <= 1.4e-87)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif ((z <= 1.35e+88) || ~((z <= 4.6e+156)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.8e+182], t$95$0, If[LessEqual[z, -2.9e+141], t$95$1, If[LessEqual[z, -60000000000000.0], t$95$0, If[LessEqual[z, 1.4e-87], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[Or[LessEqual[z, 1.35e+88], N[Not[LessEqual[z, 4.6e+156]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
t_1 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{+182}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -2.9 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -60000000000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{-87}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+88} \lor \neg \left(z \leq 4.6 \cdot 10^{+156}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.80000000000000013e182 or -2.90000000000000007e141 < z < -6e13 or 0.5 < z < 1.35000000000000008e88 or 4.5999999999999998e156 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 68.8%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative68.8%

        \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
      2. sub-neg68.8%

        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
      3. distribute-rgt-in68.8%

        \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
      4. metadata-eval68.8%

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*68.8%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative68.8%

        \[\leadsto x \cdot \left(\left(-4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
      8. metadata-eval68.8%

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in68.8%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative68.8%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in68.8%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(4 \cdot -1 + \left(-6 \cdot z\right) \cdot -1\right)}\right) \]
      12. metadata-eval68.8%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+68.8%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      14. metadata-eval68.8%

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative68.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*68.8%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval68.8%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified68.8%

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

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

    if -3.80000000000000013e182 < z < -2.90000000000000007e141 or 1.35000000000000008e88 < z < 4.5999999999999998e156

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.7%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.7%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.7%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.7%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 85.5%

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

      \[\leadsto \color{blue}{-6 \cdot \left(y \cdot z\right)} \]

    if -6e13 < z < 1.4e-87

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.4%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.9%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 65.6%

      \[\leadsto \color{blue}{y \cdot \left(4 + -6 \cdot z\right)} \]
    6. Taylor expanded in z around 0 63.8%

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

    if 1.4e-87 < z < 0.5

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 66.6%

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

        \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
      2. sub-neg66.6%

        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
      3. distribute-rgt-in66.6%

        \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
      4. metadata-eval66.6%

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*66.6%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative66.6%

        \[\leadsto x \cdot \left(\left(-4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
      8. metadata-eval66.6%

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in66.6%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative66.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in66.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(4 \cdot -1 + \left(-6 \cdot z\right) \cdot -1\right)}\right) \]
      12. metadata-eval66.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+66.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      14. metadata-eval66.6%

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative66.6%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*66.6%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval66.6%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified66.6%

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

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutative62.5%

        \[\leadsto \color{blue}{x \cdot -3} \]
    8. Simplified62.5%

      \[\leadsto \color{blue}{x \cdot -3} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification67.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+182}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+141}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -60000000000000:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-87}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+88} \lor \neg \left(z \leq 4.6 \cdot 10^{+156}\right):\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 51.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -0.65:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-88}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))))
   (if (<= z -0.65)
     t_0
     (if (<= z 6.5e-88) (* y 4.0) (if (<= z 0.65) (* x -3.0) t_0)))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -0.65) {
		tmp = t_0;
	} else if (z <= 6.5e-88) {
		tmp = y * 4.0;
	} else if (z <= 0.65) {
		tmp = x * -3.0;
	} else {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    if (z <= (-0.65d0)) then
        tmp = t_0
    else if (z <= 6.5d-88) then
        tmp = y * 4.0d0
    else if (z <= 0.65d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -0.65) {
		tmp = t_0;
	} else if (z <= 6.5e-88) {
		tmp = y * 4.0;
	} else if (z <= 0.65) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	tmp = 0
	if z <= -0.65:
		tmp = t_0
	elif z <= 6.5e-88:
		tmp = y * 4.0
	elif z <= 0.65:
		tmp = x * -3.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -0.65)
		tmp = t_0;
	elseif (z <= 6.5e-88)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.65)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -0.65)
		tmp = t_0;
	elseif (z <= 6.5e-88)
		tmp = y * 4.0;
	elseif (z <= 0.65)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.65], t$95$0, If[LessEqual[z, 6.5e-88], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(x * -3.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -0.65:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-88}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.650000000000000022 or 0.650000000000000022 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.7%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.8%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.8%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.8%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 49.5%

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

      \[\leadsto \color{blue}{-6 \cdot \left(y \cdot z\right)} \]

    if -0.650000000000000022 < z < 6.50000000000000006e-88

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.4%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.9%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 65.2%

      \[\leadsto \color{blue}{y \cdot \left(4 + -6 \cdot z\right)} \]
    6. Taylor expanded in z around 0 64.3%

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

    if 6.50000000000000006e-88 < z < 0.650000000000000022

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 66.6%

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

        \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
      2. sub-neg66.6%

        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
      3. distribute-rgt-in66.6%

        \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
      4. metadata-eval66.6%

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*66.6%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative66.6%

        \[\leadsto x \cdot \left(\left(-4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
      8. metadata-eval66.6%

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in66.6%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative66.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in66.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(4 \cdot -1 + \left(-6 \cdot z\right) \cdot -1\right)}\right) \]
      12. metadata-eval66.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+66.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      14. metadata-eval66.6%

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative66.6%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*66.6%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval66.6%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified66.6%

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

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutative62.5%

        \[\leadsto \color{blue}{x \cdot -3} \]
    8. Simplified62.5%

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

Alternative 5: 97.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.65 \lor \neg \left(z \leq 0.5\right):\\
\;\;\;\;x + \left(y - x\right) \cdot \left(z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.650000000000000022 or 0.5 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutative99.7%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. metadata-eval99.7%

        \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) + x \]
    4. Applied egg-rr99.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} + x \]
    6. Step-by-step derivation
      1. *-commutative98.3%

        \[\leadsto \color{blue}{\left(z \cdot \left(y - x\right)\right) \cdot -6} + x \]
      2. *-commutative98.3%

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

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(z \cdot -6\right)} + x \]
      4. *-commutative98.4%

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

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

    if -0.650000000000000022 < z < 0.5

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.2%

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

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

Alternative 6: 97.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.65 \lor \neg \left(z \leq 0.62\right):\\
\;\;\;\;x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.650000000000000022 or 0.619999999999999996 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 98.3%

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

    if -0.650000000000000022 < z < 0.619999999999999996

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.2%

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

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

Alternative 7: 97.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.65:\\
\;\;\;\;x + z \cdot \left(\left(y - x\right) \cdot -6\right)\\

\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.650000000000000022

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 99.6%

      \[\leadsto x + \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*99.7%

        \[\leadsto x + \color{blue}{\left(-6 \cdot z\right) \cdot \left(y - x\right)} \]
      2. *-commutative99.7%

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

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

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

    if -0.650000000000000022 < z < 0.5

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.2%

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

    if 0.5 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 97.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.65:\\ \;\;\;\;x + z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 75.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{-60} \lor \neg \left(y \leq 2.8 \cdot 10^{-53}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.60000000000000038e-60 or 2.79999999999999985e-53 < y

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.6%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.9%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 79.9%

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

    if -9.60000000000000038e-60 < y < 2.79999999999999985e-53

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 83.2%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative83.2%

        \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
      2. sub-neg83.2%

        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
      3. distribute-rgt-in83.2%

        \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
      4. metadata-eval83.2%

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*83.2%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative83.2%

        \[\leadsto x \cdot \left(\left(-4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
      8. metadata-eval83.2%

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in83.2%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative83.2%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in83.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(4 \cdot -1 + \left(-6 \cdot z\right) \cdot -1\right)}\right) \]
      12. metadata-eval83.2%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+83.2%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      14. metadata-eval83.2%

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative83.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*83.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval83.2%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified83.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.6 \cdot 10^{-60} \lor \neg \left(y \leq 2.8 \cdot 10^{-53}\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 75.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-58} \lor \neg \left(y \leq 2.7 \cdot 10^{-53}\right):\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.9999999999999998e-58 or 2.6999999999999999e-53 < y

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 82.0%

      \[\leadsto \color{blue}{x \cdot \left(1 + \left(-6 \cdot \left(0.6666666666666666 - z\right) + 6 \cdot \frac{y \cdot \left(0.6666666666666666 - z\right)}{x}\right)\right)} \]
    4. Taylor expanded in x around 0 80.2%

      \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)} \]

    if -6.9999999999999998e-58 < y < 2.6999999999999999e-53

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 82.7%

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*82.7%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative82.7%

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

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in82.7%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative82.7%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in82.7%

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+82.7%

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

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative82.7%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*82.7%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval82.7%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified82.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-58} \lor \neg \left(y \leq 2.7 \cdot 10^{-53}\right):\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 59.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{-159} \lor \neg \left(y \leq 9.4 \cdot 10^{-54}\right):\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.3999999999999999e-159 or 9.4e-54 < y

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 83.3%

      \[\leadsto \color{blue}{x \cdot \left(1 + \left(-6 \cdot \left(0.6666666666666666 - z\right) + 6 \cdot \frac{y \cdot \left(0.6666666666666666 - z\right)}{x}\right)\right)} \]
    4. Taylor expanded in x around 0 76.2%

      \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)} \]

    if -6.3999999999999999e-159 < y < 9.4e-54

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 86.7%

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*86.7%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative86.7%

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

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in86.7%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative86.7%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in86.7%

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+86.7%

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

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative86.7%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*86.7%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval86.7%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified86.7%

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
    8. Simplified53.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{-159} \lor \neg \left(y \leq 9.4 \cdot 10^{-54}\right):\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 37.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-68} \lor \neg \left(y \leq 1.2 \cdot 10^{-54}\right):\\
\;\;\;\;y \cdot 4\\

\mathbf{else}:\\
\;\;\;\;x \cdot -3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.49999999999999986e-68 or 1.20000000000000007e-54 < y

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. +-commutative99.6%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.9%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-define99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. sub-neg99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. +-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\left(-z\right) + \frac{2}{3}\right)}, x\right) \]
      6. distribute-lft-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{6 \cdot \left(-z\right) + 6 \cdot \frac{2}{3}}, x\right) \]
      7. distribute-rgt-neg-out99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\left(-6 \cdot z\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      8. *-commutative99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \left(-\color{blue}{z \cdot 6}\right) + 6 \cdot \frac{2}{3}, x\right) \]
      9. distribute-rgt-neg-in99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\right)} + 6 \cdot \frac{2}{3}, x\right) \]
      10. fma-define99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\mathsf{fma}\left(z, -6, 6 \cdot \frac{2}{3}\right)}, x\right) \]
      11. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, \color{blue}{-6}, 6 \cdot \frac{2}{3}\right), x\right) \]
      12. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 6 \cdot \color{blue}{0.6666666666666666}\right), x\right) \]
      13. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, \color{blue}{4}\right), x\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 79.0%

      \[\leadsto \color{blue}{y \cdot \left(4 + -6 \cdot z\right)} \]
    6. Taylor expanded in z around 0 42.8%

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

    if -2.49999999999999986e-68 < y < 1.20000000000000007e-54

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 83.7%

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

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

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

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

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

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      6. associate-*r*83.7%

        \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      7. *-commutative83.7%

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

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
      9. distribute-lft-in83.7%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      10. +-commutative83.7%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      11. distribute-rgt-in83.7%

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
      13. associate-+r+83.7%

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

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
      15. *-commutative83.7%

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      16. associate-*l*83.7%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      17. metadata-eval83.7%

        \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
    5. Simplified83.7%

      \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
    6. Taylor expanded in z around 0 36.3%

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutative36.3%

        \[\leadsto \color{blue}{x \cdot -3} \]
    8. Simplified36.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-68} \lor \neg \left(y \leq 1.2 \cdot 10^{-54}\right):\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 99.5% accurate, 1.2× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. +-commutative99.6%

      \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
    2. metadata-eval99.6%

      \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) + x \]
  4. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) + x} \]
  5. Final simplification99.6%

    \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
  6. Add Preprocessing

Alternative 13: 26.1% accurate, 4.3× speedup?

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

\\
x \cdot -3
\end{array}
Derivation
  1. Initial program 99.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 51.4%

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

      \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
    2. sub-neg51.4%

      \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
    3. distribute-rgt-in51.4%

      \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
    4. metadata-eval51.4%

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

      \[\leadsto x \cdot \left(\left(-4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
    6. associate-*r*51.4%

      \[\leadsto x \cdot \left(\left(-4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
    7. *-commutative51.4%

      \[\leadsto x \cdot \left(\left(-4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
    8. metadata-eval51.4%

      \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + -1 \cdot \left(-6 \cdot z\right)\right) + 1\right) \]
    9. distribute-lft-in51.4%

      \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
    10. +-commutative51.4%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
    11. distribute-rgt-in51.4%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(4 \cdot -1 + \left(-6 \cdot z\right) \cdot -1\right)}\right) \]
    12. metadata-eval51.4%

      \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + \left(-6 \cdot z\right) \cdot -1\right)\right) \]
    13. associate-+r+51.4%

      \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
    14. metadata-eval51.4%

      \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-6 \cdot z\right) \cdot -1\right) \]
    15. *-commutative51.4%

      \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
    16. associate-*l*51.4%

      \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
    17. metadata-eval51.4%

      \[\leadsto x \cdot \left(-3 + z \cdot \color{blue}{6}\right) \]
  5. Simplified51.4%

    \[\leadsto \color{blue}{x \cdot \left(-3 + z \cdot 6\right)} \]
  6. Taylor expanded in z around 0 20.8%

    \[\leadsto \color{blue}{-3 \cdot x} \]
  7. Step-by-step derivation
    1. *-commutative20.8%

      \[\leadsto \color{blue}{x \cdot -3} \]
  8. Simplified20.8%

    \[\leadsto \color{blue}{x \cdot -3} \]
  9. Add Preprocessing

Alternative 14: 2.6% accurate, 13.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 99.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Add Preprocessing
  3. Taylor expanded in z around inf 54.2%

    \[\leadsto x + \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
  4. Step-by-step derivation
    1. associate-*r*54.3%

      \[\leadsto x + \color{blue}{\left(-6 \cdot z\right) \cdot \left(y - x\right)} \]
    2. *-commutative54.3%

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

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

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

    \[\leadsto \color{blue}{x} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024096 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))