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

Percentage Accurate: 99.5% → 99.8%
Time: 15.0s
Alternatives: 15
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 15 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.8% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \left(0.6666666666666666 - z\right), x\right) \]

Alternative 2: 50.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ t_1 := x + y \cdot 4\\ \mathbf{if}\;z \leq -5 \cdot 10^{+51}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -4500:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -7.5:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-295}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.05:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))) (t_1 (+ x (* y 4.0))))
   (if (<= z -5e+51)
     (* y (* z -6.0))
     (if (<= z -4500.0)
       (* z (* x 6.0))
       (if (<= z -7.5)
         t_0
         (if (<= z -4.5e-295)
           (* x -3.0)
           (if (<= z 4.6e-101)
             t_1
             (if (<= z 8e-72)
               (* x -3.0)
               (if (<= z 1.05)
                 t_1
                 (if (<= z 6.5e+85) t_0 (* 6.0 (* x z))))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = x + (y * 4.0);
	double tmp;
	if (z <= -5e+51) {
		tmp = y * (z * -6.0);
	} else if (z <= -4500.0) {
		tmp = z * (x * 6.0);
	} else if (z <= -7.5) {
		tmp = t_0;
	} else if (z <= -4.5e-295) {
		tmp = x * -3.0;
	} else if (z <= 4.6e-101) {
		tmp = t_1;
	} else if (z <= 8e-72) {
		tmp = x * -3.0;
	} else if (z <= 1.05) {
		tmp = t_1;
	} else if (z <= 6.5e+85) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    t_1 = x + (y * 4.0d0)
    if (z <= (-5d+51)) then
        tmp = y * (z * (-6.0d0))
    else if (z <= (-4500.0d0)) then
        tmp = z * (x * 6.0d0)
    else if (z <= (-7.5d0)) then
        tmp = t_0
    else if (z <= (-4.5d-295)) then
        tmp = x * (-3.0d0)
    else if (z <= 4.6d-101) then
        tmp = t_1
    else if (z <= 8d-72) then
        tmp = x * (-3.0d0)
    else if (z <= 1.05d0) then
        tmp = t_1
    else if (z <= 6.5d+85) then
        tmp = t_0
    else
        tmp = 6.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = x + (y * 4.0);
	double tmp;
	if (z <= -5e+51) {
		tmp = y * (z * -6.0);
	} else if (z <= -4500.0) {
		tmp = z * (x * 6.0);
	} else if (z <= -7.5) {
		tmp = t_0;
	} else if (z <= -4.5e-295) {
		tmp = x * -3.0;
	} else if (z <= 4.6e-101) {
		tmp = t_1;
	} else if (z <= 8e-72) {
		tmp = x * -3.0;
	} else if (z <= 1.05) {
		tmp = t_1;
	} else if (z <= 6.5e+85) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	t_1 = x + (y * 4.0)
	tmp = 0
	if z <= -5e+51:
		tmp = y * (z * -6.0)
	elif z <= -4500.0:
		tmp = z * (x * 6.0)
	elif z <= -7.5:
		tmp = t_0
	elif z <= -4.5e-295:
		tmp = x * -3.0
	elif z <= 4.6e-101:
		tmp = t_1
	elif z <= 8e-72:
		tmp = x * -3.0
	elif z <= 1.05:
		tmp = t_1
	elif z <= 6.5e+85:
		tmp = t_0
	else:
		tmp = 6.0 * (x * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	t_1 = Float64(x + Float64(y * 4.0))
	tmp = 0.0
	if (z <= -5e+51)
		tmp = Float64(y * Float64(z * -6.0));
	elseif (z <= -4500.0)
		tmp = Float64(z * Float64(x * 6.0));
	elseif (z <= -7.5)
		tmp = t_0;
	elseif (z <= -4.5e-295)
		tmp = Float64(x * -3.0);
	elseif (z <= 4.6e-101)
		tmp = t_1;
	elseif (z <= 8e-72)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.05)
		tmp = t_1;
	elseif (z <= 6.5e+85)
		tmp = t_0;
	else
		tmp = Float64(6.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	t_1 = x + (y * 4.0);
	tmp = 0.0;
	if (z <= -5e+51)
		tmp = y * (z * -6.0);
	elseif (z <= -4500.0)
		tmp = z * (x * 6.0);
	elseif (z <= -7.5)
		tmp = t_0;
	elseif (z <= -4.5e-295)
		tmp = x * -3.0;
	elseif (z <= 4.6e-101)
		tmp = t_1;
	elseif (z <= 8e-72)
		tmp = x * -3.0;
	elseif (z <= 1.05)
		tmp = t_1;
	elseif (z <= 6.5e+85)
		tmp = t_0;
	else
		tmp = 6.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+51], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4500.0], N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -7.5], t$95$0, If[LessEqual[z, -4.5e-295], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4.6e-101], t$95$1, If[LessEqual[z, 8e-72], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.05], t$95$1, If[LessEqual[z, 6.5e+85], t$95$0, N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -4500:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\

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

\mathbf{elif}\;z \leq -4.5 \cdot 10^{-295}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 4.6 \cdot 10^{-101}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 8 \cdot 10^{-72}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 1.05:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{+85}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -5e51

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\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. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

    if -5e51 < z < -4500

    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. Taylor expanded in x around inf 82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4500 < z < -7.5 or 1.05000000000000004 < z < 6.4999999999999994e85

    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. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    5. Applied egg-rr99.8%

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

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

      \[\leadsto \color{blue}{-6 \cdot \left(y \cdot z\right)} \]
    8. Step-by-step derivation
      1. *-commutative69.9%

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

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

    if -7.5 < z < -4.5000000000000002e-295 or 4.5999999999999999e-101 < z < 7.9999999999999997e-72

    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. Taylor expanded in x around inf 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified63.2%

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

    if -4.5000000000000002e-295 < z < 4.5999999999999999e-101 or 7.9999999999999997e-72 < z < 1.05000000000000004

    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. Taylor expanded in y around inf 65.9%

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

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

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

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

    if 6.4999999999999994e85 < z

    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. Taylor expanded in x around inf 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+51}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -4500:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -7.5:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-295}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-101}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.05:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{+85}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 50.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -8.2 \cdot 10^{+192}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{+53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1150000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -0.8:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+89}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))) (t_1 (* -6.0 (* y z))))
   (if (<= z -8.2e+192)
     t_0
     (if (<= z -3.4e+53)
       t_1
       (if (<= z -1150000.0)
         t_0
         (if (<= z -0.8)
           t_1
           (if (<= z 0.6) (* x -3.0) (if (<= z 7e+89) t_1 t_0))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -8.2e+192) {
		tmp = t_0;
	} else if (z <= -3.4e+53) {
		tmp = t_1;
	} else if (z <= -1150000.0) {
		tmp = t_0;
	} else if (z <= -0.8) {
		tmp = t_1;
	} else if (z <= 0.6) {
		tmp = x * -3.0;
	} else if (z <= 7e+89) {
		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 * (x * z)
    t_1 = (-6.0d0) * (y * z)
    if (z <= (-8.2d+192)) then
        tmp = t_0
    else if (z <= (-3.4d+53)) then
        tmp = t_1
    else if (z <= (-1150000.0d0)) then
        tmp = t_0
    else if (z <= (-0.8d0)) then
        tmp = t_1
    else if (z <= 0.6d0) then
        tmp = x * (-3.0d0)
    else if (z <= 7d+89) 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 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -8.2e+192) {
		tmp = t_0;
	} else if (z <= -3.4e+53) {
		tmp = t_1;
	} else if (z <= -1150000.0) {
		tmp = t_0;
	} else if (z <= -0.8) {
		tmp = t_1;
	} else if (z <= 0.6) {
		tmp = x * -3.0;
	} else if (z <= 7e+89) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	t_1 = -6.0 * (y * z)
	tmp = 0
	if z <= -8.2e+192:
		tmp = t_0
	elif z <= -3.4e+53:
		tmp = t_1
	elif z <= -1150000.0:
		tmp = t_0
	elif z <= -0.8:
		tmp = t_1
	elif z <= 0.6:
		tmp = x * -3.0
	elif z <= 7e+89:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	t_1 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -8.2e+192)
		tmp = t_0;
	elseif (z <= -3.4e+53)
		tmp = t_1;
	elseif (z <= -1150000.0)
		tmp = t_0;
	elseif (z <= -0.8)
		tmp = t_1;
	elseif (z <= 0.6)
		tmp = Float64(x * -3.0);
	elseif (z <= 7e+89)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	t_1 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -8.2e+192)
		tmp = t_0;
	elseif (z <= -3.4e+53)
		tmp = t_1;
	elseif (z <= -1150000.0)
		tmp = t_0;
	elseif (z <= -0.8)
		tmp = t_1;
	elseif (z <= 0.6)
		tmp = x * -3.0;
	elseif (z <= 7e+89)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.2e+192], t$95$0, If[LessEqual[z, -3.4e+53], t$95$1, If[LessEqual[z, -1150000.0], t$95$0, If[LessEqual[z, -0.8], t$95$1, If[LessEqual[z, 0.6], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 7e+89], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.4 \cdot 10^{+53}:\\
\;\;\;\;t_1\\

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

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

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

\mathbf{elif}\;z \leq 7 \cdot 10^{+89}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.20000000000000006e192 or -3.39999999999999998e53 < z < -1.15e6 or 7.0000000000000001e89 < z

    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. Taylor expanded in x around inf 68.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.20000000000000006e192 < z < -3.39999999999999998e53 or -1.15e6 < z < -0.80000000000000004 or 0.599999999999999978 < z < 7.0000000000000001e89

    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. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

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

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

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

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

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    9. Simplified69.4%

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

    if -0.80000000000000004 < z < 0.599999999999999978

    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. Taylor expanded in x around inf 52.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.2 \cdot 10^{+192}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{+53}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1150000:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -0.8:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+89}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 4: 50.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(6 \cdot z\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -5 \cdot 10^{+193}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{+51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -135:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.65:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* 6.0 z))) (t_1 (* -6.0 (* y z))))
   (if (<= z -5e+193)
     t_0
     (if (<= z -2.5e+51)
       t_1
       (if (<= z -135.0)
         t_0
         (if (<= z -1.65)
           t_1
           (if (<= z 0.68)
             (* x -3.0)
             (if (<= z 2.25e+85) t_1 (* 6.0 (* x z))))))))))
double code(double x, double y, double z) {
	double t_0 = x * (6.0 * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -5e+193) {
		tmp = t_0;
	} else if (z <= -2.5e+51) {
		tmp = t_1;
	} else if (z <= -135.0) {
		tmp = t_0;
	} else if (z <= -1.65) {
		tmp = t_1;
	} else if (z <= 0.68) {
		tmp = x * -3.0;
	} else if (z <= 2.25e+85) {
		tmp = t_1;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (6.0d0 * z)
    t_1 = (-6.0d0) * (y * z)
    if (z <= (-5d+193)) then
        tmp = t_0
    else if (z <= (-2.5d+51)) then
        tmp = t_1
    else if (z <= (-135.0d0)) then
        tmp = t_0
    else if (z <= (-1.65d0)) then
        tmp = t_1
    else if (z <= 0.68d0) then
        tmp = x * (-3.0d0)
    else if (z <= 2.25d+85) then
        tmp = t_1
    else
        tmp = 6.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (6.0 * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -5e+193) {
		tmp = t_0;
	} else if (z <= -2.5e+51) {
		tmp = t_1;
	} else if (z <= -135.0) {
		tmp = t_0;
	} else if (z <= -1.65) {
		tmp = t_1;
	} else if (z <= 0.68) {
		tmp = x * -3.0;
	} else if (z <= 2.25e+85) {
		tmp = t_1;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (6.0 * z)
	t_1 = -6.0 * (y * z)
	tmp = 0
	if z <= -5e+193:
		tmp = t_0
	elif z <= -2.5e+51:
		tmp = t_1
	elif z <= -135.0:
		tmp = t_0
	elif z <= -1.65:
		tmp = t_1
	elif z <= 0.68:
		tmp = x * -3.0
	elif z <= 2.25e+85:
		tmp = t_1
	else:
		tmp = 6.0 * (x * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(6.0 * z))
	t_1 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -5e+193)
		tmp = t_0;
	elseif (z <= -2.5e+51)
		tmp = t_1;
	elseif (z <= -135.0)
		tmp = t_0;
	elseif (z <= -1.65)
		tmp = t_1;
	elseif (z <= 0.68)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.25e+85)
		tmp = t_1;
	else
		tmp = Float64(6.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (6.0 * z);
	t_1 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -5e+193)
		tmp = t_0;
	elseif (z <= -2.5e+51)
		tmp = t_1;
	elseif (z <= -135.0)
		tmp = t_0;
	elseif (z <= -1.65)
		tmp = t_1;
	elseif (z <= 0.68)
		tmp = x * -3.0;
	elseif (z <= 2.25e+85)
		tmp = t_1;
	else
		tmp = 6.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+193], t$95$0, If[LessEqual[z, -2.5e+51], t$95$1, If[LessEqual[z, -135.0], t$95$0, If[LessEqual[z, -1.65], t$95$1, If[LessEqual[z, 0.68], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.25e+85], t$95$1, N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.5 \cdot 10^{+51}:\\
\;\;\;\;t_1\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.99999999999999972e193 or -2.5e51 < z < -135

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999972e193 < z < -2.5e51 or -135 < z < -1.6499999999999999 or 0.680000000000000049 < z < 2.25000000000000003e85

    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. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

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

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

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

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

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    9. Simplified69.4%

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

    if -1.6499999999999999 < z < 0.680000000000000049

    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. Taylor expanded in x around inf 52.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.25000000000000003e85 < z

    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. Taylor expanded in x around inf 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+193}:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{+51}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -135:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.65:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{+85}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 5: 73.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + y \cdot 4\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.115:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-294}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-101}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 8.4 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;t_0\\ \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 (* (- y x) z))))
   (if (<= z -0.115)
     t_1
     (if (<= z -3.8e-294)
       (* x -3.0)
       (if (<= z 2.55e-101)
         t_0
         (if (<= z 8.4e-72) (* x -3.0) (if (<= z 0.68) t_0 t_1)))))))
double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -0.115) {
		tmp = t_1;
	} else if (z <= -3.8e-294) {
		tmp = x * -3.0;
	} else if (z <= 2.55e-101) {
		tmp = t_0;
	} else if (z <= 8.4e-72) {
		tmp = x * -3.0;
	} else if (z <= 0.68) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x + (y * 4.0d0)
    t_1 = (-6.0d0) * ((y - x) * z)
    if (z <= (-0.115d0)) then
        tmp = t_1
    else if (z <= (-3.8d-294)) then
        tmp = x * (-3.0d0)
    else if (z <= 2.55d-101) then
        tmp = t_0
    else if (z <= 8.4d-72) then
        tmp = x * (-3.0d0)
    else if (z <= 0.68d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -0.115) {
		tmp = t_1;
	} else if (z <= -3.8e-294) {
		tmp = x * -3.0;
	} else if (z <= 2.55e-101) {
		tmp = t_0;
	} else if (z <= 8.4e-72) {
		tmp = x * -3.0;
	} else if (z <= 0.68) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (y * 4.0)
	t_1 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -0.115:
		tmp = t_1
	elif z <= -3.8e-294:
		tmp = x * -3.0
	elif z <= 2.55e-101:
		tmp = t_0
	elif z <= 8.4e-72:
		tmp = x * -3.0
	elif z <= 0.68:
		tmp = t_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(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -0.115)
		tmp = t_1;
	elseif (z <= -3.8e-294)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.55e-101)
		tmp = t_0;
	elseif (z <= 8.4e-72)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.68)
		tmp = t_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 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -0.115)
		tmp = t_1;
	elseif (z <= -3.8e-294)
		tmp = x * -3.0;
	elseif (z <= 2.55e-101)
		tmp = t_0;
	elseif (z <= 8.4e-72)
		tmp = x * -3.0;
	elseif (z <= 0.68)
		tmp = t_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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.115], t$95$1, If[LessEqual[z, -3.8e-294], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.55e-101], t$95$0, If[LessEqual[z, 8.4e-72], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.68], t$95$0, t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-294}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 2.55 \cdot 10^{-101}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 8.4 \cdot 10^{-72}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.68:\\
\;\;\;\;t_0\\

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


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

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

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

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

    if -0.115000000000000005 < z < -3.8e-294 or 2.5500000000000001e-101 < z < 8.4e-72

    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. Taylor expanded in x around inf 64.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified63.2%

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

    if -3.8e-294 < z < 2.5500000000000001e-101 or 8.4e-72 < z < 0.680000000000000049

    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. Taylor expanded in y around inf 65.9%

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

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

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

      \[\leadsto \color{blue}{4 \cdot y + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.115:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-294}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-101}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 8.4 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 6: 74.1% accurate, 0.8× speedup?

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

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

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

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

\mathbf{elif}\;z \leq 6.8 \cdot 10^{-72}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.68:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.4e9 or 0.680000000000000049 < z

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

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

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

    if -1.4e9 < z < -2.39999999999999997e-294

    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. Taylor expanded in x around inf 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999997e-294 < z < 2.60000000000000003e-104 or 6.7999999999999997e-72 < z < 0.680000000000000049

    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. Taylor expanded in y around inf 65.9%

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

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

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

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

    if 2.60000000000000003e-104 < z < 6.7999999999999997e-72

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified78.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1400000000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-294}:\\ \;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-104}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 7: 74.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + y \cdot 4\\ \mathbf{if}\;z \leq -410000000:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.16 \cdot 10^{-294}:\\ \;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{elif}\;z \leq 2.45 \cdot 10^{-104}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-73}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (* y 4.0))))
   (if (<= z -410000000.0)
     (* z (* (- y x) -6.0))
     (if (<= z -1.16e-294)
       (* x (+ -3.0 (* 6.0 z)))
       (if (<= z 2.45e-104)
         t_0
         (if (<= z 5e-73)
           (* x -3.0)
           (if (<= z 0.68) t_0 (* -6.0 (* (- y x) z)))))))))
double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double tmp;
	if (z <= -410000000.0) {
		tmp = z * ((y - x) * -6.0);
	} else if (z <= -1.16e-294) {
		tmp = x * (-3.0 + (6.0 * z));
	} else if (z <= 2.45e-104) {
		tmp = t_0;
	} else if (z <= 5e-73) {
		tmp = x * -3.0;
	} else if (z <= 0.68) {
		tmp = t_0;
	} else {
		tmp = -6.0 * ((y - x) * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (y * 4.0d0)
    if (z <= (-410000000.0d0)) then
        tmp = z * ((y - x) * (-6.0d0))
    else if (z <= (-1.16d-294)) then
        tmp = x * ((-3.0d0) + (6.0d0 * z))
    else if (z <= 2.45d-104) then
        tmp = t_0
    else if (z <= 5d-73) then
        tmp = x * (-3.0d0)
    else if (z <= 0.68d0) then
        tmp = t_0
    else
        tmp = (-6.0d0) * ((y - x) * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (y * 4.0);
	double tmp;
	if (z <= -410000000.0) {
		tmp = z * ((y - x) * -6.0);
	} else if (z <= -1.16e-294) {
		tmp = x * (-3.0 + (6.0 * z));
	} else if (z <= 2.45e-104) {
		tmp = t_0;
	} else if (z <= 5e-73) {
		tmp = x * -3.0;
	} else if (z <= 0.68) {
		tmp = t_0;
	} else {
		tmp = -6.0 * ((y - x) * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (y * 4.0)
	tmp = 0
	if z <= -410000000.0:
		tmp = z * ((y - x) * -6.0)
	elif z <= -1.16e-294:
		tmp = x * (-3.0 + (6.0 * z))
	elif z <= 2.45e-104:
		tmp = t_0
	elif z <= 5e-73:
		tmp = x * -3.0
	elif z <= 0.68:
		tmp = t_0
	else:
		tmp = -6.0 * ((y - x) * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(y * 4.0))
	tmp = 0.0
	if (z <= -410000000.0)
		tmp = Float64(z * Float64(Float64(y - x) * -6.0));
	elseif (z <= -1.16e-294)
		tmp = Float64(x * Float64(-3.0 + Float64(6.0 * z)));
	elseif (z <= 2.45e-104)
		tmp = t_0;
	elseif (z <= 5e-73)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.68)
		tmp = t_0;
	else
		tmp = Float64(-6.0 * Float64(Float64(y - x) * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (y * 4.0);
	tmp = 0.0;
	if (z <= -410000000.0)
		tmp = z * ((y - x) * -6.0);
	elseif (z <= -1.16e-294)
		tmp = x * (-3.0 + (6.0 * z));
	elseif (z <= 2.45e-104)
		tmp = t_0;
	elseif (z <= 5e-73)
		tmp = x * -3.0;
	elseif (z <= 0.68)
		tmp = t_0;
	else
		tmp = -6.0 * ((y - x) * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -410000000.0], N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.16e-294], N[(x * N[(-3.0 + N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.45e-104], t$95$0, If[LessEqual[z, 5e-73], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.68], t$95$0, N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 2.45 \cdot 10^{-104}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-73}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.68:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -4.1e8

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e8 < z < -1.16000000000000006e-294

    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. Taylor expanded in x around inf 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.16000000000000006e-294 < z < 2.4500000000000001e-104 or 4.9999999999999998e-73 < z < 0.680000000000000049

    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. Taylor expanded in y around inf 65.9%

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

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

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

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

    if 2.4500000000000001e-104 < z < 4.9999999999999998e-73

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified78.3%

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

    if 0.680000000000000049 < z

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    5. Applied egg-rr99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -410000000:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.16 \cdot 10^{-294}:\\ \;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{elif}\;z \leq 2.45 \cdot 10^{-104}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-73}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 8: 74.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{if}\;z \leq -410000000:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-295}:\\ \;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{-102}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+15}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (+ 4.0 (* z -6.0)))))
   (if (<= z -410000000.0)
     (* z (* (- y x) -6.0))
     (if (<= z -9.5e-295)
       (* x (+ -3.0 (* 6.0 z)))
       (if (<= z 1.26e-102)
         t_0
         (if (<= z 6.5e-72)
           (* x -3.0)
           (if (<= z 4.2e+15) t_0 (* -6.0 (* (- y x) z)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (4.0 + (z * -6.0));
	double tmp;
	if (z <= -410000000.0) {
		tmp = z * ((y - x) * -6.0);
	} else if (z <= -9.5e-295) {
		tmp = x * (-3.0 + (6.0 * z));
	} else if (z <= 1.26e-102) {
		tmp = t_0;
	} else if (z <= 6.5e-72) {
		tmp = x * -3.0;
	} else if (z <= 4.2e+15) {
		tmp = t_0;
	} else {
		tmp = -6.0 * ((y - x) * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y * (4.0d0 + (z * (-6.0d0)))
    if (z <= (-410000000.0d0)) then
        tmp = z * ((y - x) * (-6.0d0))
    else if (z <= (-9.5d-295)) then
        tmp = x * ((-3.0d0) + (6.0d0 * z))
    else if (z <= 1.26d-102) then
        tmp = t_0
    else if (z <= 6.5d-72) then
        tmp = x * (-3.0d0)
    else if (z <= 4.2d+15) then
        tmp = t_0
    else
        tmp = (-6.0d0) * ((y - x) * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (4.0 + (z * -6.0));
	double tmp;
	if (z <= -410000000.0) {
		tmp = z * ((y - x) * -6.0);
	} else if (z <= -9.5e-295) {
		tmp = x * (-3.0 + (6.0 * z));
	} else if (z <= 1.26e-102) {
		tmp = t_0;
	} else if (z <= 6.5e-72) {
		tmp = x * -3.0;
	} else if (z <= 4.2e+15) {
		tmp = t_0;
	} else {
		tmp = -6.0 * ((y - x) * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (4.0 + (z * -6.0))
	tmp = 0
	if z <= -410000000.0:
		tmp = z * ((y - x) * -6.0)
	elif z <= -9.5e-295:
		tmp = x * (-3.0 + (6.0 * z))
	elif z <= 1.26e-102:
		tmp = t_0
	elif z <= 6.5e-72:
		tmp = x * -3.0
	elif z <= 4.2e+15:
		tmp = t_0
	else:
		tmp = -6.0 * ((y - x) * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(4.0 + Float64(z * -6.0)))
	tmp = 0.0
	if (z <= -410000000.0)
		tmp = Float64(z * Float64(Float64(y - x) * -6.0));
	elseif (z <= -9.5e-295)
		tmp = Float64(x * Float64(-3.0 + Float64(6.0 * z)));
	elseif (z <= 1.26e-102)
		tmp = t_0;
	elseif (z <= 6.5e-72)
		tmp = Float64(x * -3.0);
	elseif (z <= 4.2e+15)
		tmp = t_0;
	else
		tmp = Float64(-6.0 * Float64(Float64(y - x) * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (4.0 + (z * -6.0));
	tmp = 0.0;
	if (z <= -410000000.0)
		tmp = z * ((y - x) * -6.0);
	elseif (z <= -9.5e-295)
		tmp = x * (-3.0 + (6.0 * z));
	elseif (z <= 1.26e-102)
		tmp = t_0;
	elseif (z <= 6.5e-72)
		tmp = x * -3.0;
	elseif (z <= 4.2e+15)
		tmp = t_0;
	else
		tmp = -6.0 * ((y - x) * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -410000000.0], N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.5e-295], N[(x * N[(-3.0 + N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.26e-102], t$95$0, If[LessEqual[z, 6.5e-72], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4.2e+15], t$95$0, N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 1.26 \cdot 10^{-102}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-72}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+15}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -4.1e8

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e8 < z < -9.5e-295

    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. Taylor expanded in x around inf 62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.5e-295 < z < 1.2600000000000001e-102 or 6.4999999999999997e-72 < z < 4.2e15

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2600000000000001e-102 < z < 6.4999999999999997e-72

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified78.3%

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

    if 4.2e15 < z

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    5. Applied egg-rr99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -410000000:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-295}:\\ \;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-72}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+15}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 9: 50.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{+52}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1600:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.4:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+89}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))))
   (if (<= z -2.6e+52)
     (* y (* z -6.0))
     (if (<= z -1600.0)
       (* x (* 6.0 z))
       (if (<= z -1.4)
         t_0
         (if (<= z 0.68)
           (* x -3.0)
           (if (<= z 4.4e+89) t_0 (* 6.0 (* x z)))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -2.6e+52) {
		tmp = y * (z * -6.0);
	} else if (z <= -1600.0) {
		tmp = x * (6.0 * z);
	} else if (z <= -1.4) {
		tmp = t_0;
	} else if (z <= 0.68) {
		tmp = x * -3.0;
	} else if (z <= 4.4e+89) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    if (z <= (-2.6d+52)) then
        tmp = y * (z * (-6.0d0))
    else if (z <= (-1600.0d0)) then
        tmp = x * (6.0d0 * z)
    else if (z <= (-1.4d0)) then
        tmp = t_0
    else if (z <= 0.68d0) then
        tmp = x * (-3.0d0)
    else if (z <= 4.4d+89) then
        tmp = t_0
    else
        tmp = 6.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -2.6e+52) {
		tmp = y * (z * -6.0);
	} else if (z <= -1600.0) {
		tmp = x * (6.0 * z);
	} else if (z <= -1.4) {
		tmp = t_0;
	} else if (z <= 0.68) {
		tmp = x * -3.0;
	} else if (z <= 4.4e+89) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	tmp = 0
	if z <= -2.6e+52:
		tmp = y * (z * -6.0)
	elif z <= -1600.0:
		tmp = x * (6.0 * z)
	elif z <= -1.4:
		tmp = t_0
	elif z <= 0.68:
		tmp = x * -3.0
	elif z <= 4.4e+89:
		tmp = t_0
	else:
		tmp = 6.0 * (x * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -2.6e+52)
		tmp = Float64(y * Float64(z * -6.0));
	elseif (z <= -1600.0)
		tmp = Float64(x * Float64(6.0 * z));
	elseif (z <= -1.4)
		tmp = t_0;
	elseif (z <= 0.68)
		tmp = Float64(x * -3.0);
	elseif (z <= 4.4e+89)
		tmp = t_0;
	else
		tmp = Float64(6.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -2.6e+52)
		tmp = y * (z * -6.0);
	elseif (z <= -1600.0)
		tmp = x * (6.0 * z);
	elseif (z <= -1.4)
		tmp = t_0;
	elseif (z <= 0.68)
		tmp = x * -3.0;
	elseif (z <= 4.4e+89)
		tmp = t_0;
	else
		tmp = 6.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.6e+52], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1600.0], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.4], t$95$0, If[LessEqual[z, 0.68], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4.4e+89], t$95$0, N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1600:\\
\;\;\;\;x \cdot \left(6 \cdot z\right)\\

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

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

\mathbf{elif}\;z \leq 4.4 \cdot 10^{+89}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.6e52

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\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. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

    if -2.6e52 < z < -1600

    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. Taylor expanded in x around inf 82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1600 < z < -1.3999999999999999 or 0.680000000000000049 < z < 4.4e89

    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. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    5. Applied egg-rr99.8%

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

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

      \[\leadsto \color{blue}{-6 \cdot \left(y \cdot z\right)} \]
    8. Step-by-step derivation
      1. *-commutative69.9%

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

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

    if -1.3999999999999999 < z < 0.680000000000000049

    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. Taylor expanded in x around inf 52.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.4e89 < z

    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. Taylor expanded in x around inf 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+52}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1600:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.4:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+89}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 10: 50.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -4.5 \cdot 10^{+52}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1600:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -0.95:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))))
   (if (<= z -4.5e+52)
     (* y (* z -6.0))
     (if (<= z -1600.0)
       (* z (* x 6.0))
       (if (<= z -0.95)
         t_0
         (if (<= z 0.5)
           (* x -3.0)
           (if (<= z 8.6e+85) t_0 (* 6.0 (* x z)))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -4.5e+52) {
		tmp = y * (z * -6.0);
	} else if (z <= -1600.0) {
		tmp = z * (x * 6.0);
	} else if (z <= -0.95) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 8.6e+85) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    if (z <= (-4.5d+52)) then
        tmp = y * (z * (-6.0d0))
    else if (z <= (-1600.0d0)) then
        tmp = z * (x * 6.0d0)
    else if (z <= (-0.95d0)) then
        tmp = t_0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 8.6d+85) then
        tmp = t_0
    else
        tmp = 6.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -4.5e+52) {
		tmp = y * (z * -6.0);
	} else if (z <= -1600.0) {
		tmp = z * (x * 6.0);
	} else if (z <= -0.95) {
		tmp = t_0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 8.6e+85) {
		tmp = t_0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	tmp = 0
	if z <= -4.5e+52:
		tmp = y * (z * -6.0)
	elif z <= -1600.0:
		tmp = z * (x * 6.0)
	elif z <= -0.95:
		tmp = t_0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 8.6e+85:
		tmp = t_0
	else:
		tmp = 6.0 * (x * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -4.5e+52)
		tmp = Float64(y * Float64(z * -6.0));
	elseif (z <= -1600.0)
		tmp = Float64(z * Float64(x * 6.0));
	elseif (z <= -0.95)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 8.6e+85)
		tmp = t_0;
	else
		tmp = Float64(6.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -4.5e+52)
		tmp = y * (z * -6.0);
	elseif (z <= -1600.0)
		tmp = z * (x * 6.0);
	elseif (z <= -0.95)
		tmp = t_0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 8.6e+85)
		tmp = t_0;
	else
		tmp = 6.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+52], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1600.0], N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -0.95], t$95$0, If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 8.6e+85], t$95$0, N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1600:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\

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

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

\mathbf{elif}\;z \leq 8.6 \cdot 10^{+85}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -4.5e52

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\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. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

    if -4.5e52 < z < -1600

    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. Taylor expanded in x around inf 82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1600 < z < -0.94999999999999996 or 0.5 < z < 8.5999999999999998e85

    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. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    5. Applied egg-rr99.8%

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

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

      \[\leadsto \color{blue}{-6 \cdot \left(y \cdot z\right)} \]
    8. Step-by-step derivation
      1. *-commutative69.9%

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

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

    if -0.94999999999999996 < z < 0.5

    1. Initial program 99.4%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. 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. Taylor expanded in x around inf 52.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.5999999999999998e85 < z

    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. Taylor expanded in x around inf 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{+52}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1600:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -0.95:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{+85}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 11: 97.8% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;z \leq 0.55:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\

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


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

    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. Step-by-step derivation
      1. +-commutative99.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(z \cdot \left(y - x\right)\right) \cdot -6} \]
      2. associate-*r*97.2%

        \[\leadsto \color{blue}{z \cdot \left(\left(y - x\right) \cdot -6\right)} \]
      3. *-commutative97.2%

        \[\leadsto z \cdot \color{blue}{\left(-6 \cdot \left(y - x\right)\right)} \]
    8. Simplified97.2%

      \[\leadsto \color{blue}{z \cdot \left(-6 \cdot \left(y - x\right)\right)} \]

    if -0.55000000000000004 < z < 0.55000000000000004

    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. Taylor expanded in x around 0 99.6%

      \[\leadsto \color{blue}{\left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \cdot x + 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)} \]
    5. Step-by-step derivation
      1. fma-def99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(1 + -6 \cdot \left(0.6666666666666666 - z\right), x, 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\right)} \]
      2. associate-*r*99.7%

        \[\leadsto \mathsf{fma}\left(1 + -6 \cdot \left(0.6666666666666666 - z\right), x, \color{blue}{\left(6 \cdot y\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
    6. Simplified99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1 + -6 \cdot \left(0.6666666666666666 - z\right), x, \left(6 \cdot y\right) \cdot \left(0.6666666666666666 - z\right)\right)} \]
    7. Taylor expanded in z around 0 98.6%

      \[\leadsto \color{blue}{-3 \cdot x + 4 \cdot y} \]

    if 0.55000000000000004 < z

    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. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) + x} \]
      2. associate-*l*99.8%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)} + x \]
      3. *-commutative99.8%

        \[\leadsto \left(y - x\right) \cdot \color{blue}{\left(\left(0.6666666666666666 - z\right) \cdot 6\right)} + x \]
      4. associate-*r*99.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot 6} + x \]
      5. fma-def99.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    6. Taylor expanded in z around inf 99.4%

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.55:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 12: 99.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (- 0.6666666666666666 z) (* (- y x) 6.0))))
double code(double x, double y, double z) {
	return x + ((0.6666666666666666 - z) * ((y - x) * 6.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 + ((0.6666666666666666d0 - z) * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
	return x + ((0.6666666666666666 - z) * ((y - x) * 6.0));
}
def code(x, y, z):
	return x + ((0.6666666666666666 - z) * ((y - x) * 6.0))
function code(x, y, z)
	return Float64(x + Float64(Float64(0.6666666666666666 - z) * Float64(Float64(y - x) * 6.0)))
end
function tmp = code(x, y, z)
	tmp = x + ((0.6666666666666666 - z) * ((y - x) * 6.0));
end
code[x_, y_, z_] := N[(x + N[(N[(0.6666666666666666 - z), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Derivation
  1. Initial program 99.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. 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. Final simplification99.6%

    \[\leadsto x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right) \]

Alternative 13: 50.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.95 \lor \neg \left(z \leq 0.55\right):\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.95) (not (<= z 0.55))) (* -6.0 (* y z)) (* x -3.0)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.95) || !(z <= 0.55)) {
		tmp = -6.0 * (y * z);
	} 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 <= (-1.95d0)) .or. (.not. (z <= 0.55d0))) then
        tmp = (-6.0d0) * (y * z)
    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 <= -1.95) || !(z <= 0.55)) {
		tmp = -6.0 * (y * z);
	} else {
		tmp = x * -3.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.95) or not (z <= 0.55):
		tmp = -6.0 * (y * z)
	else:
		tmp = x * -3.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.95) || !(z <= 0.55))
		tmp = Float64(-6.0 * Float64(y * z));
	else
		tmp = Float64(x * -3.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.95) || ~((z <= 0.55)))
		tmp = -6.0 * (y * z);
	else
		tmp = x * -3.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.95], N[Not[LessEqual[z, 0.55]], $MachinePrecision]], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \lor \neg \left(z \leq 0.55\right):\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot -3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.94999999999999996 or 0.55000000000000004 < z

    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. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) + x} \]
      2. associate-*l*99.8%

        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)} + x \]
      3. *-commutative99.8%

        \[\leadsto \left(y - x\right) \cdot \color{blue}{\left(\left(0.6666666666666666 - z\right) \cdot 6\right)} + x \]
      4. associate-*r*99.7%

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot 6} + x \]
      5. fma-def99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right), 6, x\right)} \]
    6. Taylor expanded in z around inf 98.2%

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    7. Taylor expanded in y around inf 49.3%

      \[\leadsto \color{blue}{-6 \cdot \left(y \cdot z\right)} \]
    8. Step-by-step derivation
      1. *-commutative49.3%

        \[\leadsto -6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    9. Simplified49.3%

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot y\right)} \]

    if -1.94999999999999996 < z < 0.55000000000000004

    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. Taylor expanded in x around inf 52.7%

      \[\leadsto \color{blue}{\left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \cdot x} \]
    5. Step-by-step derivation
      1. *-commutative52.7%

        \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      2. +-commutative52.7%

        \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
      3. sub-neg52.7%

        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
      4. distribute-rgt-in52.7%

        \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
      5. metadata-eval52.7%

        \[\leadsto x \cdot \left(\left(\color{blue}{-4} + \left(-z\right) \cdot -6\right) + 1\right) \]
      6. metadata-eval52.7%

        \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + \left(-z\right) \cdot -6\right) + 1\right) \]
      7. neg-mul-152.7%

        \[\leadsto x \cdot \left(\left(-1 \cdot 4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
      8. associate-*r*52.7%

        \[\leadsto x \cdot \left(\left(-1 \cdot 4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
      9. *-commutative52.7%

        \[\leadsto x \cdot \left(\left(-1 \cdot 4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
      10. distribute-lft-in52.7%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
      11. +-commutative52.7%

        \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
      12. distribute-lft-in52.7%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      13. associate-+r+52.7%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -1 \cdot 4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
      14. metadata-eval52.7%

        \[\leadsto x \cdot \left(\left(1 + \color{blue}{-4}\right) + -1 \cdot \left(-6 \cdot z\right)\right) \]
      15. metadata-eval52.7%

        \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      16. metadata-eval52.7%

        \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
      17. distribute-lft-in52.7%

        \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(3 + -6 \cdot z\right)\right)} \]
      18. +-commutative52.7%

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
      19. distribute-rgt-in52.7%

        \[\leadsto x \cdot \color{blue}{\left(\left(-6 \cdot z\right) \cdot -1 + 3 \cdot -1\right)} \]
      20. *-commutative52.7%

        \[\leadsto x \cdot \left(\color{blue}{\left(z \cdot -6\right)} \cdot -1 + 3 \cdot -1\right) \]
      21. associate-*l*52.7%

        \[\leadsto x \cdot \left(\color{blue}{z \cdot \left(-6 \cdot -1\right)} + 3 \cdot -1\right) \]
      22. metadata-eval52.7%

        \[\leadsto x \cdot \left(z \cdot \color{blue}{6} + 3 \cdot -1\right) \]
      23. metadata-eval52.7%

        \[\leadsto x \cdot \left(z \cdot 6 + \color{blue}{-3}\right) \]
    6. Simplified52.7%

      \[\leadsto \color{blue}{x \cdot \left(z \cdot 6 + -3\right)} \]
    7. Taylor expanded in z around 0 51.8%

      \[\leadsto \color{blue}{-3 \cdot x} \]
    8. Step-by-step derivation
      1. *-commutative51.8%

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified51.8%

      \[\leadsto \color{blue}{x \cdot -3} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.95 \lor \neg \left(z \leq 0.55\right):\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]

Alternative 14: 26.4% accurate, 4.3× speedup?

\[\begin{array}{l} \\ x \cdot -3 \end{array} \]
(FPCore (x y z) :precision binary64 (* x -3.0))
double code(double x, double y, double z) {
	return x * -3.0;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x * (-3.0d0)
end function
public static double code(double x, double y, double z) {
	return x * -3.0;
}
def code(x, y, z):
	return x * -3.0
function code(x, y, z)
	return Float64(x * -3.0)
end
function tmp = code(x, y, z)
	tmp = x * -3.0;
end
code[x_, y_, z_] := N[(x * -3.0), $MachinePrecision]
\begin{array}{l}

\\
x \cdot -3
\end{array}
Derivation
  1. Initial program 99.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. 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. Taylor expanded in x around inf 54.2%

    \[\leadsto \color{blue}{\left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \cdot x} \]
  5. Step-by-step derivation
    1. *-commutative54.2%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    2. +-commutative54.2%

      \[\leadsto x \cdot \color{blue}{\left(-6 \cdot \left(0.6666666666666666 - z\right) + 1\right)} \]
    3. sub-neg54.2%

      \[\leadsto x \cdot \left(-6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)} + 1\right) \]
    4. distribute-rgt-in54.2%

      \[\leadsto x \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot -6 + \left(-z\right) \cdot -6\right)} + 1\right) \]
    5. metadata-eval54.2%

      \[\leadsto x \cdot \left(\left(\color{blue}{-4} + \left(-z\right) \cdot -6\right) + 1\right) \]
    6. metadata-eval54.2%

      \[\leadsto x \cdot \left(\left(\color{blue}{-1 \cdot 4} + \left(-z\right) \cdot -6\right) + 1\right) \]
    7. neg-mul-154.2%

      \[\leadsto x \cdot \left(\left(-1 \cdot 4 + \color{blue}{\left(-1 \cdot z\right)} \cdot -6\right) + 1\right) \]
    8. associate-*r*54.2%

      \[\leadsto x \cdot \left(\left(-1 \cdot 4 + \color{blue}{-1 \cdot \left(z \cdot -6\right)}\right) + 1\right) \]
    9. *-commutative54.2%

      \[\leadsto x \cdot \left(\left(-1 \cdot 4 + -1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) + 1\right) \]
    10. distribute-lft-in54.2%

      \[\leadsto x \cdot \left(\color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)} + 1\right) \]
    11. +-commutative54.2%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(4 + -6 \cdot z\right)\right)} \]
    12. distribute-lft-in54.2%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-1 \cdot 4 + -1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
    13. associate-+r+54.2%

      \[\leadsto x \cdot \color{blue}{\left(\left(1 + -1 \cdot 4\right) + -1 \cdot \left(-6 \cdot z\right)\right)} \]
    14. metadata-eval54.2%

      \[\leadsto x \cdot \left(\left(1 + \color{blue}{-4}\right) + -1 \cdot \left(-6 \cdot z\right)\right) \]
    15. metadata-eval54.2%

      \[\leadsto x \cdot \left(\color{blue}{-3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
    16. metadata-eval54.2%

      \[\leadsto x \cdot \left(\color{blue}{-1 \cdot 3} + -1 \cdot \left(-6 \cdot z\right)\right) \]
    17. distribute-lft-in54.2%

      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(3 + -6 \cdot z\right)\right)} \]
    18. +-commutative54.2%

      \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z + 3\right)}\right) \]
    19. distribute-rgt-in54.2%

      \[\leadsto x \cdot \color{blue}{\left(\left(-6 \cdot z\right) \cdot -1 + 3 \cdot -1\right)} \]
    20. *-commutative54.2%

      \[\leadsto x \cdot \left(\color{blue}{\left(z \cdot -6\right)} \cdot -1 + 3 \cdot -1\right) \]
    21. associate-*l*54.2%

      \[\leadsto x \cdot \left(\color{blue}{z \cdot \left(-6 \cdot -1\right)} + 3 \cdot -1\right) \]
    22. metadata-eval54.2%

      \[\leadsto x \cdot \left(z \cdot \color{blue}{6} + 3 \cdot -1\right) \]
    23. metadata-eval54.2%

      \[\leadsto x \cdot \left(z \cdot 6 + \color{blue}{-3}\right) \]
  6. Simplified54.2%

    \[\leadsto \color{blue}{x \cdot \left(z \cdot 6 + -3\right)} \]
  7. Taylor expanded in z around 0 29.0%

    \[\leadsto \color{blue}{-3 \cdot x} \]
  8. Step-by-step derivation
    1. *-commutative29.0%

      \[\leadsto \color{blue}{x \cdot -3} \]
  9. Simplified29.0%

    \[\leadsto \color{blue}{x \cdot -3} \]
  10. Final simplification29.0%

    \[\leadsto x \cdot -3 \]

Alternative 15: 2.6% accurate, 13.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
	return x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
public static double code(double x, double y, double z) {
	return x;
}
def code(x, y, z):
	return x
function code(x, y, z)
	return x
end
function tmp = code(x, y, z)
	tmp = x;
end
code[x_, y_, z_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 99.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. 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. Taylor expanded in y around inf 48.7%

    \[\leadsto x + \color{blue}{6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)} \]
  5. Step-by-step derivation
    1. associate-*r*48.7%

      \[\leadsto x + \color{blue}{\left(6 \cdot y\right) \cdot \left(0.6666666666666666 - z\right)} \]
  6. Simplified48.7%

    \[\leadsto x + \color{blue}{\left(6 \cdot y\right) \cdot \left(0.6666666666666666 - z\right)} \]
  7. Taylor expanded in x around inf 2.5%

    \[\leadsto \color{blue}{x} \]
  8. Final simplification2.5%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023279 
(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))))