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

Percentage Accurate: 99.5% → 99.7%
Time: 11.5s
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.9× speedup?

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

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

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

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

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

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

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

Alternative 2: 49.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + y \cdot 4\\ t_1 := -6 \cdot \left(z \cdot y\right)\\ t_2 := x \cdot \left(z \cdot 6\right)\\ t_3 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -8 \cdot 10^{+129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{+86}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+68}:\\ \;\;\;\;z \cdot \left(-6 \cdot y\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{+41}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -0.0195:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-292}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-239}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{-171}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+229}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+303}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (* y 4.0)))
        (t_1 (* -6.0 (* z y)))
        (t_2 (* x (* z 6.0)))
        (t_3 (* 6.0 (* x z))))
   (if (<= z -8e+129)
     t_1
     (if (<= z -1.7e+86)
       t_3
       (if (<= z -8.5e+68)
         (* z (* -6.0 y))
         (if (<= z -1.45e+41)
           t_2
           (if (<= z -0.0195)
             t_1
             (if (<= z -8.5e-292)
               t_0
               (if (<= z 1.85e-239)
                 (* x -3.0)
                 (if (<= z 6.1e-171)
                   t_0
                   (if (<= z 0.5)
                     (* x -3.0)
                     (if (<= z 9.5e+229)
                       t_2
                       (if (<= z 1.75e+303) t_1 t_3)))))))))))))
double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double t_1 = -6.0 * (z * y);
	double t_2 = x * (z * 6.0);
	double t_3 = 6.0 * (x * z);
	double tmp;
	if (z <= -8e+129) {
		tmp = t_1;
	} else if (z <= -1.7e+86) {
		tmp = t_3;
	} else if (z <= -8.5e+68) {
		tmp = z * (-6.0 * y);
	} else if (z <= -1.45e+41) {
		tmp = t_2;
	} else if (z <= -0.0195) {
		tmp = t_1;
	} else if (z <= -8.5e-292) {
		tmp = t_0;
	} else if (z <= 1.85e-239) {
		tmp = x * -3.0;
	} else if (z <= 6.1e-171) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 9.5e+229) {
		tmp = t_2;
	} else if (z <= 1.75e+303) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = x + (y * 4.0d0)
    t_1 = (-6.0d0) * (z * y)
    t_2 = x * (z * 6.0d0)
    t_3 = 6.0d0 * (x * z)
    if (z <= (-8d+129)) then
        tmp = t_1
    else if (z <= (-1.7d+86)) then
        tmp = t_3
    else if (z <= (-8.5d+68)) then
        tmp = z * ((-6.0d0) * y)
    else if (z <= (-1.45d+41)) then
        tmp = t_2
    else if (z <= (-0.0195d0)) then
        tmp = t_1
    else if (z <= (-8.5d-292)) then
        tmp = t_0
    else if (z <= 1.85d-239) then
        tmp = x * (-3.0d0)
    else if (z <= 6.1d-171) then
        tmp = t_0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 9.5d+229) then
        tmp = t_2
    else if (z <= 1.75d+303) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double t_1 = -6.0 * (z * y);
	double t_2 = x * (z * 6.0);
	double t_3 = 6.0 * (x * z);
	double tmp;
	if (z <= -8e+129) {
		tmp = t_1;
	} else if (z <= -1.7e+86) {
		tmp = t_3;
	} else if (z <= -8.5e+68) {
		tmp = z * (-6.0 * y);
	} else if (z <= -1.45e+41) {
		tmp = t_2;
	} else if (z <= -0.0195) {
		tmp = t_1;
	} else if (z <= -8.5e-292) {
		tmp = t_0;
	} else if (z <= 1.85e-239) {
		tmp = x * -3.0;
	} else if (z <= 6.1e-171) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 9.5e+229) {
		tmp = t_2;
	} else if (z <= 1.75e+303) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (y * 4.0)
	t_1 = -6.0 * (z * y)
	t_2 = x * (z * 6.0)
	t_3 = 6.0 * (x * z)
	tmp = 0
	if z <= -8e+129:
		tmp = t_1
	elif z <= -1.7e+86:
		tmp = t_3
	elif z <= -8.5e+68:
		tmp = z * (-6.0 * y)
	elif z <= -1.45e+41:
		tmp = t_2
	elif z <= -0.0195:
		tmp = t_1
	elif z <= -8.5e-292:
		tmp = t_0
	elif z <= 1.85e-239:
		tmp = x * -3.0
	elif z <= 6.1e-171:
		tmp = t_0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 9.5e+229:
		tmp = t_2
	elif z <= 1.75e+303:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(y * 4.0))
	t_1 = Float64(-6.0 * Float64(z * y))
	t_2 = Float64(x * Float64(z * 6.0))
	t_3 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -8e+129)
		tmp = t_1;
	elseif (z <= -1.7e+86)
		tmp = t_3;
	elseif (z <= -8.5e+68)
		tmp = Float64(z * Float64(-6.0 * y));
	elseif (z <= -1.45e+41)
		tmp = t_2;
	elseif (z <= -0.0195)
		tmp = t_1;
	elseif (z <= -8.5e-292)
		tmp = t_0;
	elseif (z <= 1.85e-239)
		tmp = Float64(x * -3.0);
	elseif (z <= 6.1e-171)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 9.5e+229)
		tmp = t_2;
	elseif (z <= 1.75e+303)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (y * 4.0);
	t_1 = -6.0 * (z * y);
	t_2 = x * (z * 6.0);
	t_3 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -8e+129)
		tmp = t_1;
	elseif (z <= -1.7e+86)
		tmp = t_3;
	elseif (z <= -8.5e+68)
		tmp = z * (-6.0 * y);
	elseif (z <= -1.45e+41)
		tmp = t_2;
	elseif (z <= -0.0195)
		tmp = t_1;
	elseif (z <= -8.5e-292)
		tmp = t_0;
	elseif (z <= 1.85e-239)
		tmp = x * -3.0;
	elseif (z <= 6.1e-171)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 9.5e+229)
		tmp = t_2;
	elseif (z <= 1.75e+303)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8e+129], t$95$1, If[LessEqual[z, -1.7e+86], t$95$3, If[LessEqual[z, -8.5e+68], N[(z * N[(-6.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.45e+41], t$95$2, If[LessEqual[z, -0.0195], t$95$1, If[LessEqual[z, -8.5e-292], t$95$0, If[LessEqual[z, 1.85e-239], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6.1e-171], t$95$0, If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 9.5e+229], t$95$2, If[LessEqual[z, 1.75e+303], t$95$1, t$95$3]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + y \cdot 4\\
t_1 := -6 \cdot \left(z \cdot y\right)\\
t_2 := x \cdot \left(z \cdot 6\right)\\
t_3 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+129}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.7 \cdot 10^{+86}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -8.5 \cdot 10^{+68}:\\
\;\;\;\;z \cdot \left(-6 \cdot y\right)\\

\mathbf{elif}\;z \leq -1.45 \cdot 10^{+41}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -0.0195:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -8.5 \cdot 10^{-292}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.85 \cdot 10^{-239}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 6.1 \cdot 10^{-171}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 9.5 \cdot 10^{+229}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.75 \cdot 10^{+303}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -8e129 or -1.44999999999999994e41 < z < -0.0195 or 9.5e229 < z < 1.75000000000000008e303

    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. metadata-eval99.7%

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

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

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

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

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

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

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

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

    if -8e129 < z < -1.6999999999999999e86 or 1.75000000000000008e303 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z \cdot y, \mathsf{fma}\left(x, \mathsf{fma}\left(6, z, -3\right), y \cdot 4\right)\right)} \]
    9. Taylor expanded in z around inf 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot x\right)} \]
    14. Simplified100.0%

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

    if -1.6999999999999999e86 < z < -8.49999999999999966e68

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z \cdot y, \mathsf{fma}\left(x, \mathsf{fma}\left(6, z, -3\right), y \cdot 4\right)\right)} \]
    9. Taylor expanded in z around inf 100.0%

      \[\leadsto \color{blue}{z \cdot \left(-6 \cdot y + 6 \cdot x\right)} \]
    10. Step-by-step derivation
      1. distribute-lft-in85.7%

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

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

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

        \[\leadsto z \cdot \left(-6 \cdot y\right) + \left(\color{blue}{\left(--6\right)} \cdot z\right) \cdot x \]
      5. distribute-lft-neg-in85.7%

        \[\leadsto z \cdot \left(-6 \cdot y\right) + \color{blue}{\left(--6 \cdot z\right)} \cdot x \]
      6. distribute-lft-neg-in85.7%

        \[\leadsto z \cdot \left(-6 \cdot y\right) + \color{blue}{\left(-\left(-6 \cdot z\right) \cdot x\right)} \]
      7. distribute-rgt-neg-out85.7%

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

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

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

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

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

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

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

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

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

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

    if -8.49999999999999966e68 < z < -1.44999999999999994e41 or 0.5 < z < 9.5e229

    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. metadata-eval99.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-z \cdot -6\right)\right) \]
      9. distribute-rgt-neg-in61.6%

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

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

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

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

    if -0.0195 < z < -8.50000000000000066e-292 or 1.85000000000000008e-239 < z < 6.1e-171

    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. metadata-eval99.4%

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

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

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

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

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

      \[\leadsto x + \color{blue}{4 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative57.1%

        \[\leadsto x + \color{blue}{y \cdot 4} \]
    10. Simplified57.1%

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

    if -8.50000000000000066e-292 < z < 1.85000000000000008e-239 or 6.1e-171 < z < 0.5

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified64.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8 \cdot 10^{+129}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{+86}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+68}:\\ \;\;\;\;z \cdot \left(-6 \cdot y\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{+41}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -0.0195:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-292}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-239}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{-171}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+229}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+303}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 49.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot y\right)\\ t_1 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.3 \cdot 10^{+128}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.36 \cdot 10^{+69}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -900:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{+229} \lor \neg \left(z \leq 2.7 \cdot 10^{+296}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z y))) (t_1 (* 6.0 (* x z))))
   (if (<= z -1.3e+128)
     t_0
     (if (<= z -1.26e+85)
       t_1
       (if (<= z -1.36e+69)
         t_0
         (if (<= z -3.5e+37)
           t_1
           (if (<= z -900.0)
             t_0
             (if (<= z 0.5)
               (* x -3.0)
               (if (or (<= z 8.8e+229) (not (<= z 2.7e+296))) t_1 t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * y);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.3e+128) {
		tmp = t_0;
	} else if (z <= -1.26e+85) {
		tmp = t_1;
	} else if (z <= -1.36e+69) {
		tmp = t_0;
	} else if (z <= -3.5e+37) {
		tmp = t_1;
	} else if (z <= -900.0) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if ((z <= 8.8e+229) || !(z <= 2.7e+296)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (z * y)
    t_1 = 6.0d0 * (x * z)
    if (z <= (-1.3d+128)) then
        tmp = t_0
    else if (z <= (-1.26d+85)) then
        tmp = t_1
    else if (z <= (-1.36d+69)) then
        tmp = t_0
    else if (z <= (-3.5d+37)) then
        tmp = t_1
    else if (z <= (-900.0d0)) then
        tmp = t_0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if ((z <= 8.8d+229) .or. (.not. (z <= 2.7d+296))) then
        tmp = t_1
    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 * (z * y);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.3e+128) {
		tmp = t_0;
	} else if (z <= -1.26e+85) {
		tmp = t_1;
	} else if (z <= -1.36e+69) {
		tmp = t_0;
	} else if (z <= -3.5e+37) {
		tmp = t_1;
	} else if (z <= -900.0) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if ((z <= 8.8e+229) || !(z <= 2.7e+296)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * y)
	t_1 = 6.0 * (x * z)
	tmp = 0
	if z <= -1.3e+128:
		tmp = t_0
	elif z <= -1.26e+85:
		tmp = t_1
	elif z <= -1.36e+69:
		tmp = t_0
	elif z <= -3.5e+37:
		tmp = t_1
	elif z <= -900.0:
		tmp = t_0
	elif z <= 0.5:
		tmp = x * -3.0
	elif (z <= 8.8e+229) or not (z <= 2.7e+296):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * y))
	t_1 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1.3e+128)
		tmp = t_0;
	elseif (z <= -1.26e+85)
		tmp = t_1;
	elseif (z <= -1.36e+69)
		tmp = t_0;
	elseif (z <= -3.5e+37)
		tmp = t_1;
	elseif (z <= -900.0)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif ((z <= 8.8e+229) || !(z <= 2.7e+296))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * y);
	t_1 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1.3e+128)
		tmp = t_0;
	elseif (z <= -1.26e+85)
		tmp = t_1;
	elseif (z <= -1.36e+69)
		tmp = t_0;
	elseif (z <= -3.5e+37)
		tmp = t_1;
	elseif (z <= -900.0)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif ((z <= 8.8e+229) || ~((z <= 2.7e+296)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+128], t$95$0, If[LessEqual[z, -1.26e+85], t$95$1, If[LessEqual[z, -1.36e+69], t$95$0, If[LessEqual[z, -3.5e+37], t$95$1, If[LessEqual[z, -900.0], t$95$0, If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[Or[LessEqual[z, 8.8e+229], N[Not[LessEqual[z, 2.7e+296]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.26 \cdot 10^{+85}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.36 \cdot 10^{+69}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -3.5 \cdot 10^{+37}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -900:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 8.8 \cdot 10^{+229} \lor \neg \left(z \leq 2.7 \cdot 10^{+296}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.3e128 or -1.26000000000000003e85 < z < -1.36000000000000006e69 or -3.5e37 < z < -900 or 8.80000000000000014e229 < z < 2.69999999999999986e296

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if -1.3e128 < z < -1.26000000000000003e85 or -1.36000000000000006e69 < z < -3.5e37 or 0.5 < z < 8.80000000000000014e229 or 2.69999999999999986e296 < z

    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. metadata-eval99.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, z \cdot y, \color{blue}{x \cdot \left(6 \cdot z - 3\right) + 4 \cdot y}\right) \]
      4. *-commutative96.5%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z \cdot y, \mathsf{fma}\left(x, \mathsf{fma}\left(6, z, -3\right), y \cdot 4\right)\right)} \]
    9. Taylor expanded in z around inf 99.6%

      \[\leadsto \color{blue}{z \cdot \left(-6 \cdot y + 6 \cdot x\right)} \]
    10. Step-by-step derivation
      1. distribute-lft-in96.4%

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

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

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

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

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

        \[\leadsto z \cdot \left(-6 \cdot y\right) + \color{blue}{\left(-\left(-6 \cdot z\right) \cdot x\right)} \]
      7. distribute-rgt-neg-out96.5%

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

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

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

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

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

        \[\leadsto z \cdot \left(\color{blue}{y \cdot -6} + \left(-x\right) \cdot -6\right) \]
      13. distribute-rgt-in99.6%

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot x\right)} \]
    14. Simplified65.2%

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

    if -900 < z < 0.5

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified48.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+128}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{+85}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.36 \cdot 10^{+69}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{+37}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -900:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.8 \cdot 10^{+229} \lor \neg \left(z \leq 2.7 \cdot 10^{+296}\right):\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 49.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot y\right)\\ t_1 := x \cdot \left(z \cdot 6\right)\\ t_2 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.95 \cdot 10^{+127}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+93}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -900:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+227}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+295}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z y))) (t_1 (* x (* z 6.0))) (t_2 (* 6.0 (* x z))))
   (if (<= z -1.95e+127)
     t_0
     (if (<= z -5.2e+93)
       t_2
       (if (<= z -5.5e+67)
         t_0
         (if (<= z -2.6e+37)
           t_1
           (if (<= z -900.0)
             t_0
             (if (<= z 0.5)
               (* x -3.0)
               (if (<= z 1.75e+227) t_1 (if (<= z 4.5e+295) t_0 t_2))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * y);
	double t_1 = x * (z * 6.0);
	double t_2 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.95e+127) {
		tmp = t_0;
	} else if (z <= -5.2e+93) {
		tmp = t_2;
	} else if (z <= -5.5e+67) {
		tmp = t_0;
	} else if (z <= -2.6e+37) {
		tmp = t_1;
	} else if (z <= -900.0) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 1.75e+227) {
		tmp = t_1;
	} else if (z <= 4.5e+295) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_0 = (-6.0d0) * (z * y)
    t_1 = x * (z * 6.0d0)
    t_2 = 6.0d0 * (x * z)
    if (z <= (-1.95d+127)) then
        tmp = t_0
    else if (z <= (-5.2d+93)) then
        tmp = t_2
    else if (z <= (-5.5d+67)) then
        tmp = t_0
    else if (z <= (-2.6d+37)) then
        tmp = t_1
    else if (z <= (-900.0d0)) then
        tmp = t_0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 1.75d+227) then
        tmp = t_1
    else if (z <= 4.5d+295) then
        tmp = t_0
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * y);
	double t_1 = x * (z * 6.0);
	double t_2 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.95e+127) {
		tmp = t_0;
	} else if (z <= -5.2e+93) {
		tmp = t_2;
	} else if (z <= -5.5e+67) {
		tmp = t_0;
	} else if (z <= -2.6e+37) {
		tmp = t_1;
	} else if (z <= -900.0) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 1.75e+227) {
		tmp = t_1;
	} else if (z <= 4.5e+295) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * y)
	t_1 = x * (z * 6.0)
	t_2 = 6.0 * (x * z)
	tmp = 0
	if z <= -1.95e+127:
		tmp = t_0
	elif z <= -5.2e+93:
		tmp = t_2
	elif z <= -5.5e+67:
		tmp = t_0
	elif z <= -2.6e+37:
		tmp = t_1
	elif z <= -900.0:
		tmp = t_0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 1.75e+227:
		tmp = t_1
	elif z <= 4.5e+295:
		tmp = t_0
	else:
		tmp = t_2
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * y))
	t_1 = Float64(x * Float64(z * 6.0))
	t_2 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1.95e+127)
		tmp = t_0;
	elseif (z <= -5.2e+93)
		tmp = t_2;
	elseif (z <= -5.5e+67)
		tmp = t_0;
	elseif (z <= -2.6e+37)
		tmp = t_1;
	elseif (z <= -900.0)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.75e+227)
		tmp = t_1;
	elseif (z <= 4.5e+295)
		tmp = t_0;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * y);
	t_1 = x * (z * 6.0);
	t_2 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1.95e+127)
		tmp = t_0;
	elseif (z <= -5.2e+93)
		tmp = t_2;
	elseif (z <= -5.5e+67)
		tmp = t_0;
	elseif (z <= -2.6e+37)
		tmp = t_1;
	elseif (z <= -900.0)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 1.75e+227)
		tmp = t_1;
	elseif (z <= 4.5e+295)
		tmp = t_0;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e+127], t$95$0, If[LessEqual[z, -5.2e+93], t$95$2, If[LessEqual[z, -5.5e+67], t$95$0, If[LessEqual[z, -2.6e+37], t$95$1, If[LessEqual[z, -900.0], t$95$0, If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.75e+227], t$95$1, If[LessEqual[z, 4.5e+295], t$95$0, t$95$2]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot y\right)\\
t_1 := x \cdot \left(z \cdot 6\right)\\
t_2 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+127}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -5.2 \cdot 10^{+93}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -5.5 \cdot 10^{+67}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -2.6 \cdot 10^{+37}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -900:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 1.75 \cdot 10^{+227}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 4.5 \cdot 10^{+295}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.94999999999999991e127 or -5.19999999999999999e93 < z < -5.49999999999999968e67 or -2.5999999999999999e37 < z < -900 or 1.75e227 < z < 4.5000000000000004e295

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if -1.94999999999999991e127 < z < -5.19999999999999999e93 or 4.5000000000000004e295 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z \cdot y, \mathsf{fma}\left(x, \mathsf{fma}\left(6, z, -3\right), y \cdot 4\right)\right)} \]
    9. Taylor expanded in z around inf 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot x\right)} \]
    14. Simplified100.0%

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

    if -5.49999999999999968e67 < z < -2.5999999999999999e37 or 0.5 < z < 1.75e227

    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. metadata-eval99.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-z \cdot -6\right)\right) \]
      9. distribute-rgt-neg-in61.6%

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

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

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

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

    if -900 < z < 0.5

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified48.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.95 \cdot 10^{+127}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+93}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+67}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{+37}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -900:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+227}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+295}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 49.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot y\right)\\ t_1 := x \cdot \left(z \cdot 6\right)\\ t_2 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -2.1 \cdot 10^{+129}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{+91}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{+70}:\\ \;\;\;\;z \cdot \left(-6 \cdot y\right)\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -900:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.25 \cdot 10^{+226}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+291}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z y))) (t_1 (* x (* z 6.0))) (t_2 (* 6.0 (* x z))))
   (if (<= z -2.1e+129)
     t_0
     (if (<= z -2.1e+91)
       t_2
       (if (<= z -2.25e+70)
         (* z (* -6.0 y))
         (if (<= z -2.1e+38)
           t_1
           (if (<= z -900.0)
             t_0
             (if (<= z 0.5)
               (* x -3.0)
               (if (<= z 4.25e+226) t_1 (if (<= z 1.1e+291) t_0 t_2))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * y);
	double t_1 = x * (z * 6.0);
	double t_2 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.1e+129) {
		tmp = t_0;
	} else if (z <= -2.1e+91) {
		tmp = t_2;
	} else if (z <= -2.25e+70) {
		tmp = z * (-6.0 * y);
	} else if (z <= -2.1e+38) {
		tmp = t_1;
	} else if (z <= -900.0) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 4.25e+226) {
		tmp = t_1;
	} else if (z <= 1.1e+291) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_0 = (-6.0d0) * (z * y)
    t_1 = x * (z * 6.0d0)
    t_2 = 6.0d0 * (x * z)
    if (z <= (-2.1d+129)) then
        tmp = t_0
    else if (z <= (-2.1d+91)) then
        tmp = t_2
    else if (z <= (-2.25d+70)) then
        tmp = z * ((-6.0d0) * y)
    else if (z <= (-2.1d+38)) then
        tmp = t_1
    else if (z <= (-900.0d0)) then
        tmp = t_0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 4.25d+226) then
        tmp = t_1
    else if (z <= 1.1d+291) then
        tmp = t_0
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * y);
	double t_1 = x * (z * 6.0);
	double t_2 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.1e+129) {
		tmp = t_0;
	} else if (z <= -2.1e+91) {
		tmp = t_2;
	} else if (z <= -2.25e+70) {
		tmp = z * (-6.0 * y);
	} else if (z <= -2.1e+38) {
		tmp = t_1;
	} else if (z <= -900.0) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 4.25e+226) {
		tmp = t_1;
	} else if (z <= 1.1e+291) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * y)
	t_1 = x * (z * 6.0)
	t_2 = 6.0 * (x * z)
	tmp = 0
	if z <= -2.1e+129:
		tmp = t_0
	elif z <= -2.1e+91:
		tmp = t_2
	elif z <= -2.25e+70:
		tmp = z * (-6.0 * y)
	elif z <= -2.1e+38:
		tmp = t_1
	elif z <= -900.0:
		tmp = t_0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 4.25e+226:
		tmp = t_1
	elif z <= 1.1e+291:
		tmp = t_0
	else:
		tmp = t_2
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * y))
	t_1 = Float64(x * Float64(z * 6.0))
	t_2 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -2.1e+129)
		tmp = t_0;
	elseif (z <= -2.1e+91)
		tmp = t_2;
	elseif (z <= -2.25e+70)
		tmp = Float64(z * Float64(-6.0 * y));
	elseif (z <= -2.1e+38)
		tmp = t_1;
	elseif (z <= -900.0)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 4.25e+226)
		tmp = t_1;
	elseif (z <= 1.1e+291)
		tmp = t_0;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * y);
	t_1 = x * (z * 6.0);
	t_2 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -2.1e+129)
		tmp = t_0;
	elseif (z <= -2.1e+91)
		tmp = t_2;
	elseif (z <= -2.25e+70)
		tmp = z * (-6.0 * y);
	elseif (z <= -2.1e+38)
		tmp = t_1;
	elseif (z <= -900.0)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 4.25e+226)
		tmp = t_1;
	elseif (z <= 1.1e+291)
		tmp = t_0;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+129], t$95$0, If[LessEqual[z, -2.1e+91], t$95$2, If[LessEqual[z, -2.25e+70], N[(z * N[(-6.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.1e+38], t$95$1, If[LessEqual[z, -900.0], t$95$0, If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4.25e+226], t$95$1, If[LessEqual[z, 1.1e+291], t$95$0, t$95$2]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot y\right)\\
t_1 := x \cdot \left(z \cdot 6\right)\\
t_2 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+129}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -2.1 \cdot 10^{+91}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -2.25 \cdot 10^{+70}:\\
\;\;\;\;z \cdot \left(-6 \cdot y\right)\\

\mathbf{elif}\;z \leq -2.1 \cdot 10^{+38}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -900:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 4.25 \cdot 10^{+226}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+291}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.09999999999999997e129 or -2.1e38 < z < -900 or 4.24999999999999987e226 < z < 1.1e291

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if -2.09999999999999997e129 < z < -2.10000000000000008e91 or 1.1e291 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z \cdot y, \mathsf{fma}\left(x, \mathsf{fma}\left(6, z, -3\right), y \cdot 4\right)\right)} \]
    9. Taylor expanded in z around inf 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot x\right)} \]
    14. Simplified100.0%

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

    if -2.10000000000000008e91 < z < -2.25e70

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z \cdot y, \mathsf{fma}\left(x, \mathsf{fma}\left(6, z, -3\right), y \cdot 4\right)\right)} \]
    9. Taylor expanded in z around inf 100.0%

      \[\leadsto \color{blue}{z \cdot \left(-6 \cdot y + 6 \cdot x\right)} \]
    10. Step-by-step derivation
      1. distribute-lft-in85.7%

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

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

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

        \[\leadsto z \cdot \left(-6 \cdot y\right) + \left(\color{blue}{\left(--6\right)} \cdot z\right) \cdot x \]
      5. distribute-lft-neg-in85.7%

        \[\leadsto z \cdot \left(-6 \cdot y\right) + \color{blue}{\left(--6 \cdot z\right)} \cdot x \]
      6. distribute-lft-neg-in85.7%

        \[\leadsto z \cdot \left(-6 \cdot y\right) + \color{blue}{\left(-\left(-6 \cdot z\right) \cdot x\right)} \]
      7. distribute-rgt-neg-out85.7%

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

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

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

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

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

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

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

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

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

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

    if -2.25e70 < z < -2.1e38 or 0.5 < z < 4.24999999999999987e226

    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. metadata-eval99.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-z \cdot -6\right)\right) \]
      9. distribute-rgt-neg-in61.6%

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

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

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

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

    if -900 < z < 0.5

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified48.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+129}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{+91}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{+70}:\\ \;\;\;\;z \cdot \left(-6 \cdot y\right)\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{+38}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -900:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.25 \cdot 10^{+226}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+291}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 73.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_0 := x + y \cdot 4\\
t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -0.0048:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2 \cdot 10^{-290}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{-239}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-171}:\\
\;\;\;\;t_0\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.00479999999999999958 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. Step-by-step derivation
      1. metadata-eval99.7%

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

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

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

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

    if -0.00479999999999999958 < z < -2.0000000000000001e-290 or 2.60000000000000003e-239 < z < 7.20000000000000006e-171

    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. metadata-eval99.4%

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

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

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

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

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

      \[\leadsto x + \color{blue}{4 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative57.1%

        \[\leadsto x + \color{blue}{y \cdot 4} \]
    10. Simplified57.1%

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

    if -2.0000000000000001e-290 < z < 2.60000000000000003e-239 or 7.20000000000000006e-171 < z < 0.5

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified64.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0048:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-290}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-239}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-171}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + y \cdot 4\\ t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -0.0028:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-291}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-239}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-171}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (* y 4.0))) (t_1 (* -6.0 (* z (- y x)))))
   (if (<= z -0.0028)
     t_1
     (if (<= z -7.8e-291)
       t_0
       (if (<= z 2.2e-239)
         (* x -3.0)
         (if (<= z 8.5e-171)
           t_0
           (if (<= z 1.75e+15) (* x (+ -3.0 (* z 6.0))) t_1)))))))
double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -0.0028) {
		tmp = t_1;
	} else if (z <= -7.8e-291) {
		tmp = t_0;
	} else if (z <= 2.2e-239) {
		tmp = x * -3.0;
	} else if (z <= 8.5e-171) {
		tmp = t_0;
	} else if (z <= 1.75e+15) {
		tmp = x * (-3.0 + (z * 6.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 + (y * 4.0d0)
    t_1 = (-6.0d0) * (z * (y - x))
    if (z <= (-0.0028d0)) then
        tmp = t_1
    else if (z <= (-7.8d-291)) then
        tmp = t_0
    else if (z <= 2.2d-239) then
        tmp = x * (-3.0d0)
    else if (z <= 8.5d-171) then
        tmp = t_0
    else if (z <= 1.75d+15) then
        tmp = x * ((-3.0d0) + (z * 6.0d0))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -0.0028) {
		tmp = t_1;
	} else if (z <= -7.8e-291) {
		tmp = t_0;
	} else if (z <= 2.2e-239) {
		tmp = x * -3.0;
	} else if (z <= 8.5e-171) {
		tmp = t_0;
	} else if (z <= 1.75e+15) {
		tmp = x * (-3.0 + (z * 6.0));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (y * 4.0)
	t_1 = -6.0 * (z * (y - x))
	tmp = 0
	if z <= -0.0028:
		tmp = t_1
	elif z <= -7.8e-291:
		tmp = t_0
	elif z <= 2.2e-239:
		tmp = x * -3.0
	elif z <= 8.5e-171:
		tmp = t_0
	elif z <= 1.75e+15:
		tmp = x * (-3.0 + (z * 6.0))
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(y * 4.0))
	t_1 = Float64(-6.0 * Float64(z * Float64(y - x)))
	tmp = 0.0
	if (z <= -0.0028)
		tmp = t_1;
	elseif (z <= -7.8e-291)
		tmp = t_0;
	elseif (z <= 2.2e-239)
		tmp = Float64(x * -3.0);
	elseif (z <= 8.5e-171)
		tmp = t_0;
	elseif (z <= 1.75e+15)
		tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (y * 4.0);
	t_1 = -6.0 * (z * (y - x));
	tmp = 0.0;
	if (z <= -0.0028)
		tmp = t_1;
	elseif (z <= -7.8e-291)
		tmp = t_0;
	elseif (z <= 2.2e-239)
		tmp = x * -3.0;
	elseif (z <= 8.5e-171)
		tmp = t_0;
	elseif (z <= 1.75e+15)
		tmp = x * (-3.0 + (z * 6.0));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.0028], t$95$1, If[LessEqual[z, -7.8e-291], t$95$0, If[LessEqual[z, 2.2e-239], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 8.5e-171], t$95$0, If[LessEqual[z, 1.75e+15], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + y \cdot 4\\
t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -0.0028:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -7.8 \cdot 10^{-291}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-239}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-171}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.75 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -0.00279999999999999997 or 1.75e15 < 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. metadata-eval99.7%

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

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

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

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

    if -0.00279999999999999997 < z < -7.80000000000000031e-291 or 2.19999999999999983e-239 < z < 8.50000000000000032e-171

    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. metadata-eval99.4%

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

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

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

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

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

      \[\leadsto x + \color{blue}{4 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative57.1%

        \[\leadsto x + \color{blue}{y \cdot 4} \]
    10. Simplified57.1%

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

    if -7.80000000000000031e-291 < z < 2.19999999999999983e-239

    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. metadata-eval99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.50000000000000032e-171 < z < 1.75e15

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-z \cdot -6\right)\right) \]
      9. distribute-rgt-neg-in64.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0028:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-291}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-239}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-171}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 72.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{+111} \lor \neg \left(y \leq -2.7 \cdot 10^{-33} \lor \neg \left(y \leq -2.95 \cdot 10^{-95}\right) \land y \leq 4.2 \cdot 10^{+45}\right):\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -3.9e+111)
         (not
          (or (<= y -2.7e-33) (and (not (<= y -2.95e-95)) (<= y 4.2e+45)))))
   (* y (+ 4.0 (* -6.0 z)))
   (* x (+ -3.0 (* z 6.0)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -3.9e+111) || !((y <= -2.7e-33) || (!(y <= -2.95e-95) && (y <= 4.2e+45)))) {
		tmp = y * (4.0 + (-6.0 * 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 <= (-3.9d+111)) .or. (.not. (y <= (-2.7d-33)) .or. (.not. (y <= (-2.95d-95))) .and. (y <= 4.2d+45))) then
        tmp = y * (4.0d0 + ((-6.0d0) * 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 <= -3.9e+111) || !((y <= -2.7e-33) || (!(y <= -2.95e-95) && (y <= 4.2e+45)))) {
		tmp = y * (4.0 + (-6.0 * z));
	} else {
		tmp = x * (-3.0 + (z * 6.0));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -3.9e+111) or not ((y <= -2.7e-33) or (not (y <= -2.95e-95) and (y <= 4.2e+45))):
		tmp = y * (4.0 + (-6.0 * z))
	else:
		tmp = x * (-3.0 + (z * 6.0))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -3.9e+111) || !((y <= -2.7e-33) || (!(y <= -2.95e-95) && (y <= 4.2e+45))))
		tmp = Float64(y * Float64(4.0 + Float64(-6.0 * 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 <= -3.9e+111) || ~(((y <= -2.7e-33) || (~((y <= -2.95e-95)) && (y <= 4.2e+45)))))
		tmp = y * (4.0 + (-6.0 * z));
	else
		tmp = x * (-3.0 + (z * 6.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.9e+111], N[Not[Or[LessEqual[y, -2.7e-33], And[N[Not[LessEqual[y, -2.95e-95]], $MachinePrecision], LessEqual[y, 4.2e+45]]]], $MachinePrecision]], N[(y * N[(4.0 + N[(-6.0 * 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 -3.9 \cdot 10^{+111} \lor \neg \left(y \leq -2.7 \cdot 10^{-33} \lor \neg \left(y \leq -2.95 \cdot 10^{-95}\right) \land y \leq 4.2 \cdot 10^{+45}\right):\\
\;\;\;\;y \cdot \left(4 + -6 \cdot z\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 < -3.89999999999999979e111 or -2.7000000000000001e-33 < y < -2.9499999999999999e-95 or 4.1999999999999999e45 < y

    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.9%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)} + x \]
      3. fma-def99.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. distribute-rgt-in99.9%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4} + \left(-z\right) \cdot 6, x\right) \]
      8. distribute-lft-neg-out99.9%

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

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

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

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

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

    if -3.89999999999999979e111 < y < -2.7000000000000001e-33 or -2.9499999999999999e-95 < y < 4.1999999999999999e45

    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. metadata-eval99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{+111} \lor \neg \left(y \leq -2.7 \cdot 10^{-33} \lor \neg \left(y \leq -2.95 \cdot 10^{-95}\right) \land y \leq 4.2 \cdot 10^{+45}\right):\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 97.7% accurate, 0.8× speedup?

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

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

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

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

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

    if -0.52000000000000002 < z < 0.5

    1. Initial program 99.3%

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

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

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

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

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

Alternative 10: 97.7% accurate, 0.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.599999999999999978 or 0.55000000000000004 < 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. metadata-eval99.7%

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

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

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

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

    if -0.599999999999999978 < z < 0.55000000000000004

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z \cdot y, \mathsf{fma}\left(x, \mathsf{fma}\left(6, z, -3\right), y \cdot 4\right)\right)} \]
    9. Taylor expanded in z around 0 97.1%

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

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

Alternative 11: 50.3% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -900 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. Step-by-step derivation
      1. metadata-eval99.7%

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

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

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

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

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

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

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

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

    if -900 < z < 0.5

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified48.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -900 \lor \neg \left(z \leq 0.5\right):\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \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.5%

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

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

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

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

Alternative 13: 26.3% 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.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \left(\color{blue}{-3} + \left(-z \cdot -6\right)\right) \]
    9. distribute-rgt-neg-in50.9%

      \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(--6\right)}\right) \]
    10. metadata-eval50.9%

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

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

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

      \[\leadsto \color{blue}{x \cdot -3} \]
  10. Simplified27.3%

    \[\leadsto \color{blue}{x \cdot -3} \]
  11. Final simplification27.3%

    \[\leadsto x \cdot -3 \]
  12. 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.5%

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  9. Final simplification2.9%

    \[\leadsto x \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024024 
(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))))