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

Percentage Accurate: 99.5% → 99.8%
Time: 10.3s
Alternatives: 14
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.1× speedup?

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

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

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

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

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

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

Alternative 3: 73.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -260000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-67}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-216}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.06 \cdot 10^{-256}:\\ \;\;\;\;\frac{x}{-0.3333333333333333}\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-103}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 54000000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))) (t_1 (* -6.0 (* z (- y x)))))
   (if (<= z -260000000.0)
     t_1
     (if (<= z -1.45e-67)
       t_0
       (if (<= z -2.35e-216)
         (* 4.0 y)
         (if (<= z -1.06e-256)
           (/ x -0.3333333333333333)
           (if (<= z 2.8e-103)
             (* 4.0 y)
             (if (<= z 54000000000.0) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -260000000.0) {
		tmp = t_1;
	} else if (z <= -1.45e-67) {
		tmp = t_0;
	} else if (z <= -2.35e-216) {
		tmp = 4.0 * y;
	} else if (z <= -1.06e-256) {
		tmp = x / -0.3333333333333333;
	} else if (z <= 2.8e-103) {
		tmp = 4.0 * y;
	} else if (z <= 54000000000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * ((-3.0d0) + (z * 6.0d0))
    t_1 = (-6.0d0) * (z * (y - x))
    if (z <= (-260000000.0d0)) then
        tmp = t_1
    else if (z <= (-1.45d-67)) then
        tmp = t_0
    else if (z <= (-2.35d-216)) then
        tmp = 4.0d0 * y
    else if (z <= (-1.06d-256)) then
        tmp = x / (-0.3333333333333333d0)
    else if (z <= 2.8d-103) then
        tmp = 4.0d0 * y
    else if (z <= 54000000000.0d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -260000000.0) {
		tmp = t_1;
	} else if (z <= -1.45e-67) {
		tmp = t_0;
	} else if (z <= -2.35e-216) {
		tmp = 4.0 * y;
	} else if (z <= -1.06e-256) {
		tmp = x / -0.3333333333333333;
	} else if (z <= 2.8e-103) {
		tmp = 4.0 * y;
	} else if (z <= 54000000000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	t_1 = -6.0 * (z * (y - x))
	tmp = 0
	if z <= -260000000.0:
		tmp = t_1
	elif z <= -1.45e-67:
		tmp = t_0
	elif z <= -2.35e-216:
		tmp = 4.0 * y
	elif z <= -1.06e-256:
		tmp = x / -0.3333333333333333
	elif z <= 2.8e-103:
		tmp = 4.0 * y
	elif z <= 54000000000.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	t_1 = Float64(-6.0 * Float64(z * Float64(y - x)))
	tmp = 0.0
	if (z <= -260000000.0)
		tmp = t_1;
	elseif (z <= -1.45e-67)
		tmp = t_0;
	elseif (z <= -2.35e-216)
		tmp = Float64(4.0 * y);
	elseif (z <= -1.06e-256)
		tmp = Float64(x / -0.3333333333333333);
	elseif (z <= 2.8e-103)
		tmp = Float64(4.0 * y);
	elseif (z <= 54000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	t_1 = -6.0 * (z * (y - x));
	tmp = 0.0;
	if (z <= -260000000.0)
		tmp = t_1;
	elseif (z <= -1.45e-67)
		tmp = t_0;
	elseif (z <= -2.35e-216)
		tmp = 4.0 * y;
	elseif (z <= -1.06e-256)
		tmp = x / -0.3333333333333333;
	elseif (z <= 2.8e-103)
		tmp = 4.0 * y;
	elseif (z <= 54000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -260000000.0], t$95$1, If[LessEqual[z, -1.45e-67], t$95$0, If[LessEqual[z, -2.35e-216], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, -1.06e-256], N[(x / -0.3333333333333333), $MachinePrecision], If[LessEqual[z, 2.8e-103], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 54000000000.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq -1.06 \cdot 10^{-256}:\\
\;\;\;\;\frac{x}{-0.3333333333333333}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.6e8 or 5.4e10 < z

    1. Initial program 99.7%

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

      \[\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.1%

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

    if -2.6e8 < z < -1.45000000000000002e-67 or 2.80000000000000023e-103 < z < 5.4e10

    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 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. sub-neg71.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.45000000000000002e-67 < z < -2.35e-216 or -1.06e-256 < z < 2.80000000000000023e-103

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

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

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

    if -2.35e-216 < z < -1.06e-256

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{9 - \color{blue}{36} \cdot \left(z \cdot z\right)}{-3 - z \cdot 6} \]
      8. *-commutative87.6%

        \[\leadsto x \cdot \frac{9 - 36 \cdot \left(z \cdot z\right)}{-3 - \color{blue}{6 \cdot z}} \]
    6. Applied egg-rr87.6%

      \[\leadsto x \cdot \color{blue}{\frac{9 - 36 \cdot \left(z \cdot z\right)}{-3 - 6 \cdot z}} \]
    7. Step-by-step derivation
      1. clear-num87.6%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{-3 - 6 \cdot z}{9 - 36 \cdot \left(z \cdot z\right)}}} \]
      2. un-div-inv87.8%

        \[\leadsto \color{blue}{\frac{x}{\frac{-3 - 6 \cdot z}{9 - 36 \cdot \left(z \cdot z\right)}}} \]
      3. clear-num87.8%

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

        \[\leadsto \frac{x}{\frac{1}{\frac{\color{blue}{-3 \cdot -3} - 36 \cdot \left(z \cdot z\right)}{-3 - 6 \cdot z}}} \]
      5. metadata-eval87.8%

        \[\leadsto \frac{x}{\frac{1}{\frac{-3 \cdot -3 - \color{blue}{\left(6 \cdot 6\right)} \cdot \left(z \cdot z\right)}{-3 - 6 \cdot z}}} \]
      6. swap-sqr87.8%

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

        \[\leadsto \frac{x}{\frac{1}{\color{blue}{-3 + 6 \cdot z}}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto \frac{x}{\frac{1}{-3 + 6 \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)}}} \]
      9. sqrt-prod87.8%

        \[\leadsto \frac{x}{\frac{1}{-3 + 6 \cdot \color{blue}{\sqrt{z \cdot z}}}} \]
      10. sqr-neg87.8%

        \[\leadsto \frac{x}{\frac{1}{-3 + 6 \cdot \sqrt{\color{blue}{\left(-z\right) \cdot \left(-z\right)}}}} \]
      11. sqrt-unprod87.8%

        \[\leadsto \frac{x}{\frac{1}{-3 + 6 \cdot \color{blue}{\left(\sqrt{-z} \cdot \sqrt{-z}\right)}}} \]
      12. add-sqr-sqrt87.8%

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

        \[\leadsto \frac{x}{\frac{1}{-3 + \color{blue}{\left(-6 \cdot z\right)}}} \]
      14. sub-neg87.8%

        \[\leadsto \frac{x}{\frac{1}{\color{blue}{-3 - 6 \cdot z}}} \]
      15. sub-neg87.8%

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

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

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

        \[\leadsto \frac{x}{\frac{1}{-3 + 6 \cdot \color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}}} \]
      19. sqr-neg87.8%

        \[\leadsto \frac{x}{\frac{1}{-3 + 6 \cdot \sqrt{\color{blue}{z \cdot z}}}} \]
      20. sqrt-prod0.0%

        \[\leadsto \frac{x}{\frac{1}{-3 + 6 \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)}}} \]
    8. Applied egg-rr87.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{1}{-3 + z \cdot 6}}} \]
    9. Taylor expanded in z around 0 87.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -260000000:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-67}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-216}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq -1.06 \cdot 10^{-256}:\\ \;\;\;\;\frac{x}{-0.3333333333333333}\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-103}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 54000000000:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]

Alternative 4: 50.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(y \cdot -6\right)\\ t_1 := x \cdot \left(z \cdot 6\right)\\ \mathbf{if}\;z \leq -1 \cdot 10^{+147}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -0.062:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-99}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+132} \lor \neg \left(z \leq 1.4 \cdot 10^{+144}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* y -6.0))) (t_1 (* x (* z 6.0))))
   (if (<= z -1e+147)
     t_0
     (if (<= z -0.062)
       t_1
       (if (<= z 1.9e-99)
         (* 4.0 y)
         (if (<= z 0.5)
           (* -3.0 x)
           (if (or (<= z 7.5e+132) (not (<= z 1.4e+144))) t_0 t_1)))))))
double code(double x, double y, double z) {
	double t_0 = z * (y * -6.0);
	double t_1 = x * (z * 6.0);
	double tmp;
	if (z <= -1e+147) {
		tmp = t_0;
	} else if (z <= -0.062) {
		tmp = t_1;
	} else if (z <= 1.9e-99) {
		tmp = 4.0 * y;
	} else if (z <= 0.5) {
		tmp = -3.0 * x;
	} else if ((z <= 7.5e+132) || !(z <= 1.4e+144)) {
		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 = z * (y * (-6.0d0))
    t_1 = x * (z * 6.0d0)
    if (z <= (-1d+147)) then
        tmp = t_0
    else if (z <= (-0.062d0)) then
        tmp = t_1
    else if (z <= 1.9d-99) then
        tmp = 4.0d0 * y
    else if (z <= 0.5d0) then
        tmp = (-3.0d0) * x
    else if ((z <= 7.5d+132) .or. (.not. (z <= 1.4d+144))) 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 = z * (y * -6.0);
	double t_1 = x * (z * 6.0);
	double tmp;
	if (z <= -1e+147) {
		tmp = t_0;
	} else if (z <= -0.062) {
		tmp = t_1;
	} else if (z <= 1.9e-99) {
		tmp = 4.0 * y;
	} else if (z <= 0.5) {
		tmp = -3.0 * x;
	} else if ((z <= 7.5e+132) || !(z <= 1.4e+144)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y * -6.0)
	t_1 = x * (z * 6.0)
	tmp = 0
	if z <= -1e+147:
		tmp = t_0
	elif z <= -0.062:
		tmp = t_1
	elif z <= 1.9e-99:
		tmp = 4.0 * y
	elif z <= 0.5:
		tmp = -3.0 * x
	elif (z <= 7.5e+132) or not (z <= 1.4e+144):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y * -6.0))
	t_1 = Float64(x * Float64(z * 6.0))
	tmp = 0.0
	if (z <= -1e+147)
		tmp = t_0;
	elseif (z <= -0.062)
		tmp = t_1;
	elseif (z <= 1.9e-99)
		tmp = Float64(4.0 * y);
	elseif (z <= 0.5)
		tmp = Float64(-3.0 * x);
	elseif ((z <= 7.5e+132) || !(z <= 1.4e+144))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y * -6.0);
	t_1 = x * (z * 6.0);
	tmp = 0.0;
	if (z <= -1e+147)
		tmp = t_0;
	elseif (z <= -0.062)
		tmp = t_1;
	elseif (z <= 1.9e-99)
		tmp = 4.0 * y;
	elseif (z <= 0.5)
		tmp = -3.0 * x;
	elseif ((z <= 7.5e+132) || ~((z <= 1.4e+144)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e+147], t$95$0, If[LessEqual[z, -0.062], t$95$1, If[LessEqual[z, 1.9e-99], N[(4.0 * y), $MachinePrecision], If[LessEqual[z, 0.5], N[(-3.0 * x), $MachinePrecision], If[Or[LessEqual[z, 7.5e+132], N[Not[LessEqual[z, 1.4e+144]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;z \leq 7.5 \cdot 10^{+132} \lor \neg \left(z \leq 1.4 \cdot 10^{+144}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -9.9999999999999998e146 or 0.5 < z < 7.50000000000000017e132 or 1.40000000000000003e144 < z

    1. Initial program 99.7%

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

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

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

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

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

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

    if -9.9999999999999998e146 < z < -0.062 or 7.50000000000000017e132 < z < 1.40000000000000003e144

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.062 < z < 1.8999999999999998e-99

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

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

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

    if 1.8999999999999998e-99 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified62.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+147}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.062:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-99}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+132} \lor \neg \left(z \leq 1.4 \cdot 10^{+144}\right):\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]

Alternative 5: 50.4% accurate, 0.7× speedup?

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

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

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

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

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

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

\mathbf{elif}\;z \leq 2.8 \cdot 10^{+144}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.89999999999999985e147 or 2.80000000000000007e144 < z

    1. Initial program 99.8%

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

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

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

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

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

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

    if -1.89999999999999985e147 < z < -0.0850000000000000061 or 8.4999999999999997e127 < z < 2.80000000000000007e144

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0850000000000000061 < z < 1.70000000000000008e-104

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

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

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

    if 1.70000000000000008e-104 < z < 0.660000000000000031

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified62.4%

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

    if 0.660000000000000031 < z < 8.4999999999999997e127

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{+147}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.085:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-104}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+127}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+144}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \end{array} \]

Alternative 6: 75.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{-22} \lor \neg \left(y \leq 7.6 \cdot 10^{-63} \lor \neg \left(y \leq 7 \cdot 10^{-16}\right) \land y \leq 2.4 \cdot 10^{+44}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.75000000000000003e-22 or 7.60000000000000034e-63 < y < 7.00000000000000035e-16 or 2.40000000000000013e44 < y

    1. Initial program 99.7%

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.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.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 84.4%

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

    if -1.75000000000000003e-22 < y < 7.60000000000000034e-63 or 7.00000000000000035e-16 < y < 2.40000000000000013e44

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{-22} \lor \neg \left(y \leq 7.6 \cdot 10^{-63} \lor \neg \left(y \leq 7 \cdot 10^{-16}\right) \land y \leq 2.4 \cdot 10^{+44}\right):\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]

Alternative 7: 73.1% accurate, 1.0× speedup?

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

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

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

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

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


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

    1. Initial program 99.7%

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

      \[\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 96.4%

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

    if -0.00589999999999999986 < z < 7.10000000000000045e-103

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

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

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

    if 7.10000000000000045e-103 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified62.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0059:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq 7.1 \cdot 10^{-103}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]

Alternative 8: 50.1% accurate, 1.2× speedup?

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

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.017000000000000001 < z < 1.85e-99

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

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

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

    if 1.85e-99 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified62.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.017:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-99}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 9: 50.1% accurate, 1.2× speedup?

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

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3500000000000001 < z < 1.40000000000000006e-102

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

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

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

    if 1.40000000000000006e-102 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified62.4%

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

    if 0.5 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.35:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-102}:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 10: 97.8% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 99.7%

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

      \[\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 96.4%

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

    if -0.599999999999999978 < z < 0.660000000000000031

    1. Initial program 99.5%

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

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

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

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

Alternative 11: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

Alternative 12: 99.8% 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.6%

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

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

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

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

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

Alternative 13: 37.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{-106}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+48}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;-3 \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -9.2e-106) (* -3.0 x) (if (<= x 1.4e+48) (* 4.0 y) (* -3.0 x))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -9.2e-106) {
		tmp = -3.0 * x;
	} else if (x <= 1.4e+48) {
		tmp = 4.0 * y;
	} else {
		tmp = -3.0 * x;
	}
	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 <= (-9.2d-106)) then
        tmp = (-3.0d0) * x
    else if (x <= 1.4d+48) then
        tmp = 4.0d0 * y
    else
        tmp = (-3.0d0) * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -9.2e-106) {
		tmp = -3.0 * x;
	} else if (x <= 1.4e+48) {
		tmp = 4.0 * y;
	} else {
		tmp = -3.0 * x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -9.2e-106:
		tmp = -3.0 * x
	elif x <= 1.4e+48:
		tmp = 4.0 * y
	else:
		tmp = -3.0 * x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -9.2e-106)
		tmp = Float64(-3.0 * x);
	elseif (x <= 1.4e+48)
		tmp = Float64(4.0 * y);
	else
		tmp = Float64(-3.0 * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -9.2e-106)
		tmp = -3.0 * x;
	elseif (x <= 1.4e+48)
		tmp = 4.0 * y;
	else
		tmp = -3.0 * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -9.2e-106], N[(-3.0 * x), $MachinePrecision], If[LessEqual[x, 1.4e+48], N[(4.0 * y), $MachinePrecision], N[(-3.0 * x), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.4 \cdot 10^{+48}:\\
\;\;\;\;4 \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.2000000000000004e-106 or 1.40000000000000006e48 < x

    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 x around inf 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified37.5%

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

    if -9.2000000000000004e-106 < x < 1.40000000000000006e48

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{-106}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+48}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;-3 \cdot x\\ \end{array} \]

Alternative 14: 27.0% accurate, 4.3× speedup?

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

\\
4 \cdot y
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

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

    \[\leadsto \color{blue}{4 \cdot y} \]
  6. Final simplification25.5%

    \[\leadsto 4 \cdot y \]

Reproduce

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