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

Percentage Accurate: 99.5% → 99.7%
Time: 9.9s
Alternatives: 16
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 16 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(y - x, 4 + z \cdot -6, 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. sub-neg99.8%

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

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

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

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

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

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

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

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

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

Alternative 2: 50.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -2.7 \cdot 10^{+187}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -0.55:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -7.4 \cdot 10^{-174}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-246}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-299}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-218}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))))
   (if (<= z -2.7e+187)
     (* -6.0 (* y z))
     (if (<= z -0.55)
       t_0
       (if (<= z -7.4e-174)
         (* y 4.0)
         (if (<= z -2.6e-246)
           (* x -3.0)
           (if (<= z -1.5e-299)
             (* y 4.0)
             (if (<= z 8.5e-218)
               (* x -3.0)
               (if (<= z 4e-70)
                 (* y 4.0)
                 (if (<= z 1.3e-8)
                   (* x -3.0)
                   (if (<= z 0.55) (* y 4.0) t_0)))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.7e+187) {
		tmp = -6.0 * (y * z);
	} else if (z <= -0.55) {
		tmp = t_0;
	} else if (z <= -7.4e-174) {
		tmp = y * 4.0;
	} else if (z <= -2.6e-246) {
		tmp = x * -3.0;
	} else if (z <= -1.5e-299) {
		tmp = y * 4.0;
	} else if (z <= 8.5e-218) {
		tmp = x * -3.0;
	} else if (z <= 4e-70) {
		tmp = y * 4.0;
	} else if (z <= 1.3e-8) {
		tmp = x * -3.0;
	} else if (z <= 0.55) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    if (z <= (-2.7d+187)) then
        tmp = (-6.0d0) * (y * z)
    else if (z <= (-0.55d0)) then
        tmp = t_0
    else if (z <= (-7.4d-174)) then
        tmp = y * 4.0d0
    else if (z <= (-2.6d-246)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.5d-299)) then
        tmp = y * 4.0d0
    else if (z <= 8.5d-218) then
        tmp = x * (-3.0d0)
    else if (z <= 4d-70) then
        tmp = y * 4.0d0
    else if (z <= 1.3d-8) then
        tmp = x * (-3.0d0)
    else if (z <= 0.55d0) then
        tmp = y * 4.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.7e+187) {
		tmp = -6.0 * (y * z);
	} else if (z <= -0.55) {
		tmp = t_0;
	} else if (z <= -7.4e-174) {
		tmp = y * 4.0;
	} else if (z <= -2.6e-246) {
		tmp = x * -3.0;
	} else if (z <= -1.5e-299) {
		tmp = y * 4.0;
	} else if (z <= 8.5e-218) {
		tmp = x * -3.0;
	} else if (z <= 4e-70) {
		tmp = y * 4.0;
	} else if (z <= 1.3e-8) {
		tmp = x * -3.0;
	} else if (z <= 0.55) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	tmp = 0
	if z <= -2.7e+187:
		tmp = -6.0 * (y * z)
	elif z <= -0.55:
		tmp = t_0
	elif z <= -7.4e-174:
		tmp = y * 4.0
	elif z <= -2.6e-246:
		tmp = x * -3.0
	elif z <= -1.5e-299:
		tmp = y * 4.0
	elif z <= 8.5e-218:
		tmp = x * -3.0
	elif z <= 4e-70:
		tmp = y * 4.0
	elif z <= 1.3e-8:
		tmp = x * -3.0
	elif z <= 0.55:
		tmp = y * 4.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -2.7e+187)
		tmp = Float64(-6.0 * Float64(y * z));
	elseif (z <= -0.55)
		tmp = t_0;
	elseif (z <= -7.4e-174)
		tmp = Float64(y * 4.0);
	elseif (z <= -2.6e-246)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.5e-299)
		tmp = Float64(y * 4.0);
	elseif (z <= 8.5e-218)
		tmp = Float64(x * -3.0);
	elseif (z <= 4e-70)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.3e-8)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.55)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -2.7e+187)
		tmp = -6.0 * (y * z);
	elseif (z <= -0.55)
		tmp = t_0;
	elseif (z <= -7.4e-174)
		tmp = y * 4.0;
	elseif (z <= -2.6e-246)
		tmp = x * -3.0;
	elseif (z <= -1.5e-299)
		tmp = y * 4.0;
	elseif (z <= 8.5e-218)
		tmp = x * -3.0;
	elseif (z <= 4e-70)
		tmp = y * 4.0;
	elseif (z <= 1.3e-8)
		tmp = x * -3.0;
	elseif (z <= 0.55)
		tmp = y * 4.0;
	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]}, If[LessEqual[z, -2.7e+187], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -0.55], t$95$0, If[LessEqual[z, -7.4e-174], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -2.6e-246], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.5e-299], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 8.5e-218], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4e-70], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.3e-8], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.55], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -7.4 \cdot 10^{-174}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq -1.5 \cdot 10^{-299}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-218}:\\
\;\;\;\;x \cdot -3\\

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

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

\mathbf{elif}\;z \leq 0.55:\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.70000000000000008e187

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-199.9%

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

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

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

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

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

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

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

    if -2.70000000000000008e187 < z < -0.55000000000000004 or 0.55000000000000004 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.55000000000000004 < z < -7.40000000000000019e-174 or -2.5999999999999999e-246 < z < -1.49999999999999992e-299 or 8.5000000000000004e-218 < z < 3.99999999999999998e-70 or 1.3000000000000001e-8 < z < 0.55000000000000004

    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 z around 0 97.2%

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

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

    if -7.40000000000000019e-174 < z < -2.5999999999999999e-246 or -1.49999999999999992e-299 < z < 8.5000000000000004e-218 or 3.99999999999999998e-70 < z < 1.3000000000000001e-8

    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 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{+187}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -0.55:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -7.4 \cdot 10^{-174}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-246}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-299}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-218}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 50.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -2.75 \cdot 10^{+187}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.24:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-246}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-301}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.36 \cdot 10^{-220}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-12}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))))
   (if (<= z -2.75e+187)
     (* z (* y -6.0))
     (if (<= z -0.24)
       t_0
       (if (<= z -3.9e-177)
         (* y 4.0)
         (if (<= z -2.6e-246)
           (* x -3.0)
           (if (<= z -7.5e-301)
             (* y 4.0)
             (if (<= z 1.36e-220)
               (* x -3.0)
               (if (<= z 2.55e-70)
                 (* y 4.0)
                 (if (<= z 1.5e-12)
                   (* x -3.0)
                   (if (<= z 0.5) (* y 4.0) t_0)))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.75e+187) {
		tmp = z * (y * -6.0);
	} else if (z <= -0.24) {
		tmp = t_0;
	} else if (z <= -3.9e-177) {
		tmp = y * 4.0;
	} else if (z <= -2.6e-246) {
		tmp = x * -3.0;
	} else if (z <= -7.5e-301) {
		tmp = y * 4.0;
	} else if (z <= 1.36e-220) {
		tmp = x * -3.0;
	} else if (z <= 2.55e-70) {
		tmp = y * 4.0;
	} else if (z <= 1.5e-12) {
		tmp = x * -3.0;
	} else if (z <= 0.5) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    if (z <= (-2.75d+187)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-0.24d0)) then
        tmp = t_0
    else if (z <= (-3.9d-177)) then
        tmp = y * 4.0d0
    else if (z <= (-2.6d-246)) then
        tmp = x * (-3.0d0)
    else if (z <= (-7.5d-301)) then
        tmp = y * 4.0d0
    else if (z <= 1.36d-220) then
        tmp = x * (-3.0d0)
    else if (z <= 2.55d-70) then
        tmp = y * 4.0d0
    else if (z <= 1.5d-12) then
        tmp = x * (-3.0d0)
    else if (z <= 0.5d0) then
        tmp = y * 4.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -2.75e+187) {
		tmp = z * (y * -6.0);
	} else if (z <= -0.24) {
		tmp = t_0;
	} else if (z <= -3.9e-177) {
		tmp = y * 4.0;
	} else if (z <= -2.6e-246) {
		tmp = x * -3.0;
	} else if (z <= -7.5e-301) {
		tmp = y * 4.0;
	} else if (z <= 1.36e-220) {
		tmp = x * -3.0;
	} else if (z <= 2.55e-70) {
		tmp = y * 4.0;
	} else if (z <= 1.5e-12) {
		tmp = x * -3.0;
	} else if (z <= 0.5) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	tmp = 0
	if z <= -2.75e+187:
		tmp = z * (y * -6.0)
	elif z <= -0.24:
		tmp = t_0
	elif z <= -3.9e-177:
		tmp = y * 4.0
	elif z <= -2.6e-246:
		tmp = x * -3.0
	elif z <= -7.5e-301:
		tmp = y * 4.0
	elif z <= 1.36e-220:
		tmp = x * -3.0
	elif z <= 2.55e-70:
		tmp = y * 4.0
	elif z <= 1.5e-12:
		tmp = x * -3.0
	elif z <= 0.5:
		tmp = y * 4.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -2.75e+187)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -0.24)
		tmp = t_0;
	elseif (z <= -3.9e-177)
		tmp = Float64(y * 4.0);
	elseif (z <= -2.6e-246)
		tmp = Float64(x * -3.0);
	elseif (z <= -7.5e-301)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.36e-220)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.55e-70)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.5e-12)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.5)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -2.75e+187)
		tmp = z * (y * -6.0);
	elseif (z <= -0.24)
		tmp = t_0;
	elseif (z <= -3.9e-177)
		tmp = y * 4.0;
	elseif (z <= -2.6e-246)
		tmp = x * -3.0;
	elseif (z <= -7.5e-301)
		tmp = y * 4.0;
	elseif (z <= 1.36e-220)
		tmp = x * -3.0;
	elseif (z <= 2.55e-70)
		tmp = y * 4.0;
	elseif (z <= 1.5e-12)
		tmp = x * -3.0;
	elseif (z <= 0.5)
		tmp = y * 4.0;
	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]}, If[LessEqual[z, -2.75e+187], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -0.24], t$95$0, If[LessEqual[z, -3.9e-177], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -2.6e-246], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -7.5e-301], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.36e-220], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.55e-70], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.5e-12], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -3.9 \cdot 10^{-177}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq -7.5 \cdot 10^{-301}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 1.36 \cdot 10^{-220}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 2.55 \cdot 10^{-70}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 1.5 \cdot 10^{-12}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.74999999999999999e187

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-199.9%

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

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

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

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

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

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

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

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

    if -2.74999999999999999e187 < z < -0.23999999999999999 or 0.5 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.23999999999999999 < z < -3.90000000000000014e-177 or -2.5999999999999999e-246 < z < -7.5000000000000006e-301 or 1.3600000000000001e-220 < z < 2.55000000000000013e-70 or 1.5000000000000001e-12 < z < 0.5

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. 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 z around 0 97.2%

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

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

    if -3.90000000000000014e-177 < z < -2.5999999999999999e-246 or -7.5000000000000006e-301 < z < 1.3600000000000001e-220 or 2.55000000000000013e-70 < z < 1.5000000000000001e-12

    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 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.75 \cdot 10^{+187}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.24:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-246}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-301}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.36 \cdot 10^{-220}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-12}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 4: 50.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+186}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.017:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-247}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-303}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-213}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.46 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-13}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -4.1e+186)
   (* z (* y -6.0))
   (if (<= z -0.017)
     (* 6.0 (* x z))
     (if (<= z -6.2e-177)
       (* y 4.0)
       (if (<= z -2.45e-247)
         (* x -3.0)
         (if (<= z -9.5e-303)
           (* y 4.0)
           (if (<= z 4.5e-213)
             (* x -3.0)
             (if (<= z 2.46e-70)
               (* y 4.0)
               (if (<= z 8.5e-13)
                 (* x -3.0)
                 (if (<= z 0.56) (* y 4.0) (* z (* x 6.0))))))))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.1e+186) {
		tmp = z * (y * -6.0);
	} else if (z <= -0.017) {
		tmp = 6.0 * (x * z);
	} else if (z <= -6.2e-177) {
		tmp = y * 4.0;
	} else if (z <= -2.45e-247) {
		tmp = x * -3.0;
	} else if (z <= -9.5e-303) {
		tmp = y * 4.0;
	} else if (z <= 4.5e-213) {
		tmp = x * -3.0;
	} else if (z <= 2.46e-70) {
		tmp = y * 4.0;
	} else if (z <= 8.5e-13) {
		tmp = x * -3.0;
	} else if (z <= 0.56) {
		tmp = y * 4.0;
	} else {
		tmp = z * (x * 6.0);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-4.1d+186)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-0.017d0)) then
        tmp = 6.0d0 * (x * z)
    else if (z <= (-6.2d-177)) then
        tmp = y * 4.0d0
    else if (z <= (-2.45d-247)) then
        tmp = x * (-3.0d0)
    else if (z <= (-9.5d-303)) then
        tmp = y * 4.0d0
    else if (z <= 4.5d-213) then
        tmp = x * (-3.0d0)
    else if (z <= 2.46d-70) then
        tmp = y * 4.0d0
    else if (z <= 8.5d-13) then
        tmp = x * (-3.0d0)
    else if (z <= 0.56d0) then
        tmp = y * 4.0d0
    else
        tmp = z * (x * 6.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.1e+186) {
		tmp = z * (y * -6.0);
	} else if (z <= -0.017) {
		tmp = 6.0 * (x * z);
	} else if (z <= -6.2e-177) {
		tmp = y * 4.0;
	} else if (z <= -2.45e-247) {
		tmp = x * -3.0;
	} else if (z <= -9.5e-303) {
		tmp = y * 4.0;
	} else if (z <= 4.5e-213) {
		tmp = x * -3.0;
	} else if (z <= 2.46e-70) {
		tmp = y * 4.0;
	} else if (z <= 8.5e-13) {
		tmp = x * -3.0;
	} else if (z <= 0.56) {
		tmp = y * 4.0;
	} else {
		tmp = z * (x * 6.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -4.1e+186:
		tmp = z * (y * -6.0)
	elif z <= -0.017:
		tmp = 6.0 * (x * z)
	elif z <= -6.2e-177:
		tmp = y * 4.0
	elif z <= -2.45e-247:
		tmp = x * -3.0
	elif z <= -9.5e-303:
		tmp = y * 4.0
	elif z <= 4.5e-213:
		tmp = x * -3.0
	elif z <= 2.46e-70:
		tmp = y * 4.0
	elif z <= 8.5e-13:
		tmp = x * -3.0
	elif z <= 0.56:
		tmp = y * 4.0
	else:
		tmp = z * (x * 6.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -4.1e+186)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -0.017)
		tmp = Float64(6.0 * Float64(x * z));
	elseif (z <= -6.2e-177)
		tmp = Float64(y * 4.0);
	elseif (z <= -2.45e-247)
		tmp = Float64(x * -3.0);
	elseif (z <= -9.5e-303)
		tmp = Float64(y * 4.0);
	elseif (z <= 4.5e-213)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.46e-70)
		tmp = Float64(y * 4.0);
	elseif (z <= 8.5e-13)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.56)
		tmp = Float64(y * 4.0);
	else
		tmp = Float64(z * Float64(x * 6.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -4.1e+186)
		tmp = z * (y * -6.0);
	elseif (z <= -0.017)
		tmp = 6.0 * (x * z);
	elseif (z <= -6.2e-177)
		tmp = y * 4.0;
	elseif (z <= -2.45e-247)
		tmp = x * -3.0;
	elseif (z <= -9.5e-303)
		tmp = y * 4.0;
	elseif (z <= 4.5e-213)
		tmp = x * -3.0;
	elseif (z <= 2.46e-70)
		tmp = y * 4.0;
	elseif (z <= 8.5e-13)
		tmp = x * -3.0;
	elseif (z <= 0.56)
		tmp = y * 4.0;
	else
		tmp = z * (x * 6.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -4.1e+186], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -0.017], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -6.2e-177], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -2.45e-247], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -9.5e-303], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.5e-213], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.46e-70], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 8.5e-13], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.56], N[(y * 4.0), $MachinePrecision], N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+186}:\\
\;\;\;\;z \cdot \left(y \cdot -6\right)\\

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

\mathbf{elif}\;z \leq -6.2 \cdot 10^{-177}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -2.45 \cdot 10^{-247}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -9.5 \cdot 10^{-303}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 2.46 \cdot 10^{-70}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-13}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.56:\\
\;\;\;\;y \cdot 4\\

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


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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-199.9%

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

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

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

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

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

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

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

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

    if -4.1e186 < z < -0.017000000000000001

    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. Taylor expanded in x around 0 99.6%

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

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

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

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

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

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

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

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

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

    if -0.017000000000000001 < z < -6.20000000000000036e-177 or -2.45e-247 < z < -9.4999999999999999e-303 or 4.5000000000000001e-213 < z < 2.4600000000000001e-70 or 8.5000000000000001e-13 < z < 0.56000000000000005

    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 z around 0 97.2%

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

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

    if -6.20000000000000036e-177 < z < -2.45e-247 or -9.4999999999999999e-303 < z < 4.5000000000000001e-213 or 2.4600000000000001e-70 < z < 8.5000000000000001e-13

    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 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.56000000000000005 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(0.6666666666666666 - z\right) \cdot \color{blue}{{\left(\sqrt[3]{\left(y - x\right) \cdot 6}\right)}^{2}}, \sqrt[3]{\left(y - x\right) \cdot 6}, x\right) \]
    5. Applied egg-rr98.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-199.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+186}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.017:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-247}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-303}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-213}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.46 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-13}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.56:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \end{array} \]

Alternative 5: 73.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.0225:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-248}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-303}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-215}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* (- y x) z))))
   (if (<= z -0.0225)
     t_0
     (if (<= z -8e-177)
       (* y 4.0)
       (if (<= z -5.5e-248)
         (* x -3.0)
         (if (<= z 1.8e-303)
           (* y 4.0)
           (if (<= z 7e-215)
             (* x -3.0)
             (if (<= z 5.4e-68)
               (* y 4.0)
               (if (<= z 1.3e-8)
                 (* x -3.0)
                 (if (<= z 0.62) (* y 4.0) t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -0.0225) {
		tmp = t_0;
	} else if (z <= -8e-177) {
		tmp = y * 4.0;
	} else if (z <= -5.5e-248) {
		tmp = x * -3.0;
	} else if (z <= 1.8e-303) {
		tmp = y * 4.0;
	} else if (z <= 7e-215) {
		tmp = x * -3.0;
	} else if (z <= 5.4e-68) {
		tmp = y * 4.0;
	} else if (z <= 1.3e-8) {
		tmp = x * -3.0;
	} else if (z <= 0.62) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * ((y - x) * z)
    if (z <= (-0.0225d0)) then
        tmp = t_0
    else if (z <= (-8d-177)) then
        tmp = y * 4.0d0
    else if (z <= (-5.5d-248)) then
        tmp = x * (-3.0d0)
    else if (z <= 1.8d-303) then
        tmp = y * 4.0d0
    else if (z <= 7d-215) then
        tmp = x * (-3.0d0)
    else if (z <= 5.4d-68) then
        tmp = y * 4.0d0
    else if (z <= 1.3d-8) then
        tmp = x * (-3.0d0)
    else if (z <= 0.62d0) then
        tmp = y * 4.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -0.0225) {
		tmp = t_0;
	} else if (z <= -8e-177) {
		tmp = y * 4.0;
	} else if (z <= -5.5e-248) {
		tmp = x * -3.0;
	} else if (z <= 1.8e-303) {
		tmp = y * 4.0;
	} else if (z <= 7e-215) {
		tmp = x * -3.0;
	} else if (z <= 5.4e-68) {
		tmp = y * 4.0;
	} else if (z <= 1.3e-8) {
		tmp = x * -3.0;
	} else if (z <= 0.62) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -0.0225:
		tmp = t_0
	elif z <= -8e-177:
		tmp = y * 4.0
	elif z <= -5.5e-248:
		tmp = x * -3.0
	elif z <= 1.8e-303:
		tmp = y * 4.0
	elif z <= 7e-215:
		tmp = x * -3.0
	elif z <= 5.4e-68:
		tmp = y * 4.0
	elif z <= 1.3e-8:
		tmp = x * -3.0
	elif z <= 0.62:
		tmp = y * 4.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -0.0225)
		tmp = t_0;
	elseif (z <= -8e-177)
		tmp = Float64(y * 4.0);
	elseif (z <= -5.5e-248)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.8e-303)
		tmp = Float64(y * 4.0);
	elseif (z <= 7e-215)
		tmp = Float64(x * -3.0);
	elseif (z <= 5.4e-68)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.3e-8)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.62)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -0.0225)
		tmp = t_0;
	elseif (z <= -8e-177)
		tmp = y * 4.0;
	elseif (z <= -5.5e-248)
		tmp = x * -3.0;
	elseif (z <= 1.8e-303)
		tmp = y * 4.0;
	elseif (z <= 7e-215)
		tmp = x * -3.0;
	elseif (z <= 5.4e-68)
		tmp = y * 4.0;
	elseif (z <= 1.3e-8)
		tmp = x * -3.0;
	elseif (z <= 0.62)
		tmp = y * 4.0;
	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]}, If[LessEqual[z, -0.0225], t$95$0, If[LessEqual[z, -8e-177], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -5.5e-248], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.8e-303], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 7e-215], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 5.4e-68], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.3e-8], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.62], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -8 \cdot 10^{-177}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -5.5 \cdot 10^{-248}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-303}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 7 \cdot 10^{-215}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 5.4 \cdot 10^{-68}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 0.62:\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.022499999999999999 or 0.619999999999999996 < 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. *-commutative99.8%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(0.6666666666666666 - z\right) \cdot \color{blue}{{\left(\sqrt[3]{\left(y - x\right) \cdot 6}\right)}^{2}}, \sqrt[3]{\left(y - x\right) \cdot 6}, x\right) \]
    5. Applied egg-rr98.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-197.0%

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

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

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

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

    if -0.022499999999999999 < z < -7.99999999999999962e-177 or -5.49999999999999979e-248 < z < 1.7999999999999999e-303 or 7.0000000000000004e-215 < z < 5.4000000000000003e-68 or 1.3000000000000001e-8 < z < 0.619999999999999996

    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 z around 0 97.2%

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

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

    if -7.99999999999999962e-177 < z < -5.49999999999999979e-248 or 1.7999999999999999e-303 < z < 7.0000000000000004e-215 or 5.4000000000000003e-68 < z < 1.3000000000000001e-8

    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 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0225:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-177}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-248}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-303}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-215}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-8}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 6: 74.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -500:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-173}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-247}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-308}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-218}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-69}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-13}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6800:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y (- 0.6666666666666666 z))))
        (t_1 (* -6.0 (* (- y x) z))))
   (if (<= z -500.0)
     t_1
     (if (<= z -1.45e-173)
       t_0
       (if (<= z -1.55e-247)
         (* x -3.0)
         (if (<= z 2.6e-308)
           (* y 4.0)
           (if (<= z 2.8e-218)
             (* x -3.0)
             (if (<= z 7.2e-69)
               (* y 4.0)
               (if (<= z 1.75e-13)
                 (* x -3.0)
                 (if (<= z 6800.0) t_0 t_1))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -500.0) {
		tmp = t_1;
	} else if (z <= -1.45e-173) {
		tmp = t_0;
	} else if (z <= -1.55e-247) {
		tmp = x * -3.0;
	} else if (z <= 2.6e-308) {
		tmp = y * 4.0;
	} else if (z <= 2.8e-218) {
		tmp = x * -3.0;
	} else if (z <= 7.2e-69) {
		tmp = y * 4.0;
	} else if (z <= 1.75e-13) {
		tmp = x * -3.0;
	} else if (z <= 6800.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (y * (0.6666666666666666d0 - z))
    t_1 = (-6.0d0) * ((y - x) * z)
    if (z <= (-500.0d0)) then
        tmp = t_1
    else if (z <= (-1.45d-173)) then
        tmp = t_0
    else if (z <= (-1.55d-247)) then
        tmp = x * (-3.0d0)
    else if (z <= 2.6d-308) then
        tmp = y * 4.0d0
    else if (z <= 2.8d-218) then
        tmp = x * (-3.0d0)
    else if (z <= 7.2d-69) then
        tmp = y * 4.0d0
    else if (z <= 1.75d-13) then
        tmp = x * (-3.0d0)
    else if (z <= 6800.0d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -500.0) {
		tmp = t_1;
	} else if (z <= -1.45e-173) {
		tmp = t_0;
	} else if (z <= -1.55e-247) {
		tmp = x * -3.0;
	} else if (z <= 2.6e-308) {
		tmp = y * 4.0;
	} else if (z <= 2.8e-218) {
		tmp = x * -3.0;
	} else if (z <= 7.2e-69) {
		tmp = y * 4.0;
	} else if (z <= 1.75e-13) {
		tmp = x * -3.0;
	} else if (z <= 6800.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * (0.6666666666666666 - z))
	t_1 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -500.0:
		tmp = t_1
	elif z <= -1.45e-173:
		tmp = t_0
	elif z <= -1.55e-247:
		tmp = x * -3.0
	elif z <= 2.6e-308:
		tmp = y * 4.0
	elif z <= 2.8e-218:
		tmp = x * -3.0
	elif z <= 7.2e-69:
		tmp = y * 4.0
	elif z <= 1.75e-13:
		tmp = x * -3.0
	elif z <= 6800.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)))
	t_1 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -500.0)
		tmp = t_1;
	elseif (z <= -1.45e-173)
		tmp = t_0;
	elseif (z <= -1.55e-247)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.6e-308)
		tmp = Float64(y * 4.0);
	elseif (z <= 2.8e-218)
		tmp = Float64(x * -3.0);
	elseif (z <= 7.2e-69)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.75e-13)
		tmp = Float64(x * -3.0);
	elseif (z <= 6800.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * (0.6666666666666666 - z));
	t_1 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -500.0)
		tmp = t_1;
	elseif (z <= -1.45e-173)
		tmp = t_0;
	elseif (z <= -1.55e-247)
		tmp = x * -3.0;
	elseif (z <= 2.6e-308)
		tmp = y * 4.0;
	elseif (z <= 2.8e-218)
		tmp = x * -3.0;
	elseif (z <= 7.2e-69)
		tmp = y * 4.0;
	elseif (z <= 1.75e-13)
		tmp = x * -3.0;
	elseif (z <= 6800.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -500.0], t$95$1, If[LessEqual[z, -1.45e-173], t$95$0, If[LessEqual[z, -1.55e-247], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.6e-308], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 2.8e-218], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 7.2e-69], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.75e-13], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6800.0], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.45 \cdot 10^{-173}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -1.55 \cdot 10^{-247}:\\
\;\;\;\;x \cdot -3\\

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

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-218}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-69}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;x \cdot -3\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -500 or 6800 < 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. *-commutative99.8%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(0.6666666666666666 - z\right) \cdot \color{blue}{{\left(\sqrt[3]{\left(y - x\right) \cdot 6}\right)}^{2}}, \sqrt[3]{\left(y - x\right) \cdot 6}, x\right) \]
    5. Applied egg-rr98.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-198.1%

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

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

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

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

    if -500 < z < -1.4499999999999999e-173 or 1.7500000000000001e-13 < z < 6800

    1. Initial program 99.3%

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}} \]
      2. div-inv53.0%

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

        \[\leadsto \left(x \cdot x - \color{blue}{{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}^{2}}\right) \cdot \frac{1}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
      4. associate-*l*53.1%

        \[\leadsto \left(x \cdot x - {\color{blue}{\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}}^{2}\right) \cdot \frac{1}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
      5. associate-*l*53.2%

        \[\leadsto \left(x \cdot x - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right) \cdot \frac{1}{x - \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}} \]
    5. Applied egg-rr53.2%

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

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

    if -1.4499999999999999e-173 < z < -1.55000000000000008e-247 or 2.6e-308 < z < 2.80000000000000009e-218 or 7.20000000000000035e-69 < z < 1.7500000000000001e-13

    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 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55000000000000008e-247 < z < 2.6e-308 or 2.80000000000000009e-218 < z < 7.20000000000000035e-69

    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 z around 0 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -500:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-173}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-247}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-308}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-218}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-69}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-13}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6800:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 7: 49.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-174}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-247}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-307}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-218}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-10}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))))
   (if (<= z -0.66)
     t_0
     (if (<= z -1.45e-174)
       (* y 4.0)
       (if (<= z -3e-247)
         (* x -3.0)
         (if (<= z -1.95e-307)
           (* y 4.0)
           (if (<= z 3.9e-218)
             (* x -3.0)
             (if (<= z 1.85e-70)
               (* y 4.0)
               (if (<= z 1.5e-10)
                 (* x -3.0)
                 (if (<= z 0.66) (* y 4.0) t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -0.66) {
		tmp = t_0;
	} else if (z <= -1.45e-174) {
		tmp = y * 4.0;
	} else if (z <= -3e-247) {
		tmp = x * -3.0;
	} else if (z <= -1.95e-307) {
		tmp = y * 4.0;
	} else if (z <= 3.9e-218) {
		tmp = x * -3.0;
	} else if (z <= 1.85e-70) {
		tmp = y * 4.0;
	} else if (z <= 1.5e-10) {
		tmp = x * -3.0;
	} else if (z <= 0.66) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * (y * z)
    if (z <= (-0.66d0)) then
        tmp = t_0
    else if (z <= (-1.45d-174)) then
        tmp = y * 4.0d0
    else if (z <= (-3d-247)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.95d-307)) then
        tmp = y * 4.0d0
    else if (z <= 3.9d-218) then
        tmp = x * (-3.0d0)
    else if (z <= 1.85d-70) then
        tmp = y * 4.0d0
    else if (z <= 1.5d-10) then
        tmp = x * (-3.0d0)
    else if (z <= 0.66d0) then
        tmp = y * 4.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -0.66) {
		tmp = t_0;
	} else if (z <= -1.45e-174) {
		tmp = y * 4.0;
	} else if (z <= -3e-247) {
		tmp = x * -3.0;
	} else if (z <= -1.95e-307) {
		tmp = y * 4.0;
	} else if (z <= 3.9e-218) {
		tmp = x * -3.0;
	} else if (z <= 1.85e-70) {
		tmp = y * 4.0;
	} else if (z <= 1.5e-10) {
		tmp = x * -3.0;
	} else if (z <= 0.66) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	tmp = 0
	if z <= -0.66:
		tmp = t_0
	elif z <= -1.45e-174:
		tmp = y * 4.0
	elif z <= -3e-247:
		tmp = x * -3.0
	elif z <= -1.95e-307:
		tmp = y * 4.0
	elif z <= 3.9e-218:
		tmp = x * -3.0
	elif z <= 1.85e-70:
		tmp = y * 4.0
	elif z <= 1.5e-10:
		tmp = x * -3.0
	elif z <= 0.66:
		tmp = y * 4.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -0.66)
		tmp = t_0;
	elseif (z <= -1.45e-174)
		tmp = Float64(y * 4.0);
	elseif (z <= -3e-247)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.95e-307)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.9e-218)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.85e-70)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.5e-10)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.66)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -0.66)
		tmp = t_0;
	elseif (z <= -1.45e-174)
		tmp = y * 4.0;
	elseif (z <= -3e-247)
		tmp = x * -3.0;
	elseif (z <= -1.95e-307)
		tmp = y * 4.0;
	elseif (z <= 3.9e-218)
		tmp = x * -3.0;
	elseif (z <= 1.85e-70)
		tmp = y * 4.0;
	elseif (z <= 1.5e-10)
		tmp = x * -3.0;
	elseif (z <= 0.66)
		tmp = y * 4.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.66], t$95$0, If[LessEqual[z, -1.45e-174], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -3e-247], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.95e-307], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.9e-218], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.85e-70], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.5e-10], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.66], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.45 \cdot 10^{-174}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq -1.95 \cdot 10^{-307}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{-218}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 1.85 \cdot 10^{-70}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 0.66:\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.660000000000000031 or 0.660000000000000031 < 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. *-commutative99.8%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(0.6666666666666666 - z\right) \cdot \color{blue}{{\left(\sqrt[3]{\left(y - x\right) \cdot 6}\right)}^{2}}, \sqrt[3]{\left(y - x\right) \cdot 6}, x\right) \]
    5. Applied egg-rr98.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-197.0%

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

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

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

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

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

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

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

    if -0.660000000000000031 < z < -1.45000000000000005e-174 or -2.9999999999999997e-247 < z < -1.95e-307 or 3.9e-218 < z < 1.85e-70 or 1.5e-10 < z < 0.660000000000000031

    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 z around 0 97.2%

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

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

    if -1.45000000000000005e-174 < z < -2.9999999999999997e-247 or -1.95e-307 < z < 3.9e-218 or 1.85e-70 < z < 1.5e-10

    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 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-174}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-247}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-307}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-218}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-70}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-10}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 8: 97.6% accurate, 1.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(\left(y - x\right) \cdot -6\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. *-commutative99.8%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(0.6666666666666666 - z\right) \cdot \color{blue}{{\left(\sqrt[3]{\left(y - x\right) \cdot 6}\right)}^{2}}, \sqrt[3]{\left(y - x\right) \cdot 6}, x\right) \]
    5. Applied egg-rr98.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-195.6%

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

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

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

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

    if -0.55000000000000004 < z < 0.52000000000000002

    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 z around 0 98.0%

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

    if 0.52000000000000002 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.55:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 0.52:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \end{array} \]

Alternative 9: 97.5% accurate, 1.0× speedup?

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

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

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

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


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

    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. *-commutative99.8%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(0.6666666666666666 - z\right) \cdot \color{blue}{{\left(\sqrt[3]{\left(y - x\right) \cdot 6}\right)}^{2}}, \sqrt[3]{\left(y - x\right) \cdot 6}, x\right) \]
    5. Applied egg-rr98.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-195.6%

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

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

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

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

    if -0.57999999999999996 < z < 0.619999999999999996

    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 z around 0 98.0%

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

    if 0.619999999999999996 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. 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. Taylor expanded in z around inf 99.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.58:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \left(z \cdot -6\right)\\ \end{array} \]

Alternative 10: 75.0% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+94} \lor \neg \left(y \leq 1.7 \cdot 10^{+32}\right):\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.1999999999999998e94 or 1.69999999999999989e32 < y

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. 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. flip-+19.6%

        \[\leadsto \color{blue}{\frac{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}} \]
      2. div-inv19.5%

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

        \[\leadsto \left(x \cdot x - \color{blue}{{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}^{2}}\right) \cdot \frac{1}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
      4. associate-*l*19.5%

        \[\leadsto \left(x \cdot x - {\color{blue}{\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}}^{2}\right) \cdot \frac{1}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
      5. associate-*l*19.6%

        \[\leadsto \left(x \cdot x - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right) \cdot \frac{1}{x - \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}} \]
    5. Applied egg-rr19.6%

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

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

    if -5.1999999999999998e94 < y < 1.69999999999999989e32

    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 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+94} \lor \neg \left(y \leq 1.7 \cdot 10^{+32}\right):\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]

Alternative 11: 75.2% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{+94} \lor \neg \left(y \leq 6 \cdot 10^{+31}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.30000000000000003e94 or 5.99999999999999978e31 < y

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.30000000000000003e94 < y < 5.99999999999999978e31

    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 79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.3 \cdot 10^{+94} \lor \neg \left(y \leq 6 \cdot 10^{+31}\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]

Alternative 12: 97.6% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.57999999999999996 or 0.5 < 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. *-commutative99.8%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(0.6666666666666666 - z\right) \cdot \color{blue}{{\left(\sqrt[3]{\left(y - x\right) \cdot 6}\right)}^{2}}, \sqrt[3]{\left(y - x\right) \cdot 6}, x\right) \]
    5. Applied egg-rr98.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left({1}^{0.3333333333333333} \cdot \left(z \cdot \left(y - x\right)\right)\right)} \]
    7. Step-by-step derivation
      1. pow-base-197.0%

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

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

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

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

    if -0.57999999999999996 < z < 0.5

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. 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 z around 0 98.0%

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

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

Alternative 13: 99.5% accurate, 1.2× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. 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(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]

Alternative 14: 38.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-46}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{-25}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.2e-46) (* y 4.0) (if (<= y 1.26e-25) (* x -3.0) (* y 4.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.2e-46) {
		tmp = y * 4.0;
	} else if (y <= 1.26e-25) {
		tmp = x * -3.0;
	} else {
		tmp = y * 4.0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-5.2d-46)) then
        tmp = y * 4.0d0
    else if (y <= 1.26d-25) then
        tmp = x * (-3.0d0)
    else
        tmp = y * 4.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.2e-46) {
		tmp = y * 4.0;
	} else if (y <= 1.26e-25) {
		tmp = x * -3.0;
	} else {
		tmp = y * 4.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -5.2e-46:
		tmp = y * 4.0
	elif y <= 1.26e-25:
		tmp = x * -3.0
	else:
		tmp = y * 4.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.2e-46)
		tmp = Float64(y * 4.0);
	elseif (y <= 1.26e-25)
		tmp = Float64(x * -3.0);
	else
		tmp = Float64(y * 4.0);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -5.2e-46)
		tmp = y * 4.0;
	elseif (y <= 1.26e-25)
		tmp = x * -3.0;
	else
		tmp = y * 4.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -5.2e-46], N[(y * 4.0), $MachinePrecision], If[LessEqual[y, 1.26e-25], N[(x * -3.0), $MachinePrecision], N[(y * 4.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-46}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;y \leq 1.26 \cdot 10^{-25}:\\
\;\;\;\;x \cdot -3\\

\mathbf{else}:\\
\;\;\;\;y \cdot 4\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.2000000000000004e-46 or 1.26e-25 < y

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. 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. Taylor expanded in z around 0 53.6%

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

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

    if -5.2000000000000004e-46 < y < 1.26e-25

    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 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-46}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{-25}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]

Alternative 15: 25.5% accurate, 4.3× speedup?

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

\\
y \cdot 4
\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 z around 0 51.9%

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

    \[\leadsto \color{blue}{4 \cdot y} \]
  6. Final simplification27.0%

    \[\leadsto y \cdot 4 \]

Alternative 16: 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 z around inf 49.2%

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

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

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

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

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

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

    \[\leadsto x \]

Reproduce

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