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

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

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 49.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -2.9 \cdot 10^{+151}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1350000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-153}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.45 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-128}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6600000000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+61}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))) (t_1 (* -6.0 (* y z))))
   (if (<= z -2.9e+151)
     t_0
     (if (<= z -1350000.0)
       t_1
       (if (<= z -4e-153)
         (* x -3.0)
         (if (<= z 2.45e-256)
           (* y 4.0)
           (if (<= z 4.4e-128)
             (* x -3.0)
             (if (<= z 6600000000000.0)
               (* y 4.0)
               (if (<= z 3.4e+61) t_0 t_1)))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -2.9e+151) {
		tmp = t_0;
	} else if (z <= -1350000.0) {
		tmp = t_1;
	} else if (z <= -4e-153) {
		tmp = x * -3.0;
	} else if (z <= 2.45e-256) {
		tmp = y * 4.0;
	} else if (z <= 4.4e-128) {
		tmp = x * -3.0;
	} else if (z <= 6600000000000.0) {
		tmp = y * 4.0;
	} else if (z <= 3.4e+61) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    t_1 = (-6.0d0) * (y * z)
    if (z <= (-2.9d+151)) then
        tmp = t_0
    else if (z <= (-1350000.0d0)) then
        tmp = t_1
    else if (z <= (-4d-153)) then
        tmp = x * (-3.0d0)
    else if (z <= 2.45d-256) then
        tmp = y * 4.0d0
    else if (z <= 4.4d-128) then
        tmp = x * (-3.0d0)
    else if (z <= 6600000000000.0d0) then
        tmp = y * 4.0d0
    else if (z <= 3.4d+61) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (y * z);
	double tmp;
	if (z <= -2.9e+151) {
		tmp = t_0;
	} else if (z <= -1350000.0) {
		tmp = t_1;
	} else if (z <= -4e-153) {
		tmp = x * -3.0;
	} else if (z <= 2.45e-256) {
		tmp = y * 4.0;
	} else if (z <= 4.4e-128) {
		tmp = x * -3.0;
	} else if (z <= 6600000000000.0) {
		tmp = y * 4.0;
	} else if (z <= 3.4e+61) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	t_1 = -6.0 * (y * z)
	tmp = 0
	if z <= -2.9e+151:
		tmp = t_0
	elif z <= -1350000.0:
		tmp = t_1
	elif z <= -4e-153:
		tmp = x * -3.0
	elif z <= 2.45e-256:
		tmp = y * 4.0
	elif z <= 4.4e-128:
		tmp = x * -3.0
	elif z <= 6600000000000.0:
		tmp = y * 4.0
	elif z <= 3.4e+61:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	t_1 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -2.9e+151)
		tmp = t_0;
	elseif (z <= -1350000.0)
		tmp = t_1;
	elseif (z <= -4e-153)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.45e-256)
		tmp = Float64(y * 4.0);
	elseif (z <= 4.4e-128)
		tmp = Float64(x * -3.0);
	elseif (z <= 6600000000000.0)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.4e+61)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	t_1 = -6.0 * (y * z);
	tmp = 0.0;
	if (z <= -2.9e+151)
		tmp = t_0;
	elseif (z <= -1350000.0)
		tmp = t_1;
	elseif (z <= -4e-153)
		tmp = x * -3.0;
	elseif (z <= 2.45e-256)
		tmp = y * 4.0;
	elseif (z <= 4.4e-128)
		tmp = x * -3.0;
	elseif (z <= 6600000000000.0)
		tmp = y * 4.0;
	elseif (z <= 3.4e+61)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e+151], t$95$0, If[LessEqual[z, -1350000.0], t$95$1, If[LessEqual[z, -4e-153], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.45e-256], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.4e-128], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6600000000000.0], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.4e+61], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1350000:\\
\;\;\;\;t\_1\\

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

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

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

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

\mathbf{elif}\;z \leq 3.4 \cdot 10^{+61}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.90000000000000018e151 or 6.6e12 < z < 3.40000000000000026e61

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(z \cdot \left(6 - 3 \cdot \frac{1}{z}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r/67.7%

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

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

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

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

    if -2.90000000000000018e151 < z < -1.35e6 or 3.40000000000000026e61 < z

    1. Initial program 99.7%

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

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

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

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

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

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

    if -1.35e6 < z < -4.00000000000000016e-153 or 2.44999999999999998e-256 < z < 4.40000000000000019e-128

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified58.5%

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

    if -4.00000000000000016e-153 < z < 2.44999999999999998e-256 or 4.40000000000000019e-128 < z < 6.6e12

    1. Initial program 98.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified58.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+151}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1350000:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-153}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.45 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-128}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6600000000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+61}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 49.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -5.8 \cdot 10^{+154}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1350000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-153}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-113}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6600000000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+63}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* y z))))
   (if (<= z -5.8e+154)
     (* x (* z 6.0))
     (if (<= z -1350000.0)
       t_0
       (if (<= z -1.5e-153)
         (* x -3.0)
         (if (<= z 4.3e-256)
           (* y 4.0)
           (if (<= z 1.2e-113)
             (* x -3.0)
             (if (<= z 6600000000000.0)
               (* y 4.0)
               (if (<= z 8e+63) (* 6.0 (* x z)) t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -5.8e+154) {
		tmp = x * (z * 6.0);
	} else if (z <= -1350000.0) {
		tmp = t_0;
	} else if (z <= -1.5e-153) {
		tmp = x * -3.0;
	} else if (z <= 4.3e-256) {
		tmp = y * 4.0;
	} else if (z <= 1.2e-113) {
		tmp = x * -3.0;
	} else if (z <= 6600000000000.0) {
		tmp = y * 4.0;
	} else if (z <= 8e+63) {
		tmp = 6.0 * (x * z);
	} 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 <= (-5.8d+154)) then
        tmp = x * (z * 6.0d0)
    else if (z <= (-1350000.0d0)) then
        tmp = t_0
    else if (z <= (-1.5d-153)) then
        tmp = x * (-3.0d0)
    else if (z <= 4.3d-256) then
        tmp = y * 4.0d0
    else if (z <= 1.2d-113) then
        tmp = x * (-3.0d0)
    else if (z <= 6600000000000.0d0) then
        tmp = y * 4.0d0
    else if (z <= 8d+63) then
        tmp = 6.0d0 * (x * z)
    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 <= -5.8e+154) {
		tmp = x * (z * 6.0);
	} else if (z <= -1350000.0) {
		tmp = t_0;
	} else if (z <= -1.5e-153) {
		tmp = x * -3.0;
	} else if (z <= 4.3e-256) {
		tmp = y * 4.0;
	} else if (z <= 1.2e-113) {
		tmp = x * -3.0;
	} else if (z <= 6600000000000.0) {
		tmp = y * 4.0;
	} else if (z <= 8e+63) {
		tmp = 6.0 * (x * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (y * z)
	tmp = 0
	if z <= -5.8e+154:
		tmp = x * (z * 6.0)
	elif z <= -1350000.0:
		tmp = t_0
	elif z <= -1.5e-153:
		tmp = x * -3.0
	elif z <= 4.3e-256:
		tmp = y * 4.0
	elif z <= 1.2e-113:
		tmp = x * -3.0
	elif z <= 6600000000000.0:
		tmp = y * 4.0
	elif z <= 8e+63:
		tmp = 6.0 * (x * z)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -5.8e+154)
		tmp = Float64(x * Float64(z * 6.0));
	elseif (z <= -1350000.0)
		tmp = t_0;
	elseif (z <= -1.5e-153)
		tmp = Float64(x * -3.0);
	elseif (z <= 4.3e-256)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.2e-113)
		tmp = Float64(x * -3.0);
	elseif (z <= 6600000000000.0)
		tmp = Float64(y * 4.0);
	elseif (z <= 8e+63)
		tmp = Float64(6.0 * Float64(x * z));
	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 <= -5.8e+154)
		tmp = x * (z * 6.0);
	elseif (z <= -1350000.0)
		tmp = t_0;
	elseif (z <= -1.5e-153)
		tmp = x * -3.0;
	elseif (z <= 4.3e-256)
		tmp = y * 4.0;
	elseif (z <= 1.2e-113)
		tmp = x * -3.0;
	elseif (z <= 6600000000000.0)
		tmp = y * 4.0;
	elseif (z <= 8e+63)
		tmp = 6.0 * (x * z);
	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, -5.8e+154], N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1350000.0], t$95$0, If[LessEqual[z, -1.5e-153], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4.3e-256], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.2e-113], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6600000000000.0], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 8e+63], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1350000:\\
\;\;\;\;t\_0\\

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999959e154 < z < -1.35e6 or 8.00000000000000046e63 < z

    1. Initial program 99.7%

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

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

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

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

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

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

    if -1.35e6 < z < -1.5e-153 or 4.3000000000000001e-256 < z < 1.20000000000000006e-113

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified58.5%

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

    if -1.5e-153 < z < 4.3000000000000001e-256 or 1.20000000000000006e-113 < z < 6.6e12

    1. Initial program 98.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified58.5%

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

    if 6.6e12 < z < 8.00000000000000046e63

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(z \cdot \left(6 - 3 \cdot \frac{1}{z}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r/72.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+154}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1350000:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-153}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-113}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6600000000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+63}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 49.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.6 \cdot 10^{+151}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1350000:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-155}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-123}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6600000000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.55 \cdot 10^{+61}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -7.6e+151)
   (* x (* z 6.0))
   (if (<= z -1350000.0)
     (* -6.0 (* y z))
     (if (<= z -3e-155)
       (* x -3.0)
       (if (<= z 7.5e-256)
         (* y 4.0)
         (if (<= z 3.5e-123)
           (* x -3.0)
           (if (<= z 6600000000000.0)
             (* y 4.0)
             (if (<= z 3.55e+61) (* 6.0 (* x z)) (* y (* z -6.0))))))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -7.6e+151) {
		tmp = x * (z * 6.0);
	} else if (z <= -1350000.0) {
		tmp = -6.0 * (y * z);
	} else if (z <= -3e-155) {
		tmp = x * -3.0;
	} else if (z <= 7.5e-256) {
		tmp = y * 4.0;
	} else if (z <= 3.5e-123) {
		tmp = x * -3.0;
	} else if (z <= 6600000000000.0) {
		tmp = y * 4.0;
	} else if (z <= 3.55e+61) {
		tmp = 6.0 * (x * z);
	} else {
		tmp = y * (z * -6.0);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-7.6d+151)) then
        tmp = x * (z * 6.0d0)
    else if (z <= (-1350000.0d0)) then
        tmp = (-6.0d0) * (y * z)
    else if (z <= (-3d-155)) then
        tmp = x * (-3.0d0)
    else if (z <= 7.5d-256) then
        tmp = y * 4.0d0
    else if (z <= 3.5d-123) then
        tmp = x * (-3.0d0)
    else if (z <= 6600000000000.0d0) then
        tmp = y * 4.0d0
    else if (z <= 3.55d+61) then
        tmp = 6.0d0 * (x * z)
    else
        tmp = y * (z * (-6.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -7.6e+151) {
		tmp = x * (z * 6.0);
	} else if (z <= -1350000.0) {
		tmp = -6.0 * (y * z);
	} else if (z <= -3e-155) {
		tmp = x * -3.0;
	} else if (z <= 7.5e-256) {
		tmp = y * 4.0;
	} else if (z <= 3.5e-123) {
		tmp = x * -3.0;
	} else if (z <= 6600000000000.0) {
		tmp = y * 4.0;
	} else if (z <= 3.55e+61) {
		tmp = 6.0 * (x * z);
	} else {
		tmp = y * (z * -6.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -7.6e+151:
		tmp = x * (z * 6.0)
	elif z <= -1350000.0:
		tmp = -6.0 * (y * z)
	elif z <= -3e-155:
		tmp = x * -3.0
	elif z <= 7.5e-256:
		tmp = y * 4.0
	elif z <= 3.5e-123:
		tmp = x * -3.0
	elif z <= 6600000000000.0:
		tmp = y * 4.0
	elif z <= 3.55e+61:
		tmp = 6.0 * (x * z)
	else:
		tmp = y * (z * -6.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -7.6e+151)
		tmp = Float64(x * Float64(z * 6.0));
	elseif (z <= -1350000.0)
		tmp = Float64(-6.0 * Float64(y * z));
	elseif (z <= -3e-155)
		tmp = Float64(x * -3.0);
	elseif (z <= 7.5e-256)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.5e-123)
		tmp = Float64(x * -3.0);
	elseif (z <= 6600000000000.0)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.55e+61)
		tmp = Float64(6.0 * Float64(x * z));
	else
		tmp = Float64(y * Float64(z * -6.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -7.6e+151)
		tmp = x * (z * 6.0);
	elseif (z <= -1350000.0)
		tmp = -6.0 * (y * z);
	elseif (z <= -3e-155)
		tmp = x * -3.0;
	elseif (z <= 7.5e-256)
		tmp = y * 4.0;
	elseif (z <= 3.5e-123)
		tmp = x * -3.0;
	elseif (z <= 6600000000000.0)
		tmp = y * 4.0;
	elseif (z <= 3.55e+61)
		tmp = 6.0 * (x * z);
	else
		tmp = y * (z * -6.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -7.6e+151], N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1350000.0], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3e-155], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 7.5e-256], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.5e-123], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6600000000000.0], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.55e+61], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -7.6000000000000001e151

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.6000000000000001e151 < z < -1.35e6

    1. Initial program 99.6%

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

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

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

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

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

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

    if -1.35e6 < z < -2.99999999999999984e-155 or 7.50000000000000005e-256 < z < 3.4999999999999999e-123

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified58.5%

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

    if -2.99999999999999984e-155 < z < 7.50000000000000005e-256 or 3.4999999999999999e-123 < z < 6.6e12

    1. Initial program 98.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified58.5%

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

    if 6.6e12 < z < 3.55e61

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(z \cdot \left(6 - 3 \cdot \frac{1}{z}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r/72.3%

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

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

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

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

    if 3.55e61 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.6 \cdot 10^{+151}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1350000:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-155}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-123}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6600000000000:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.55 \cdot 10^{+61}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -1800000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-156}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{-116}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-12}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq 460000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))) (t_1 (* -6.0 (* (- y x) z))))
   (if (<= z -1800000.0)
     t_1
     (if (<= z -2.8e-156)
       t_0
       (if (<= z 2.8e-256)
         (* y 4.0)
         (if (<= z 1.26e-116)
           (* x -3.0)
           (if (<= z 1.25e-12)
             (* 6.0 (* y (- 0.6666666666666666 z)))
             (if (<= z 460000.0) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -1800000.0) {
		tmp = t_1;
	} else if (z <= -2.8e-156) {
		tmp = t_0;
	} else if (z <= 2.8e-256) {
		tmp = y * 4.0;
	} else if (z <= 1.26e-116) {
		tmp = x * -3.0;
	} else if (z <= 1.25e-12) {
		tmp = 6.0 * (y * (0.6666666666666666 - z));
	} else if (z <= 460000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * ((-3.0d0) + (z * 6.0d0))
    t_1 = (-6.0d0) * ((y - x) * z)
    if (z <= (-1800000.0d0)) then
        tmp = t_1
    else if (z <= (-2.8d-156)) then
        tmp = t_0
    else if (z <= 2.8d-256) then
        tmp = y * 4.0d0
    else if (z <= 1.26d-116) then
        tmp = x * (-3.0d0)
    else if (z <= 1.25d-12) then
        tmp = 6.0d0 * (y * (0.6666666666666666d0 - z))
    else if (z <= 460000.0d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -1800000.0) {
		tmp = t_1;
	} else if (z <= -2.8e-156) {
		tmp = t_0;
	} else if (z <= 2.8e-256) {
		tmp = y * 4.0;
	} else if (z <= 1.26e-116) {
		tmp = x * -3.0;
	} else if (z <= 1.25e-12) {
		tmp = 6.0 * (y * (0.6666666666666666 - z));
	} else if (z <= 460000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	t_1 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -1800000.0:
		tmp = t_1
	elif z <= -2.8e-156:
		tmp = t_0
	elif z <= 2.8e-256:
		tmp = y * 4.0
	elif z <= 1.26e-116:
		tmp = x * -3.0
	elif z <= 1.25e-12:
		tmp = 6.0 * (y * (0.6666666666666666 - z))
	elif z <= 460000.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	t_1 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -1800000.0)
		tmp = t_1;
	elseif (z <= -2.8e-156)
		tmp = t_0;
	elseif (z <= 2.8e-256)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.26e-116)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.25e-12)
		tmp = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)));
	elseif (z <= 460000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	t_1 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -1800000.0)
		tmp = t_1;
	elseif (z <= -2.8e-156)
		tmp = t_0;
	elseif (z <= 2.8e-256)
		tmp = y * 4.0;
	elseif (z <= 1.26e-116)
		tmp = x * -3.0;
	elseif (z <= 1.25e-12)
		tmp = 6.0 * (y * (0.6666666666666666 - z));
	elseif (z <= 460000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1800000.0], t$95$1, If[LessEqual[z, -2.8e-156], t$95$0, If[LessEqual[z, 2.8e-256], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.26e-116], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.25e-12], N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 460000.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.8 \cdot 10^{-156}:\\
\;\;\;\;t\_0\\

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

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

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

\mathbf{elif}\;z \leq 460000:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.8e6 or 4.6e5 < z

    1. Initial program 99.7%

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

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

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

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

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

    if -1.8e6 < z < -2.8000000000000002e-156 or 1.24999999999999992e-12 < z < 4.6e5

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8000000000000002e-156 < z < 2.80000000000000023e-256

    1. Initial program 97.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified62.3%

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

    if 2.80000000000000023e-256 < z < 1.2599999999999999e-116

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2599999999999999e-116 < z < 1.24999999999999992e-12

    1. Initial program 99.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1800000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-156}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{-116}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-12}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq 460000:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ t_2 := y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{if}\;z \leq -1600000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-155}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-256}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-133}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.95 \cdot 10^{-12}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 102000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0))))
        (t_1 (* -6.0 (* (- y x) z)))
        (t_2 (* y (+ 4.0 (* z -6.0)))))
   (if (<= z -1600000.0)
     t_1
     (if (<= z -4.5e-155)
       t_0
       (if (<= z 3.4e-256)
         t_2
         (if (<= z 6.6e-133)
           (* x -3.0)
           (if (<= z 2.95e-12) t_2 (if (<= z 102000.0) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * ((y - x) * z);
	double t_2 = y * (4.0 + (z * -6.0));
	double tmp;
	if (z <= -1600000.0) {
		tmp = t_1;
	} else if (z <= -4.5e-155) {
		tmp = t_0;
	} else if (z <= 3.4e-256) {
		tmp = t_2;
	} else if (z <= 6.6e-133) {
		tmp = x * -3.0;
	} else if (z <= 2.95e-12) {
		tmp = t_2;
	} else if (z <= 102000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = x * ((-3.0d0) + (z * 6.0d0))
    t_1 = (-6.0d0) * ((y - x) * z)
    t_2 = y * (4.0d0 + (z * (-6.0d0)))
    if (z <= (-1600000.0d0)) then
        tmp = t_1
    else if (z <= (-4.5d-155)) then
        tmp = t_0
    else if (z <= 3.4d-256) then
        tmp = t_2
    else if (z <= 6.6d-133) then
        tmp = x * (-3.0d0)
    else if (z <= 2.95d-12) then
        tmp = t_2
    else if (z <= 102000.0d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = -6.0 * ((y - x) * z);
	double t_2 = y * (4.0 + (z * -6.0));
	double tmp;
	if (z <= -1600000.0) {
		tmp = t_1;
	} else if (z <= -4.5e-155) {
		tmp = t_0;
	} else if (z <= 3.4e-256) {
		tmp = t_2;
	} else if (z <= 6.6e-133) {
		tmp = x * -3.0;
	} else if (z <= 2.95e-12) {
		tmp = t_2;
	} else if (z <= 102000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	t_1 = -6.0 * ((y - x) * z)
	t_2 = y * (4.0 + (z * -6.0))
	tmp = 0
	if z <= -1600000.0:
		tmp = t_1
	elif z <= -4.5e-155:
		tmp = t_0
	elif z <= 3.4e-256:
		tmp = t_2
	elif z <= 6.6e-133:
		tmp = x * -3.0
	elif z <= 2.95e-12:
		tmp = t_2
	elif z <= 102000.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	t_1 = Float64(-6.0 * Float64(Float64(y - x) * z))
	t_2 = Float64(y * Float64(4.0 + Float64(z * -6.0)))
	tmp = 0.0
	if (z <= -1600000.0)
		tmp = t_1;
	elseif (z <= -4.5e-155)
		tmp = t_0;
	elseif (z <= 3.4e-256)
		tmp = t_2;
	elseif (z <= 6.6e-133)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.95e-12)
		tmp = t_2;
	elseif (z <= 102000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	t_1 = -6.0 * ((y - x) * z);
	t_2 = y * (4.0 + (z * -6.0));
	tmp = 0.0;
	if (z <= -1600000.0)
		tmp = t_1;
	elseif (z <= -4.5e-155)
		tmp = t_0;
	elseif (z <= 3.4e-256)
		tmp = t_2;
	elseif (z <= 6.6e-133)
		tmp = x * -3.0;
	elseif (z <= 2.95e-12)
		tmp = t_2;
	elseif (z <= 102000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1600000.0], t$95$1, If[LessEqual[z, -4.5e-155], t$95$0, If[LessEqual[z, 3.4e-256], t$95$2, If[LessEqual[z, 6.6e-133], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.95e-12], t$95$2, If[LessEqual[z, 102000.0], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -4.5 \cdot 10^{-155}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 3.4 \cdot 10^{-256}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;z \leq 2.95 \cdot 10^{-12}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq 102000:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.6e6 or 102000 < z

    1. Initial program 99.7%

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

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

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

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

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

    if -1.6e6 < z < -4.5000000000000004e-155 or 2.95e-12 < z < 102000

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.5000000000000004e-155 < z < 3.4000000000000001e-256 or 6.60000000000000019e-133 < z < 2.95e-12

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4000000000000001e-256 < z < 6.60000000000000019e-133

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1600000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-155}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-256}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-133}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.95 \cdot 10^{-12}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 102000:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 74.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ t_1 := y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{if}\;z \leq -1500000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-151}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-256}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-113}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-12}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1200000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))) (t_1 (* y (+ 4.0 (* z -6.0)))))
   (if (<= z -1500000.0)
     (* -6.0 (* (- y x) z))
     (if (<= z -5.5e-151)
       t_0
       (if (<= z 2.9e-256)
         t_1
         (if (<= z 2.7e-113)
           (* x -3.0)
           (if (<= z 3.5e-12)
             t_1
             (if (<= z 1200000.0) t_0 (* z (* (- y x) -6.0))))))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = y * (4.0 + (z * -6.0));
	double tmp;
	if (z <= -1500000.0) {
		tmp = -6.0 * ((y - x) * z);
	} else if (z <= -5.5e-151) {
		tmp = t_0;
	} else if (z <= 2.9e-256) {
		tmp = t_1;
	} else if (z <= 2.7e-113) {
		tmp = x * -3.0;
	} else if (z <= 3.5e-12) {
		tmp = t_1;
	} else if (z <= 1200000.0) {
		tmp = t_0;
	} else {
		tmp = z * ((y - x) * -6.0);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * ((-3.0d0) + (z * 6.0d0))
    t_1 = y * (4.0d0 + (z * (-6.0d0)))
    if (z <= (-1500000.0d0)) then
        tmp = (-6.0d0) * ((y - x) * z)
    else if (z <= (-5.5d-151)) then
        tmp = t_0
    else if (z <= 2.9d-256) then
        tmp = t_1
    else if (z <= 2.7d-113) then
        tmp = x * (-3.0d0)
    else if (z <= 3.5d-12) then
        tmp = t_1
    else if (z <= 1200000.0d0) then
        tmp = t_0
    else
        tmp = z * ((y - x) * (-6.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = y * (4.0 + (z * -6.0));
	double tmp;
	if (z <= -1500000.0) {
		tmp = -6.0 * ((y - x) * z);
	} else if (z <= -5.5e-151) {
		tmp = t_0;
	} else if (z <= 2.9e-256) {
		tmp = t_1;
	} else if (z <= 2.7e-113) {
		tmp = x * -3.0;
	} else if (z <= 3.5e-12) {
		tmp = t_1;
	} else if (z <= 1200000.0) {
		tmp = t_0;
	} else {
		tmp = z * ((y - x) * -6.0);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	t_1 = y * (4.0 + (z * -6.0))
	tmp = 0
	if z <= -1500000.0:
		tmp = -6.0 * ((y - x) * z)
	elif z <= -5.5e-151:
		tmp = t_0
	elif z <= 2.9e-256:
		tmp = t_1
	elif z <= 2.7e-113:
		tmp = x * -3.0
	elif z <= 3.5e-12:
		tmp = t_1
	elif z <= 1200000.0:
		tmp = t_0
	else:
		tmp = z * ((y - x) * -6.0)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	t_1 = Float64(y * Float64(4.0 + Float64(z * -6.0)))
	tmp = 0.0
	if (z <= -1500000.0)
		tmp = Float64(-6.0 * Float64(Float64(y - x) * z));
	elseif (z <= -5.5e-151)
		tmp = t_0;
	elseif (z <= 2.9e-256)
		tmp = t_1;
	elseif (z <= 2.7e-113)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.5e-12)
		tmp = t_1;
	elseif (z <= 1200000.0)
		tmp = t_0;
	else
		tmp = Float64(z * Float64(Float64(y - x) * -6.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	t_1 = y * (4.0 + (z * -6.0));
	tmp = 0.0;
	if (z <= -1500000.0)
		tmp = -6.0 * ((y - x) * z);
	elseif (z <= -5.5e-151)
		tmp = t_0;
	elseif (z <= 2.9e-256)
		tmp = t_1;
	elseif (z <= 2.7e-113)
		tmp = x * -3.0;
	elseif (z <= 3.5e-12)
		tmp = t_1;
	elseif (z <= 1200000.0)
		tmp = t_0;
	else
		tmp = z * ((y - x) * -6.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1500000.0], N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.5e-151], t$95$0, If[LessEqual[z, 2.9e-256], t$95$1, If[LessEqual[z, 2.7e-113], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.5e-12], t$95$1, If[LessEqual[z, 1200000.0], t$95$0, N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -5.5 \cdot 10^{-151}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.9 \cdot 10^{-256}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 3.5 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1200000:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 99.7%

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

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

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

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

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

    if -1.5e6 < z < -5.4999999999999998e-151 or 3.5e-12 < z < 1.2e6

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.4999999999999998e-151 < z < 2.89999999999999971e-256 or 2.69999999999999996e-113 < z < 3.5e-12

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.89999999999999971e-256 < z < 2.69999999999999996e-113

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2e6 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1500000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-151}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-256}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-113}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-12}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 1200000:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 73.9% accurate, 0.4× speedup?

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

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.017000000000000001 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. metadata-eval99.7%

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

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

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

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

    if -0.017000000000000001 < z < -5.40000000000000014e-151 or 2.80000000000000023e-256 < z < 7.8999999999999996e-131

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.40000000000000014e-151 < z < 2.80000000000000023e-256 or 7.8999999999999996e-131 < z < 0.660000000000000031

    1. Initial program 98.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified59.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.017:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{-151}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7.9 \cdot 10^{-131}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 74.2% accurate, 0.4× speedup?

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

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 99.7%

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

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

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

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

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

    if -0.0140000000000000003 < z < -2.2499999999999999e-154 or 1.4999999999999999e-256 < z < 7.5999999999999994e-132

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2499999999999999e-154 < z < 1.4999999999999999e-256

    1. Initial program 97.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified62.3%

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

    if 7.5999999999999994e-132 < z < 59000

    1. Initial program 99.1%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.014:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{-154}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-132}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 59000:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 50.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -1350000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-151}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-119}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-10}:\\ \;\;\;\;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 -1350000.0)
     t_0
     (if (<= z -1.45e-151)
       (* x -3.0)
       (if (<= z 6.5e-256)
         (* y 4.0)
         (if (<= z 1.12e-119)
           (* x -3.0)
           (if (<= z 2.2e-10) (* y 4.0) t_0)))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -1350000.0) {
		tmp = t_0;
	} else if (z <= -1.45e-151) {
		tmp = x * -3.0;
	} else if (z <= 6.5e-256) {
		tmp = y * 4.0;
	} else if (z <= 1.12e-119) {
		tmp = x * -3.0;
	} else if (z <= 2.2e-10) {
		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 <= (-1350000.0d0)) then
        tmp = t_0
    else if (z <= (-1.45d-151)) then
        tmp = x * (-3.0d0)
    else if (z <= 6.5d-256) then
        tmp = y * 4.0d0
    else if (z <= 1.12d-119) then
        tmp = x * (-3.0d0)
    else if (z <= 2.2d-10) 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 <= -1350000.0) {
		tmp = t_0;
	} else if (z <= -1.45e-151) {
		tmp = x * -3.0;
	} else if (z <= 6.5e-256) {
		tmp = y * 4.0;
	} else if (z <= 1.12e-119) {
		tmp = x * -3.0;
	} else if (z <= 2.2e-10) {
		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 <= -1350000.0:
		tmp = t_0
	elif z <= -1.45e-151:
		tmp = x * -3.0
	elif z <= 6.5e-256:
		tmp = y * 4.0
	elif z <= 1.12e-119:
		tmp = x * -3.0
	elif z <= 2.2e-10:
		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 <= -1350000.0)
		tmp = t_0;
	elseif (z <= -1.45e-151)
		tmp = Float64(x * -3.0);
	elseif (z <= 6.5e-256)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.12e-119)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.2e-10)
		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 <= -1350000.0)
		tmp = t_0;
	elseif (z <= -1.45e-151)
		tmp = x * -3.0;
	elseif (z <= 6.5e-256)
		tmp = y * 4.0;
	elseif (z <= 1.12e-119)
		tmp = x * -3.0;
	elseif (z <= 2.2e-10)
		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, -1350000.0], t$95$0, If[LessEqual[z, -1.45e-151], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6.5e-256], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.12e-119], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.2e-10], 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 -1350000:\\
\;\;\;\;t\_0\\

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.35e6 or 2.1999999999999999e-10 < z

    1. Initial program 99.7%

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

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

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

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

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

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

    if -1.35e6 < z < -1.45000000000000006e-151 or 6.50000000000000052e-256 < z < 1.11999999999999998e-119

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified58.5%

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

    if -1.45000000000000006e-151 < z < 6.50000000000000052e-256 or 1.11999999999999998e-119 < z < 2.1999999999999999e-10

    1. Initial program 98.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified63.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1350000:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-151}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-256}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-119}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-10}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 97.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

    if -0.56000000000000005 < z < 0.52000000000000002

    1. Initial program 98.6%

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

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

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

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

    if 0.52000000000000002 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 97.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

    if -0.56000000000000005 < z < 0.5

    1. Initial program 98.6%

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

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

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

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

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

    if 0.5 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

Alternative 13: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

Alternative 14: 38.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+69} \lor \neg \left(x \leq 2.8 \cdot 10^{+14}\right):\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.80000000000000028e69 or 2.8e14 < x

    1. Initial program 98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.80000000000000028e69 < x < 2.8e14

    1. Initial program 99.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified36.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{+69} \lor \neg \left(x \leq 2.8 \cdot 10^{+14}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

Alternative 16: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 17: 26.5% accurate, 4.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot -3} \]
  11. Final simplification25.7%

    \[\leadsto x \cdot -3 \]
  12. Add Preprocessing

Alternative 18: 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.2%

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

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

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

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

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

    \[\leadsto x \]
  8. Add Preprocessing

Reproduce

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