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

Percentage Accurate: 99.5% → 99.8%
Time: 9.0s
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.8% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -5400000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-57}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 15500000000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y (- 0.6666666666666666 z))))
        (t_1 (* -6.0 (* (- y x) z))))
   (if (<= z -5400000.0)
     t_1
     (if (<= z -3.3e-57)
       t_0
       (if (<= z 1.1e-255) (* x -3.0) (if (<= z 15500000000000.0) t_0 t_1))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -5400000.0) {
		tmp = t_1;
	} else if (z <= -3.3e-57) {
		tmp = t_0;
	} else if (z <= 1.1e-255) {
		tmp = x * -3.0;
	} else if (z <= 15500000000000.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 = 6.0d0 * (y * (0.6666666666666666d0 - z))
    t_1 = (-6.0d0) * ((y - x) * z)
    if (z <= (-5400000.0d0)) then
        tmp = t_1
    else if (z <= (-3.3d-57)) then
        tmp = t_0
    else if (z <= 1.1d-255) then
        tmp = x * (-3.0d0)
    else if (z <= 15500000000000.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 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -5400000.0) {
		tmp = t_1;
	} else if (z <= -3.3e-57) {
		tmp = t_0;
	} else if (z <= 1.1e-255) {
		tmp = x * -3.0;
	} else if (z <= 15500000000000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * (0.6666666666666666 - z))
	t_1 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -5400000.0:
		tmp = t_1
	elif z <= -3.3e-57:
		tmp = t_0
	elif z <= 1.1e-255:
		tmp = x * -3.0
	elif z <= 15500000000000.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)))
	t_1 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -5400000.0)
		tmp = t_1;
	elseif (z <= -3.3e-57)
		tmp = t_0;
	elseif (z <= 1.1e-255)
		tmp = Float64(x * -3.0);
	elseif (z <= 15500000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * (0.6666666666666666 - z));
	t_1 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -5400000.0)
		tmp = t_1;
	elseif (z <= -3.3e-57)
		tmp = t_0;
	elseif (z <= 1.1e-255)
		tmp = x * -3.0;
	elseif (z <= 15500000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5400000.0], t$95$1, If[LessEqual[z, -3.3e-57], t$95$0, If[LessEqual[z, 1.1e-255], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 15500000000000.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.3 \cdot 10^{-57}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.4e6 or 1.55e13 < z

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

    if -5.4e6 < z < -3.2999999999999998e-57 or 1.1e-255 < z < 1.55e13

    1. Initial program 99.4%

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

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

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

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

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

    if -3.2999999999999998e-57 < z < 1.1e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5400000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-57}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 15500000000000:\\ \;\;\;\;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} \]

Alternative 3: 74.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -4500000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-57}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-255}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 18500000000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y (- 0.6666666666666666 z))))
        (t_1 (* -6.0 (* (- y x) z))))
   (if (<= z -4500000.0)
     t_1
     (if (<= z -1.55e-57)
       t_0
       (if (<= z 1.1e-255)
         (* x (+ -3.0 (* z 6.0)))
         (if (<= z 18500000000000.0) t_0 t_1))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -4500000.0) {
		tmp = t_1;
	} else if (z <= -1.55e-57) {
		tmp = t_0;
	} else if (z <= 1.1e-255) {
		tmp = x * (-3.0 + (z * 6.0));
	} else if (z <= 18500000000000.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 = 6.0d0 * (y * (0.6666666666666666d0 - z))
    t_1 = (-6.0d0) * ((y - x) * z)
    if (z <= (-4500000.0d0)) then
        tmp = t_1
    else if (z <= (-1.55d-57)) then
        tmp = t_0
    else if (z <= 1.1d-255) then
        tmp = x * ((-3.0d0) + (z * 6.0d0))
    else if (z <= 18500000000000.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 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * ((y - x) * z);
	double tmp;
	if (z <= -4500000.0) {
		tmp = t_1;
	} else if (z <= -1.55e-57) {
		tmp = t_0;
	} else if (z <= 1.1e-255) {
		tmp = x * (-3.0 + (z * 6.0));
	} else if (z <= 18500000000000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * (0.6666666666666666 - z))
	t_1 = -6.0 * ((y - x) * z)
	tmp = 0
	if z <= -4500000.0:
		tmp = t_1
	elif z <= -1.55e-57:
		tmp = t_0
	elif z <= 1.1e-255:
		tmp = x * (-3.0 + (z * 6.0))
	elif z <= 18500000000000.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)))
	t_1 = Float64(-6.0 * Float64(Float64(y - x) * z))
	tmp = 0.0
	if (z <= -4500000.0)
		tmp = t_1;
	elseif (z <= -1.55e-57)
		tmp = t_0;
	elseif (z <= 1.1e-255)
		tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0)));
	elseif (z <= 18500000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * (0.6666666666666666 - z));
	t_1 = -6.0 * ((y - x) * z);
	tmp = 0.0;
	if (z <= -4500000.0)
		tmp = t_1;
	elseif (z <= -1.55e-57)
		tmp = t_0;
	elseif (z <= 1.1e-255)
		tmp = x * (-3.0 + (z * 6.0));
	elseif (z <= 18500000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4500000.0], t$95$1, If[LessEqual[z, -1.55e-57], t$95$0, If[LessEqual[z, 1.1e-255], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 18500000000000.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.55 \cdot 10^{-57}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.5e6 or 1.85e13 < z

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

    if -4.5e6 < z < -1.54999999999999988e-57 or 1.1e-255 < z < 1.85e13

    1. Initial program 99.4%

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

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

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

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

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

    if -1.54999999999999988e-57 < z < 1.1e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4500000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-57}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-255}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 18500000000000:\\ \;\;\;\;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} \]

Alternative 4: 74.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq -6.6 \cdot 10^{-75}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.2e6 or 1.55e13 < z

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

    if -4.2e6 < z < -6.5999999999999999e-75 or 1.92e-255 < z < 1.55e13

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.5999999999999999e-75 < z < 1.92e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4200000:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-75}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 1.92 \cdot 10^{-255}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 15500000000000:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 5: 74.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq -1.55 \cdot 10^{-73}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.2e6 or 1.55e13 < z

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-6 \cdot z\right) + x \cdot \color{blue}{\left(6 \cdot z\right)} \]
      7. metadata-eval96.0%

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

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

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

        \[\leadsto y \cdot \left(-6 \cdot z\right) + \color{blue}{\left(-x\right) \cdot \left(-6 \cdot z\right)} \]
      11. distribute-rgt-out99.6%

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

        \[\leadsto \left(\color{blue}{\left(-6\right)} \cdot z\right) \cdot \left(y + \left(-x\right)\right) \]
      13. distribute-lft-neg-in99.6%

        \[\leadsto \color{blue}{\left(-6 \cdot z\right)} \cdot \left(y + \left(-x\right)\right) \]
      14. distribute-rgt-neg-out99.6%

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

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

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

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

        \[\leadsto \left(-z\right) \cdot \color{blue}{\left(\left(y - x\right) \cdot 6\right)} \]
      19. distribute-lft-neg-out99.6%

        \[\leadsto \color{blue}{-z \cdot \left(\left(y - x\right) \cdot 6\right)} \]
      20. distribute-rgt-neg-in99.6%

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

        \[\leadsto z \cdot \left(-\color{blue}{6 \cdot \left(y - x\right)}\right) \]
      22. distribute-lft-neg-in99.6%

        \[\leadsto z \cdot \color{blue}{\left(\left(-6\right) \cdot \left(y - x\right)\right)} \]
      23. metadata-eval99.6%

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

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

    if -8.2e6 < z < -1.54999999999999985e-73 or 1.32e-255 < z < 1.55e13

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.54999999999999985e-73 < z < 1.32e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8200000:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-73}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-255}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 15500000000000:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \end{array} \]

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

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

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

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
  4. Taylor expanded in 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)} \]
  5. Final simplification99.8%

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

Alternative 7: 49.8% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq -3.6 \cdot 10^{-14}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\

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

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

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


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

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

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

    if -6e177 < z < -3.5999999999999998e-14

    1. Initial program 99.6%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 83.7%

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

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

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

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

    if -3.5999999999999998e-14 < z < 2.05e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.05e-255 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in95.2%

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 4 \cdot y \]
      7. distribute-rgt1-in95.5%

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

        \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
      9. *-commutative95.5%

        \[\leadsto \color{blue}{x \cdot -3} + 4 \cdot y \]
      10. *-commutative95.5%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    7. Simplified95.5%

      \[\leadsto \color{blue}{x \cdot -3 + y \cdot 4} \]
    8. Taylor expanded in x around 0 59.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+177}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-14}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.05 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 8: 49.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq -3.6 \cdot 10^{-14}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.50000000000000006e161 < z < -3.5999999999999998e-14

    1. Initial program 99.6%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 82.8%

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

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

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

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

    if -3.5999999999999998e-14 < z < 2.05e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.05e-255 < z < 0.57999999999999996

    1. Initial program 99.5%

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

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

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

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in95.2%

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 4 \cdot y \]
      7. distribute-rgt1-in95.5%

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

        \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
      9. *-commutative95.5%

        \[\leadsto \color{blue}{x \cdot -3} + 4 \cdot y \]
      10. *-commutative95.5%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    7. Simplified95.5%

      \[\leadsto \color{blue}{x \cdot -3 + y \cdot 4} \]
    8. Taylor expanded in x around 0 59.1%

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

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

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

    if 0.57999999999999996 < z

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+161}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-14}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.05 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.58:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 9: 49.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq -3.6 \cdot 10^{-14}:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.01999999999999993e162 < z < -3.5999999999999998e-14

    1. Initial program 99.6%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 82.8%

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

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

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

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

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

    if -3.5999999999999998e-14 < z < 1.59999999999999996e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.59999999999999996e-255 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in95.2%

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 4 \cdot y \]
      7. distribute-rgt1-in95.5%

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

        \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
      9. *-commutative95.5%

        \[\leadsto \color{blue}{x \cdot -3} + 4 \cdot y \]
      10. *-commutative95.5%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    7. Simplified95.5%

      \[\leadsto \color{blue}{x \cdot -3 + y \cdot 4} \]
    8. Taylor expanded in x around 0 59.1%

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

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

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

    if 0.5 < z

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.02 \cdot 10^{+162}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{-14}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 10: 49.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq -3.6 \cdot 10^{-14}:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\

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

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

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


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

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 99.8%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(6 \cdot \left(x \cdot z\right)\right)\right)} \]
      2. expm1-udef44.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(6 \cdot \left(x \cdot z\right)\right)} - 1} \]
      3. *-commutative44.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(x \cdot z\right) \cdot 6}\right)} - 1 \]
      4. *-commutative44.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(z \cdot x\right)} \cdot 6\right)} - 1 \]
      5. associate-*l*44.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{z \cdot \left(x \cdot 6\right)}\right)} - 1 \]
    8. Applied egg-rr44.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(z \cdot \left(x \cdot 6\right)\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def44.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(z \cdot \left(x \cdot 6\right)\right)\right)} \]
      2. expm1-log1p63.8%

        \[\leadsto \color{blue}{z \cdot \left(x \cdot 6\right)} \]
    10. Simplified63.8%

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

    if -1.3500000000000001e162 < z < -3.5999999999999998e-14

    1. Initial program 99.6%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 82.8%

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

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

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

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

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

    if -3.5999999999999998e-14 < z < 1.02000000000000002e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.02000000000000002e-255 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in95.2%

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 4 \cdot y \]
      7. distribute-rgt1-in95.5%

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

        \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
      9. *-commutative95.5%

        \[\leadsto \color{blue}{x \cdot -3} + 4 \cdot y \]
      10. *-commutative95.5%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    7. Simplified95.5%

      \[\leadsto \color{blue}{x \cdot -3 + y \cdot 4} \]
    8. Taylor expanded in x around 0 59.1%

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

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

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

    if 0.5 < z

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in 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)} \]
    5. Taylor expanded in z around inf 99.6%

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

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

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

Alternative 11: 73.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{-14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.52:\\ \;\;\;\;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 -3.6e-14)
     t_0
     (if (<= z 2.1e-255) (* x -3.0) (if (<= z 0.52) (* 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 <= -3.6e-14) {
		tmp = t_0;
	} else if (z <= 2.1e-255) {
		tmp = x * -3.0;
	} else if (z <= 0.52) {
		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 <= (-3.6d-14)) then
        tmp = t_0
    else if (z <= 2.1d-255) then
        tmp = x * (-3.0d0)
    else if (z <= 0.52d0) 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 <= -3.6e-14) {
		tmp = t_0;
	} else if (z <= 2.1e-255) {
		tmp = x * -3.0;
	} else if (z <= 0.52) {
		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 <= -3.6e-14:
		tmp = t_0
	elif z <= 2.1e-255:
		tmp = x * -3.0
	elif z <= 0.52:
		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 <= -3.6e-14)
		tmp = t_0;
	elseif (z <= 2.1e-255)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.52)
		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 <= -3.6e-14)
		tmp = t_0;
	elseif (z <= 2.1e-255)
		tmp = x * -3.0;
	elseif (z <= 0.52)
		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, -3.6e-14], t$95$0, If[LessEqual[z, 2.1e-255], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.52], 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 -3.6 \cdot 10^{-14}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.5999999999999998e-14 or 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. 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)} \]
    5. Taylor expanded in z around inf 95.4%

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

    if -3.5999999999999998e-14 < z < 2.1e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.1e-255 < z < 0.52000000000000002

    1. Initial program 99.5%

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

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

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

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in95.2%

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 4 \cdot y \]
      7. distribute-rgt1-in95.5%

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

        \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
      9. *-commutative95.5%

        \[\leadsto \color{blue}{x \cdot -3} + 4 \cdot y \]
      10. *-commutative95.5%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    7. Simplified95.5%

      \[\leadsto \color{blue}{x \cdot -3 + y \cdot 4} \]
    8. Taylor expanded in x around 0 59.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{-14}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.52:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 12: 97.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 96.6%

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-6 \cdot z\right) + x \cdot \left(\color{blue}{\left(--6\right)} \cdot z\right) \]
      8. distribute-lft-neg-in91.8%

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

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

        \[\leadsto y \cdot \left(-6 \cdot z\right) + \color{blue}{\left(-x\right) \cdot \left(-6 \cdot z\right)} \]
      11. distribute-rgt-out96.7%

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(-z\right) \cdot 6\right)} \cdot \left(y + \left(-x\right)\right) \]
      16. sub-neg96.7%

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

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

        \[\leadsto \left(-z\right) \cdot \color{blue}{\left(\left(y - x\right) \cdot 6\right)} \]
      19. distribute-lft-neg-out96.7%

        \[\leadsto \color{blue}{-z \cdot \left(\left(y - x\right) \cdot 6\right)} \]
      20. distribute-rgt-neg-in96.7%

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

        \[\leadsto z \cdot \left(-\color{blue}{6 \cdot \left(y - x\right)}\right) \]
      22. distribute-lft-neg-in96.7%

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

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

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

    if -0.599999999999999978 < z < 0.57999999999999996

    1. Initial program 99.4%

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

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

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

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

    if 0.57999999999999996 < 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. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

        \[\leadsto x + \frac{\left(\color{blue}{0.2962962962962963} - {z}^{3}\right) \cdot \left(\left(y - x\right) \cdot 6\right)}{0.6666666666666666 \cdot 0.6666666666666666 + \left(z \cdot z + 0.6666666666666666 \cdot z\right)} \]
      5. metadata-eval28.9%

        \[\leadsto x + \frac{\left(0.2962962962962963 - {z}^{3}\right) \cdot \left(\left(y - x\right) \cdot 6\right)}{\color{blue}{0.4444444444444444} + \left(z \cdot z + 0.6666666666666666 \cdot z\right)} \]
      6. distribute-rgt-out28.9%

        \[\leadsto x + \frac{\left(0.2962962962962963 - {z}^{3}\right) \cdot \left(\left(y - x\right) \cdot 6\right)}{0.4444444444444444 + \color{blue}{z \cdot \left(z + 0.6666666666666666\right)}} \]
      7. +-commutative28.9%

        \[\leadsto x + \frac{\left(0.2962962962962963 - {z}^{3}\right) \cdot \left(\left(y - x\right) \cdot 6\right)}{0.4444444444444444 + z \cdot \color{blue}{\left(0.6666666666666666 + z\right)}} \]
    5. Applied egg-rr28.9%

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

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

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

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

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

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

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

Alternative 13: 51.2% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{-14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;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 -3.6e-14)
     t_0
     (if (<= z 2e-255) (* x -3.0) (if (<= z 0.68) (* y 4.0) t_0)))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (y * z);
	double tmp;
	if (z <= -3.6e-14) {
		tmp = t_0;
	} else if (z <= 2e-255) {
		tmp = x * -3.0;
	} else if (z <= 0.68) {
		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 <= (-3.6d-14)) then
        tmp = t_0
    else if (z <= 2d-255) then
        tmp = x * (-3.0d0)
    else if (z <= 0.68d0) 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 <= -3.6e-14) {
		tmp = t_0;
	} else if (z <= 2e-255) {
		tmp = x * -3.0;
	} else if (z <= 0.68) {
		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 <= -3.6e-14:
		tmp = t_0
	elif z <= 2e-255:
		tmp = x * -3.0
	elif z <= 0.68:
		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 <= -3.6e-14)
		tmp = t_0;
	elseif (z <= 2e-255)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.68)
		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 <= -3.6e-14)
		tmp = t_0;
	elseif (z <= 2e-255)
		tmp = x * -3.0;
	elseif (z <= 0.68)
		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, -3.6e-14], t$95$0, If[LessEqual[z, 2e-255], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.68], 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 -3.6 \cdot 10^{-14}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.5999999999999998e-14 or 0.680000000000000049 < z

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 95.4%

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

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

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

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

    if -3.5999999999999998e-14 < z < 2e-255

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-255 < z < 0.680000000000000049

    1. Initial program 99.5%

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

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

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

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in95.2%

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 4 \cdot y \]
      7. distribute-rgt1-in95.5%

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

        \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
      9. *-commutative95.5%

        \[\leadsto \color{blue}{x \cdot -3} + 4 \cdot y \]
      10. *-commutative95.5%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    7. Simplified95.5%

      \[\leadsto \color{blue}{x \cdot -3 + y \cdot 4} \]
    8. Taylor expanded in x around 0 59.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{-14}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-255}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \end{array} \]

Alternative 14: 97.8% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Taylor expanded in z around 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)} \]
    5. Taylor expanded in z around inf 98.3%

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-6 \cdot z\right) + x \cdot \left(\color{blue}{\left(--6\right)} \cdot z\right) \]
      8. distribute-lft-neg-in94.8%

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

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

        \[\leadsto y \cdot \left(-6 \cdot z\right) + \color{blue}{\left(-x\right) \cdot \left(-6 \cdot z\right)} \]
      11. distribute-rgt-out98.3%

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

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

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

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

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

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

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

        \[\leadsto \left(-z\right) \cdot \color{blue}{\left(\left(y - x\right) \cdot 6\right)} \]
      19. distribute-lft-neg-out98.3%

        \[\leadsto \color{blue}{-z \cdot \left(\left(y - x\right) \cdot 6\right)} \]
      20. distribute-rgt-neg-in98.3%

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

        \[\leadsto z \cdot \left(-\color{blue}{6 \cdot \left(y - x\right)}\right) \]
      22. distribute-lft-neg-in98.3%

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

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

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

    if -0.599999999999999978 < z < 0.680000000000000049

    1. Initial program 99.4%

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

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

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

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

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

Alternative 15: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 16: 36.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+143} \lor \neg \left(y \leq 1.55 \cdot 10^{-41}\right):\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.20000000000000016e143 or 1.55e-41 < y

    1. Initial program 99.6%

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

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

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

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in47.7%

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

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

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 4 \cdot y \]
      7. distribute-rgt1-in47.9%

        \[\leadsto \color{blue}{\left(-4 + 1\right) \cdot x} + 4 \cdot y \]
      8. metadata-eval47.9%

        \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
      9. *-commutative47.9%

        \[\leadsto \color{blue}{x \cdot -3} + 4 \cdot y \]
      10. *-commutative47.9%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    7. Simplified47.9%

      \[\leadsto \color{blue}{x \cdot -3 + y \cdot 4} \]
    8. Taylor expanded in x around 0 37.0%

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    10. Simplified37.0%

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

    if -3.20000000000000016e143 < y < 1.55e-41

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified36.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+143} \lor \neg \left(y \leq 1.55 \cdot 10^{-41}\right):\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]

Alternative 17: 26.4% 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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto x \cdot -3 \]

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

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

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

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

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

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

    \[\leadsto x \]

Reproduce

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