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

Percentage Accurate: 99.5% → 99.7%
Time: 9.2s
Alternatives: 14
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 1.2× speedup?

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

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

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

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

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

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

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

Alternative 2: 50.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

\mathbf{elif}\;z \leq 2.1 \cdot 10^{+219}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -0.67000000000000004 or 1.2e7 < z < 2.09999999999999988e219

    1. Initial program 99.7%

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

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

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

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

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

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

    if -0.67000000000000004 < z < -1.80000000000000002e-31 or -3.29999999999999973e-51 < z < 3.9999999999999997e-207 or 7.50000000000000017e-75 < z < 1.2e7

    1. Initial program 99.4%

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

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

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

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

    if -1.80000000000000002e-31 < z < -3.29999999999999973e-51 or 3.9999999999999997e-207 < z < 7.50000000000000017e-75

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.09999999999999988e219 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.67:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-31}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-51}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-207}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-75}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 12000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+219}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 50.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+219}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -0.67000000000000004 or 1.2e7 < z < 1.3499999999999999e219

    1. Initial program 99.7%

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

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

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

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

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

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

    if -0.67000000000000004 < z < -2.69999999999999981e-32 or -1.06e-60 < z < 1.9e-207 or 1.15e-75 < z < 1.2e7

    1. Initial program 99.4%

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

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

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

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

    if -2.69999999999999981e-32 < z < -1.06e-60 or 1.9e-207 < z < 1.15e-75

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3499999999999999e219 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.67:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-32}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1.06 \cdot 10^{-60}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-207}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-75}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 12000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+219}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \end{array} \]

Alternative 4: 50.7% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.67000000000000004 or 1.2e7 < z

    1. Initial program 99.7%

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

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

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

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

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

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

    if -0.67000000000000004 < z < -3.49999999999999985e-31 or -1.2599999999999999e-48 < z < 2.90000000000000011e-207 or 7.50000000000000017e-75 < z < 1.2e7

    1. Initial program 99.4%

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

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

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

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

    if -3.49999999999999985e-31 < z < -1.2599999999999999e-48 or 2.90000000000000011e-207 < z < 7.50000000000000017e-75

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.67:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-31}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{-48}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-207}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-75}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 12000000:\\ \;\;\;\;y \cdot 4\\ \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 -1.7 \cdot 10^{-16}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 1.78 \cdot 10^{-19}:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+219}:\\ \;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.7e-16)
   (* y (+ 4.0 (* z -6.0)))
   (if (<= z 1.78e-19)
     (+ (* y 4.0) (* x -3.0))
     (if (<= z 7.8e+219)
       (* (- 0.6666666666666666 z) (* y 6.0))
       (* x (* 6.0 z))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.7e-16) {
		tmp = y * (4.0 + (z * -6.0));
	} else if (z <= 1.78e-19) {
		tmp = (y * 4.0) + (x * -3.0);
	} else if (z <= 7.8e+219) {
		tmp = (0.6666666666666666 - z) * (y * 6.0);
	} else {
		tmp = x * (6.0 * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-1.7d-16)) then
        tmp = y * (4.0d0 + (z * (-6.0d0)))
    else if (z <= 1.78d-19) then
        tmp = (y * 4.0d0) + (x * (-3.0d0))
    else if (z <= 7.8d+219) then
        tmp = (0.6666666666666666d0 - z) * (y * 6.0d0)
    else
        tmp = x * (6.0d0 * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.7e-16) {
		tmp = y * (4.0 + (z * -6.0));
	} else if (z <= 1.78e-19) {
		tmp = (y * 4.0) + (x * -3.0);
	} else if (z <= 7.8e+219) {
		tmp = (0.6666666666666666 - z) * (y * 6.0);
	} else {
		tmp = x * (6.0 * z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -1.7e-16:
		tmp = y * (4.0 + (z * -6.0))
	elif z <= 1.78e-19:
		tmp = (y * 4.0) + (x * -3.0)
	elif z <= 7.8e+219:
		tmp = (0.6666666666666666 - z) * (y * 6.0)
	else:
		tmp = x * (6.0 * z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.7e-16)
		tmp = Float64(y * Float64(4.0 + Float64(z * -6.0)));
	elseif (z <= 1.78e-19)
		tmp = Float64(Float64(y * 4.0) + Float64(x * -3.0));
	elseif (z <= 7.8e+219)
		tmp = Float64(Float64(0.6666666666666666 - z) * Float64(y * 6.0));
	else
		tmp = Float64(x * Float64(6.0 * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.7e-16)
		tmp = y * (4.0 + (z * -6.0));
	elseif (z <= 1.78e-19)
		tmp = (y * 4.0) + (x * -3.0);
	elseif (z <= 7.8e+219)
		tmp = (0.6666666666666666 - z) * (y * 6.0);
	else
		tmp = x * (6.0 * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -1.7e-16], N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.78e-19], N[(N[(y * 4.0), $MachinePrecision] + N[(x * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+219], N[(N[(0.6666666666666666 - z), $MachinePrecision] * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.78 \cdot 10^{-19}:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7e-16 < z < 1.78000000000000011e-19

    1. Initial program 99.4%

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

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

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

    if 1.78000000000000011e-19 < z < 7.7999999999999998e219

    1. Initial program 99.7%

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

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

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

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

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

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

    if 7.7999999999999998e219 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{-16}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 1.78 \cdot 10^{-19}:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+219}:\\ \;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \end{array} \]

Alternative 6: 97.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

    if -0.640000000000000013 < z < 0.660000000000000031

    1. Initial program 99.4%

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

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

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

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

Alternative 7: 97.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 99.7%

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

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

    if -0.67000000000000004 < z < 0.650000000000000022

    1. Initial program 99.4%

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

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

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

    if 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. neg-mul-199.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 58.3% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \left(6 \cdot z\right)\\

\mathbf{elif}\;x \leq 5 \cdot 10^{+106}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\

\mathbf{elif}\;x \leq 3.1 \cdot 10^{+199}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.59999999999999999e59

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.59999999999999999e59 < x < 4.9999999999999998e106

    1. Initial program 99.6%

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

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

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

    if 4.9999999999999998e106 < x < 3.09999999999999986e199

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.09999999999999986e199 < x

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.6 \cdot 10^{+59}:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+106}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{+199}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]

Alternative 9: 75.7% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7000000 \lor \neg \left(y \leq 3.4 \cdot 10^{-31}\right):\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7e6 or 3.4000000000000001e-31 < y

    1. Initial program 99.6%

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

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

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

    if -7e6 < y < 3.4000000000000001e-31

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 75.7% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1150000 \lor \neg \left(y \leq 3.3 \cdot 10^{-31}\right):\\
\;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.15e6 or 3.2999999999999999e-31 < y

    1. Initial program 99.6%

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

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

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

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

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

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

    if -1.15e6 < y < 3.2999999999999999e-31

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 75.8% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.3e8 or 2.9000000000000001e-31 < y

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.3e8 < y < 2.9000000000000001e-31

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 37.0% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;y \leq 3.05 \cdot 10^{-139}:\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.79999999999999982e-9 or 3.0499999999999999e-139 < y

    1. Initial program 99.6%

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

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

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

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

    if -5.79999999999999982e-9 < y < 3.0499999999999999e-139

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;y \leq 3.05 \cdot 10^{-139}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]

Alternative 13: 26.0% 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.5%

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

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

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

    \[\leadsto \color{blue}{4 \cdot y} \]
  5. Final simplification29.0%

    \[\leadsto y \cdot 4 \]

Alternative 14: 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.5%

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

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

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

    \[\leadsto x \]

Reproduce

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