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

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

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 50.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ t_1 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.34 \cdot 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.52 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -0.0152:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{-219}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-234}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-188}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{+204}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))) (t_1 (* 6.0 (* x z))))
   (if (<= z -1.34e+85)
     t_0
     (if (<= z -1.52e+38)
       t_1
       (if (<= z -0.0152)
         t_0
         (if (<= z -1.26e-219)
           (* y 4.0)
           (if (<= z 4.4e-234)
             (* x -3.0)
             (if (<= z 3.5e-188)
               (* y 4.0)
               (if (<= z 0.5) (* x -3.0) (if (<= z 1.85e+204) t_0 t_1))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.34e+85) {
		tmp = t_0;
	} else if (z <= -1.52e+38) {
		tmp = t_1;
	} else if (z <= -0.0152) {
		tmp = t_0;
	} else if (z <= -1.26e-219) {
		tmp = y * 4.0;
	} else if (z <= 4.4e-234) {
		tmp = x * -3.0;
	} else if (z <= 3.5e-188) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 1.85e+204) {
		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 * z)
    t_1 = 6.0d0 * (x * z)
    if (z <= (-1.34d+85)) then
        tmp = t_0
    else if (z <= (-1.52d+38)) then
        tmp = t_1
    else if (z <= (-0.0152d0)) then
        tmp = t_0
    else if (z <= (-1.26d-219)) then
        tmp = y * 4.0d0
    else if (z <= 4.4d-234) then
        tmp = x * (-3.0d0)
    else if (z <= 3.5d-188) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 1.85d+204) 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 * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.34e+85) {
		tmp = t_0;
	} else if (z <= -1.52e+38) {
		tmp = t_1;
	} else if (z <= -0.0152) {
		tmp = t_0;
	} else if (z <= -1.26e-219) {
		tmp = y * 4.0;
	} else if (z <= 4.4e-234) {
		tmp = x * -3.0;
	} else if (z <= 3.5e-188) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 1.85e+204) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	t_1 = 6.0 * (x * z)
	tmp = 0
	if z <= -1.34e+85:
		tmp = t_0
	elif z <= -1.52e+38:
		tmp = t_1
	elif z <= -0.0152:
		tmp = t_0
	elif z <= -1.26e-219:
		tmp = y * 4.0
	elif z <= 4.4e-234:
		tmp = x * -3.0
	elif z <= 3.5e-188:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 1.85e+204:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	t_1 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1.34e+85)
		tmp = t_0;
	elseif (z <= -1.52e+38)
		tmp = t_1;
	elseif (z <= -0.0152)
		tmp = t_0;
	elseif (z <= -1.26e-219)
		tmp = Float64(y * 4.0);
	elseif (z <= 4.4e-234)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.5e-188)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.85e+204)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	t_1 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1.34e+85)
		tmp = t_0;
	elseif (z <= -1.52e+38)
		tmp = t_1;
	elseif (z <= -0.0152)
		tmp = t_0;
	elseif (z <= -1.26e-219)
		tmp = y * 4.0;
	elseif (z <= 4.4e-234)
		tmp = x * -3.0;
	elseif (z <= 3.5e-188)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 1.85e+204)
		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 * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.34e+85], t$95$0, If[LessEqual[z, -1.52e+38], t$95$1, If[LessEqual[z, -0.0152], t$95$0, If[LessEqual[z, -1.26e-219], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.4e-234], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.5e-188], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.85e+204], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}

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

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

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

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

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

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

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

\mathbf{elif}\;z \leq 1.85 \cdot 10^{+204}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.34000000000000008e85 or -1.51999999999999996e38 < z < -0.0152 or 0.5 < z < 1.85e204

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.34000000000000008e85 < z < -1.51999999999999996e38 or 1.85e204 < z

    1. Initial program 99.5%

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

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

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

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

    if -0.0152 < z < -1.26000000000000003e-219 or 4.3999999999999998e-234 < z < 3.5e-188

    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. +-commutative99.3%

        \[\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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative62.6%

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified62.6%

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

    if -1.26000000000000003e-219 < z < 4.3999999999999998e-234 or 3.5e-188 < z < 0.5

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.34 \cdot 10^{+85}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.52 \cdot 10^{+38}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -0.0152:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{-219}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-234}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-188}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{+204}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 50.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ t_1 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1.2 \cdot 10^{+86}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -0.0152:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-219}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-234}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-186}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+209}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))) (t_1 (* 6.0 (* x z))))
   (if (<= z -1.2e+86)
     t_0
     (if (<= z -1.65e+38)
       t_1
       (if (<= z -0.0152)
         (* z (* y -6.0))
         (if (<= z -4.4e-219)
           (* y 4.0)
           (if (<= z 1.15e-234)
             (* x -3.0)
             (if (<= z 2e-186)
               (* y 4.0)
               (if (<= z 0.65) (* x -3.0) (if (<= z 3.3e+209) t_0 t_1))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.2e+86) {
		tmp = t_0;
	} else if (z <= -1.65e+38) {
		tmp = t_1;
	} else if (z <= -0.0152) {
		tmp = z * (y * -6.0);
	} else if (z <= -4.4e-219) {
		tmp = y * 4.0;
	} else if (z <= 1.15e-234) {
		tmp = x * -3.0;
	} else if (z <= 2e-186) {
		tmp = y * 4.0;
	} else if (z <= 0.65) {
		tmp = x * -3.0;
	} else if (z <= 3.3e+209) {
		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 * z)
    t_1 = 6.0d0 * (x * z)
    if (z <= (-1.2d+86)) then
        tmp = t_0
    else if (z <= (-1.65d+38)) then
        tmp = t_1
    else if (z <= (-0.0152d0)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-4.4d-219)) then
        tmp = y * 4.0d0
    else if (z <= 1.15d-234) then
        tmp = x * (-3.0d0)
    else if (z <= 2d-186) then
        tmp = y * 4.0d0
    else if (z <= 0.65d0) then
        tmp = x * (-3.0d0)
    else if (z <= 3.3d+209) 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 * z);
	double t_1 = 6.0 * (x * z);
	double tmp;
	if (z <= -1.2e+86) {
		tmp = t_0;
	} else if (z <= -1.65e+38) {
		tmp = t_1;
	} else if (z <= -0.0152) {
		tmp = z * (y * -6.0);
	} else if (z <= -4.4e-219) {
		tmp = y * 4.0;
	} else if (z <= 1.15e-234) {
		tmp = x * -3.0;
	} else if (z <= 2e-186) {
		tmp = y * 4.0;
	} else if (z <= 0.65) {
		tmp = x * -3.0;
	} else if (z <= 3.3e+209) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	t_1 = 6.0 * (x * z)
	tmp = 0
	if z <= -1.2e+86:
		tmp = t_0
	elif z <= -1.65e+38:
		tmp = t_1
	elif z <= -0.0152:
		tmp = z * (y * -6.0)
	elif z <= -4.4e-219:
		tmp = y * 4.0
	elif z <= 1.15e-234:
		tmp = x * -3.0
	elif z <= 2e-186:
		tmp = y * 4.0
	elif z <= 0.65:
		tmp = x * -3.0
	elif z <= 3.3e+209:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	t_1 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1.2e+86)
		tmp = t_0;
	elseif (z <= -1.65e+38)
		tmp = t_1;
	elseif (z <= -0.0152)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -4.4e-219)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.15e-234)
		tmp = Float64(x * -3.0);
	elseif (z <= 2e-186)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.65)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.3e+209)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (y * z);
	t_1 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1.2e+86)
		tmp = t_0;
	elseif (z <= -1.65e+38)
		tmp = t_1;
	elseif (z <= -0.0152)
		tmp = z * (y * -6.0);
	elseif (z <= -4.4e-219)
		tmp = y * 4.0;
	elseif (z <= 1.15e-234)
		tmp = x * -3.0;
	elseif (z <= 2e-186)
		tmp = y * 4.0;
	elseif (z <= 0.65)
		tmp = x * -3.0;
	elseif (z <= 3.3e+209)
		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 * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e+86], t$95$0, If[LessEqual[z, -1.65e+38], t$95$1, If[LessEqual[z, -0.0152], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.4e-219], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.15e-234], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2e-186], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.3e+209], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}

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

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

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

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

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

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

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

\mathbf{elif}\;z \leq 3.3 \cdot 10^{+209}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.2e86 or 0.650000000000000022 < z < 3.2999999999999998e209

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2e86 < z < -1.65e38 or 3.2999999999999998e209 < z

    1. Initial program 99.5%

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

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

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

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

    if -1.65e38 < z < -0.0152

    1. Initial program 99.5%

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

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

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

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

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

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

    if -0.0152 < z < -4.3999999999999999e-219 or 1.14999999999999995e-234 < z < 1.9999999999999998e-186

    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. +-commutative99.3%

        \[\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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative62.6%

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified62.6%

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

    if -4.3999999999999999e-219 < z < 1.14999999999999995e-234 or 1.9999999999999998e-186 < z < 0.650000000000000022

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+86}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{+38}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -0.0152:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-219}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-234}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-186}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+209}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 4: 73.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -130000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.12 \cdot 10^{-160}:\\ \;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-218}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-234}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-188}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* (- y x) z))))
   (if (<= z -130000.0)
     t_0
     (if (<= z -1.12e-160)
       (* x (+ (* z 6.0) -3.0))
       (if (<= z -4.2e-218)
         (* y 4.0)
         (if (<= z 4.1e-234)
           (* x -3.0)
           (if (<= z 3.2e-188) (* y 4.0) (if (<= z 0.5) (* x -3.0) t_0))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -130000.0) {
		tmp = t_0;
	} else if (z <= -1.12e-160) {
		tmp = x * ((z * 6.0) + -3.0);
	} else if (z <= -4.2e-218) {
		tmp = y * 4.0;
	} else if (z <= 4.1e-234) {
		tmp = x * -3.0;
	} else if (z <= 3.2e-188) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * ((y - x) * z)
    if (z <= (-130000.0d0)) then
        tmp = t_0
    else if (z <= (-1.12d-160)) then
        tmp = x * ((z * 6.0d0) + (-3.0d0))
    else if (z <= (-4.2d-218)) then
        tmp = y * 4.0d0
    else if (z <= 4.1d-234) then
        tmp = x * (-3.0d0)
    else if (z <= 3.2d-188) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -130000.0) {
		tmp = t_0;
	} else if (z <= -1.12e-160) {
		tmp = x * ((z * 6.0) + -3.0);
	} else if (z <= -4.2e-218) {
		tmp = y * 4.0;
	} else if (z <= 4.1e-234) {
		tmp = x * -3.0;
	} else if (z <= 3.2e-188) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -130000.0:
		tmp = t_0
	elif z <= -1.12e-160:
		tmp = x * ((z * 6.0) + -3.0)
	elif z <= -4.2e-218:
		tmp = y * 4.0
	elif z <= 4.1e-234:
		tmp = x * -3.0
	elif z <= 3.2e-188:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.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 <= -130000.0)
		tmp = t_0;
	elseif (z <= -1.12e-160)
		tmp = Float64(x * Float64(Float64(z * 6.0) + -3.0));
	elseif (z <= -4.2e-218)
		tmp = Float64(y * 4.0);
	elseif (z <= 4.1e-234)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.2e-188)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -130000.0)
		tmp = t_0;
	elseif (z <= -1.12e-160)
		tmp = x * ((z * 6.0) + -3.0);
	elseif (z <= -4.2e-218)
		tmp = y * 4.0;
	elseif (z <= 4.1e-234)
		tmp = x * -3.0;
	elseif (z <= 3.2e-188)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -130000.0], t$95$0, If[LessEqual[z, -1.12e-160], N[(x * N[(N[(z * 6.0), $MachinePrecision] + -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.2e-218], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.1e-234], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.2e-188], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.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 -130000:\\
\;\;\;\;t_0\\

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

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

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

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

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

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


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

    1. Initial program 99.6%

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

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

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

    if -1.3e5 < z < -1.11999999999999997e-160

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.11999999999999997e-160 < z < -4.19999999999999988e-218 or 4.10000000000000011e-234 < z < 3.20000000000000022e-188

    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. +-commutative99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative81.3%

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified81.3%

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

    if -4.19999999999999988e-218 < z < 4.10000000000000011e-234 or 3.20000000000000022e-188 < z < 0.5

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -130000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -1.12 \cdot 10^{-160}:\\ \;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-218}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-234}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-188}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 5: 73.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -0.0042:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -9.6 \cdot 10^{-219}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-235}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-188}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \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.0042)
     t_0
     (if (<= z -9.6e-219)
       (* y 4.0)
       (if (<= z 3.5e-235)
         (* x -3.0)
         (if (<= z 3.5e-188) (* y 4.0) (if (<= z 0.5) (* x -3.0) t_0)))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -0.0042) {
		tmp = t_0;
	} else if (z <= -9.6e-219) {
		tmp = y * 4.0;
	} else if (z <= 3.5e-235) {
		tmp = x * -3.0;
	} else if (z <= 3.5e-188) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-6.0d0) * ((y - x) * z)
    if (z <= (-0.0042d0)) then
        tmp = t_0
    else if (z <= (-9.6d-219)) then
        tmp = y * 4.0d0
    else if (z <= 3.5d-235) then
        tmp = x * (-3.0d0)
    else if (z <= 3.5d-188) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -0.0042) {
		tmp = t_0;
	} else if (z <= -9.6e-219) {
		tmp = y * 4.0;
	} else if (z <= 3.5e-235) {
		tmp = x * -3.0;
	} else if (z <= 3.5e-188) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -0.0042:
		tmp = t_0
	elif z <= -9.6e-219:
		tmp = y * 4.0
	elif z <= 3.5e-235:
		tmp = x * -3.0
	elif z <= 3.5e-188:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.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.0042)
		tmp = t_0;
	elseif (z <= -9.6e-219)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.5e-235)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.5e-188)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -0.0042)
		tmp = t_0;
	elseif (z <= -9.6e-219)
		tmp = y * 4.0;
	elseif (z <= 3.5e-235)
		tmp = x * -3.0;
	elseif (z <= 3.5e-188)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.0042], t$95$0, If[LessEqual[z, -9.6e-219], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.5e-235], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.5e-188], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.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.0042:\\
\;\;\;\;t_0\\

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

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

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

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

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


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

    1. Initial program 99.6%

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

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

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

    if -0.00419999999999999974 < z < -9.60000000000000056e-219 or 3.4999999999999999e-235 < z < 3.5e-188

    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. +-commutative99.3%

        \[\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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative62.6%

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified62.6%

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

    if -9.60000000000000056e-219 < z < 3.4999999999999999e-235 or 3.5e-188 < z < 0.5

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0042:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -9.6 \cdot 10^{-219}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-235}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-188}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 6: 50.2% accurate, 0.8× speedup?

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

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

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

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

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0152 < z < -1e-216 or 2.3999999999999999e-234 < z < 2.0000000000000001e-184

    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. +-commutative99.3%

        \[\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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative62.6%

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified62.6%

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

    if -1e-216 < z < 2.3999999999999999e-234 or 2.0000000000000001e-184 < z < 0.650000000000000022

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0152:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-216}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-234}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-184}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 7: 97.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.6666666666666666 - z \leq -20 \lor \neg \left(0.6666666666666666 - z \leq 1\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 (<= (- 0.6666666666666666 z) -20.0)
         (not (<= (- 0.6666666666666666 z) 1.0)))
   (* -6.0 (* (- y x) z))
   (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
	double tmp;
	if (((0.6666666666666666 - z) <= -20.0) || !((0.6666666666666666 - z) <= 1.0)) {
		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 (((0.6666666666666666d0 - z) <= (-20.0d0)) .or. (.not. ((0.6666666666666666d0 - z) <= 1.0d0))) 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 (((0.6666666666666666 - z) <= -20.0) || !((0.6666666666666666 - z) <= 1.0)) {
		tmp = -6.0 * ((y - x) * z);
	} else {
		tmp = x + ((y - x) * 4.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if ((0.6666666666666666 - z) <= -20.0) or not ((0.6666666666666666 - z) <= 1.0):
		tmp = -6.0 * ((y - x) * z)
	else:
		tmp = x + ((y - x) * 4.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((Float64(0.6666666666666666 - z) <= -20.0) || !(Float64(0.6666666666666666 - z) <= 1.0))
		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 (((0.6666666666666666 - z) <= -20.0) || ~(((0.6666666666666666 - z) <= 1.0)))
		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[N[(0.6666666666666666 - z), $MachinePrecision], -20.0], N[Not[LessEqual[N[(0.6666666666666666 - z), $MachinePrecision], 1.0]], $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}\;0.6666666666666666 - z \leq -20 \lor \neg \left(0.6666666666666666 - z \leq 1\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 (-.f64 (/.f64 2 3) z) < -20 or 1 < (-.f64 (/.f64 2 3) z)

    1. Initial program 99.6%

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

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

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

    if -20 < (-.f64 (/.f64 2 3) z) < 1

    1. Initial program 99.3%

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

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

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

Alternative 8: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

Alternative 9: 75.1% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+61} \lor \neg \left(y \leq 2.1 \cdot 10^{+55}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.3500000000000001e61 or 2.1000000000000001e55 < y

    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. +-commutative99.5%

        \[\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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.3500000000000001e61 < y < 2.1000000000000001e55

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 99.7% accurate, 1.2× speedup?

\[\begin{array}{l} \\ x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(6.0 * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

Alternative 11: 37.4% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-45}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;x \leq 2.2 \cdot 10^{-121}:\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.60000000000000001e-45 or 2.20000000000000021e-121 < x

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified43.2%

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

    if -3.60000000000000001e-45 < x < 2.20000000000000021e-121

    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. +-commutative99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative39.1%

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified39.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-45}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-121}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]

Alternative 12: 26.2% accurate, 4.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto x \cdot -3 \]

Reproduce

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