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

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

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)
\end{array}
Derivation
  1. Initial program 99.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. distribute-rgt-neg-out99.8%

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

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

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

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

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

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

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

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

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

Alternative 2: 51.5% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if -5.40000000000000013e87 < z < -0.0027000000000000001 or 15000 < z

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0027000000000000001 < z < -5.09999999999999979e-113 or -1.25000000000000003e-288 < z < 9.9999999999999998e-249 or 6.19999999999999973e-210 < z < 15000

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.09999999999999979e-113 < z < -1.25000000000000003e-288 or 9.9999999999999998e-249 < z < 6.19999999999999973e-210

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(6, \left(y - x\right) \cdot \left(0.6666666666666666 - z\right), x\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+87}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -0.0027:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -5.1 \cdot 10^{-113}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-288}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 10^{-248}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-210}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 15000:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 59.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(y \cdot -6\right)\\ t_1 := x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{if}\;x \leq -3 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-127}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -6.4 \cdot 10^{-127}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-176}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-301}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-121}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* y -6.0))) (t_1 (* x (+ -3.0 (* z 6.0)))))
   (if (<= x -3e-102)
     t_1
     (if (<= x -6.8e-127)
       t_0
       (if (<= x -6.4e-127)
         (* 6.0 (* x z))
         (if (<= x -2.2e-176)
           (* y 4.0)
           (if (<= x -6e-301) t_0 (if (<= x 1.05e-121) (* y 4.0) t_1))))))))
double code(double x, double y, double z) {
	double t_0 = z * (y * -6.0);
	double t_1 = x * (-3.0 + (z * 6.0));
	double tmp;
	if (x <= -3e-102) {
		tmp = t_1;
	} else if (x <= -6.8e-127) {
		tmp = t_0;
	} else if (x <= -6.4e-127) {
		tmp = 6.0 * (x * z);
	} else if (x <= -2.2e-176) {
		tmp = y * 4.0;
	} else if (x <= -6e-301) {
		tmp = t_0;
	} else if (x <= 1.05e-121) {
		tmp = y * 4.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 * ((-3.0d0) + (z * 6.0d0))
    if (x <= (-3d-102)) then
        tmp = t_1
    else if (x <= (-6.8d-127)) then
        tmp = t_0
    else if (x <= (-6.4d-127)) then
        tmp = 6.0d0 * (x * z)
    else if (x <= (-2.2d-176)) then
        tmp = y * 4.0d0
    else if (x <= (-6d-301)) then
        tmp = t_0
    else if (x <= 1.05d-121) then
        tmp = y * 4.0d0
    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 * (-3.0 + (z * 6.0));
	double tmp;
	if (x <= -3e-102) {
		tmp = t_1;
	} else if (x <= -6.8e-127) {
		tmp = t_0;
	} else if (x <= -6.4e-127) {
		tmp = 6.0 * (x * z);
	} else if (x <= -2.2e-176) {
		tmp = y * 4.0;
	} else if (x <= -6e-301) {
		tmp = t_0;
	} else if (x <= 1.05e-121) {
		tmp = y * 4.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y * -6.0)
	t_1 = x * (-3.0 + (z * 6.0))
	tmp = 0
	if x <= -3e-102:
		tmp = t_1
	elif x <= -6.8e-127:
		tmp = t_0
	elif x <= -6.4e-127:
		tmp = 6.0 * (x * z)
	elif x <= -2.2e-176:
		tmp = y * 4.0
	elif x <= -6e-301:
		tmp = t_0
	elif x <= 1.05e-121:
		tmp = y * 4.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(-3.0 + Float64(z * 6.0)))
	tmp = 0.0
	if (x <= -3e-102)
		tmp = t_1;
	elseif (x <= -6.8e-127)
		tmp = t_0;
	elseif (x <= -6.4e-127)
		tmp = Float64(6.0 * Float64(x * z));
	elseif (x <= -2.2e-176)
		tmp = Float64(y * 4.0);
	elseif (x <= -6e-301)
		tmp = t_0;
	elseif (x <= 1.05e-121)
		tmp = Float64(y * 4.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 * (-3.0 + (z * 6.0));
	tmp = 0.0;
	if (x <= -3e-102)
		tmp = t_1;
	elseif (x <= -6.8e-127)
		tmp = t_0;
	elseif (x <= -6.4e-127)
		tmp = 6.0 * (x * z);
	elseif (x <= -2.2e-176)
		tmp = y * 4.0;
	elseif (x <= -6e-301)
		tmp = t_0;
	elseif (x <= 1.05e-121)
		tmp = y * 4.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[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e-102], t$95$1, If[LessEqual[x, -6.8e-127], t$95$0, If[LessEqual[x, -6.4e-127], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.2e-176], N[(y * 4.0), $MachinePrecision], If[LessEqual[x, -6e-301], t$95$0, If[LessEqual[x, 1.05e-121], N[(y * 4.0), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -6.8 \cdot 10^{-127}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -6.4 \cdot 10^{-127}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\

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

\mathbf{elif}\;x \leq -6 \cdot 10^{-301}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -3e-102 or 1.0499999999999999e-121 < x

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3e-102 < x < -6.7999999999999997e-127 or -2.1999999999999999e-176 < x < -5.99999999999999998e-301

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.7999999999999997e-127 < x < -6.40000000000000035e-127

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.40000000000000035e-127 < x < -2.1999999999999999e-176 or -5.99999999999999998e-301 < x < 1.0499999999999999e-121

    1. Initial program 99.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(6, \left(y - x\right) \cdot \left(0.6666666666666666 - z\right), x\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{-102}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-127}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;x \leq -6.4 \cdot 10^{-127}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-176}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-301}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-121}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]

Alternative 4: 52.1% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

    if -0.00155999999999999997 < z < -1.8e-112 or -1.3799999999999999e-288 < z < 1.05e-252 or 4.0000000000000004e-208 < z < 0.5

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8e-112 < z < -1.3799999999999999e-288 or 1.05e-252 < z < 4.0000000000000004e-208

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(6, \left(y - x\right) \cdot \left(0.6666666666666666 - z\right), x\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.00156:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-112}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.38 \cdot 10^{-288}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-252}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-208}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 5: 75.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq -1.1 \cdot 10^{-13} \lor \neg \left(z \leq 2.15 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if -8.99999999999999986e86 < z < -1.09999999999999998e-13 or 2.1499999999999999e-16 < z

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.09999999999999998e-13 < z < 2.1499999999999999e-16

    1. Initial program 99.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{+86}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-13} \lor \neg \left(z \leq 2.15 \cdot 10^{-16}\right):\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \end{array} \]

Alternative 6: 97.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.56000000000000005 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

Alternative 7: 97.9% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.599999999999999978 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

    if 0.5 < z

    1. Initial program 99.8%

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

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

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

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

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

Alternative 8: 76.4% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{-37} \lor \neg \left(y \leq 3.6 \cdot 10^{-10}\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.85e-37) (not (<= y 3.6e-10)))
   (* 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.85e-37) || !(y <= 3.6e-10)) {
		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.85d-37)) .or. (.not. (y <= 3.6d-10))) 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.85e-37) || !(y <= 3.6e-10)) {
		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.85e-37) or not (y <= 3.6e-10):
		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.85e-37) || !(y <= 3.6e-10))
		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.85e-37) || ~((y <= 3.6e-10)))
		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.85e-37], N[Not[LessEqual[y, 3.6e-10]], $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.85 \cdot 10^{-37} \lor \neg \left(y \leq 3.6 \cdot 10^{-10}\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.85e-37 or 3.6e-10 < y

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{z \cdot \left(-6\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, 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 76.4%

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

    if -1.85e-37 < y < 3.6e-10

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 10: 99.7% accurate, 1.2× speedup?

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

\\
x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)
\end{array}
Derivation
  1. Initial program 99.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. *-commutative99.6%

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(6, \left(y - x\right) \cdot \left(0.6666666666666666 - z\right), x\right)} \]
  4. Step-by-step derivation
    1. fma-udef99.5%

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

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

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

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

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

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

Alternative 11: 36.5% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-84} \lor \neg \left(x \leq 6.4 \cdot 10^{-121}\right):\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.04999999999999999e-84 or 6.40000000000000038e-121 < x

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.04999999999999999e-84 < x < 6.40000000000000038e-121

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(6, \left(y - x\right) \cdot \left(0.6666666666666666 - z\right), x\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{-84} \lor \neg \left(x \leq 6.4 \cdot 10^{-121}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]

Alternative 12: 26.2% accurate, 4.3× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(6, \left(y - x\right) \cdot \left(0.6666666666666666 - z\right), x\right)} \]
  4. Step-by-step derivation
    1. fma-udef99.5%

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

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

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

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

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

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

    \[\leadsto \color{blue}{4 \cdot y} \]
  8. Final simplification25.0%

    \[\leadsto y \cdot 4 \]

Alternative 13: 2.6% accurate, 13.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

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

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

    \[\leadsto x \]

Reproduce

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