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

Percentage Accurate: 99.7% → 99.7%
Time: 6.2s
Alternatives: 10
Speedup: 1.0×

Specification

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

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\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 10 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 1.0× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Final simplification99.8%

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

Alternative 2: 59.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(x \cdot z\right)\\ t_1 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -2.2 \cdot 10^{+19}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+64} \lor \neg \left(z \leq 5.2 \cdot 10^{+110}\right) \land z \leq 1.9 \cdot 10^{+216}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
   (if (<= z -2.2e+19)
     t_0
     (if (<= z -1.25e-75)
       t_1
       (if (<= z 2.65e-160)
         x
         (if (<= z 2.4e-116)
           t_1
           (if (<= z 5e-57)
             x
             (if (or (<= z 1.4e+64)
                     (and (not (<= z 5.2e+110)) (<= z 1.9e+216)))
               t_1
               t_0))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (x * z);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -2.2e+19) {
		tmp = t_0;
	} else if (z <= -1.25e-75) {
		tmp = t_1;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.4e-116) {
		tmp = t_1;
	} else if (z <= 5e-57) {
		tmp = x;
	} else if ((z <= 1.4e+64) || (!(z <= 5.2e+110) && (z <= 1.9e+216))) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (x * z)
    t_1 = 6.0d0 * (y * z)
    if (z <= (-2.2d+19)) then
        tmp = t_0
    else if (z <= (-1.25d-75)) then
        tmp = t_1
    else if (z <= 2.65d-160) then
        tmp = x
    else if (z <= 2.4d-116) then
        tmp = t_1
    else if (z <= 5d-57) then
        tmp = x
    else if ((z <= 1.4d+64) .or. (.not. (z <= 5.2d+110)) .and. (z <= 1.9d+216)) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (x * z);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -2.2e+19) {
		tmp = t_0;
	} else if (z <= -1.25e-75) {
		tmp = t_1;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.4e-116) {
		tmp = t_1;
	} else if (z <= 5e-57) {
		tmp = x;
	} else if ((z <= 1.4e+64) || (!(z <= 5.2e+110) && (z <= 1.9e+216))) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (x * z)
	t_1 = 6.0 * (y * z)
	tmp = 0
	if z <= -2.2e+19:
		tmp = t_0
	elif z <= -1.25e-75:
		tmp = t_1
	elif z <= 2.65e-160:
		tmp = x
	elif z <= 2.4e-116:
		tmp = t_1
	elif z <= 5e-57:
		tmp = x
	elif (z <= 1.4e+64) or (not (z <= 5.2e+110) and (z <= 1.9e+216)):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(x * z))
	t_1 = Float64(6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -2.2e+19)
		tmp = t_0;
	elseif (z <= -1.25e-75)
		tmp = t_1;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.4e-116)
		tmp = t_1;
	elseif (z <= 5e-57)
		tmp = x;
	elseif ((z <= 1.4e+64) || (!(z <= 5.2e+110) && (z <= 1.9e+216)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (x * z);
	t_1 = 6.0 * (y * z);
	tmp = 0.0;
	if (z <= -2.2e+19)
		tmp = t_0;
	elseif (z <= -1.25e-75)
		tmp = t_1;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.4e-116)
		tmp = t_1;
	elseif (z <= 5e-57)
		tmp = x;
	elseif ((z <= 1.4e+64) || (~((z <= 5.2e+110)) && (z <= 1.9e+216)))
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+19], t$95$0, If[LessEqual[z, -1.25e-75], t$95$1, If[LessEqual[z, 2.65e-160], x, If[LessEqual[z, 2.4e-116], t$95$1, If[LessEqual[z, 5e-57], x, If[Or[LessEqual[z, 1.4e+64], And[N[Not[LessEqual[z, 5.2e+110]], $MachinePrecision], LessEqual[z, 1.9e+216]]], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.25 \cdot 10^{-75}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.4 \cdot 10^{-116}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-57}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{+64} \lor \neg \left(z \leq 5.2 \cdot 10^{+110}\right) \land z \leq 1.9 \cdot 10^{+216}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.2e19 or 1.40000000000000012e64 < z < 5.2e110 or 1.90000000000000007e216 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in x around inf 71.6%

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

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

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

    if -2.2e19 < z < -1.24999999999999995e-75 or 2.6500000000000001e-160 < z < 2.39999999999999993e-116 or 5.0000000000000002e-57 < z < 1.40000000000000012e64 or 5.2e110 < z < 1.90000000000000007e216

    1. Initial program 99.7%

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

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

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

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

    if -1.24999999999999995e-75 < z < 2.6500000000000001e-160 or 2.39999999999999993e-116 < z < 5.0000000000000002e-57

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 82.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{+19}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-75}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-116}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+64} \lor \neg \left(z \leq 5.2 \cdot 10^{+110}\right) \land z \leq 1.9 \cdot 10^{+216}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 59.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(x \cdot -6\right)\\ t_1 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+64}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{+110}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+216}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* x -6.0))) (t_1 (* 6.0 (* y z))))
   (if (<= z -3.3e+18)
     t_0
     (if (<= z -1.25e-75)
       t_1
       (if (<= z 2.65e-160)
         x
         (if (<= z 2.2e-116)
           t_1
           (if (<= z 3.9e-57)
             x
             (if (<= z 1.5e+64)
               t_1
               (if (<= z 5.3e+110)
                 (* -6.0 (* x z))
                 (if (<= z 1.9e+216) t_1 t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = z * (x * -6.0);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -3.3e+18) {
		tmp = t_0;
	} else if (z <= -1.25e-75) {
		tmp = t_1;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = t_1;
	} else if (z <= 3.9e-57) {
		tmp = x;
	} else if (z <= 1.5e+64) {
		tmp = t_1;
	} else if (z <= 5.3e+110) {
		tmp = -6.0 * (x * z);
	} else if (z <= 1.9e+216) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = z * (x * (-6.0d0))
    t_1 = 6.0d0 * (y * z)
    if (z <= (-3.3d+18)) then
        tmp = t_0
    else if (z <= (-1.25d-75)) then
        tmp = t_1
    else if (z <= 2.65d-160) then
        tmp = x
    else if (z <= 2.2d-116) then
        tmp = t_1
    else if (z <= 3.9d-57) then
        tmp = x
    else if (z <= 1.5d+64) then
        tmp = t_1
    else if (z <= 5.3d+110) then
        tmp = (-6.0d0) * (x * z)
    else if (z <= 1.9d+216) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (x * -6.0);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -3.3e+18) {
		tmp = t_0;
	} else if (z <= -1.25e-75) {
		tmp = t_1;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = t_1;
	} else if (z <= 3.9e-57) {
		tmp = x;
	} else if (z <= 1.5e+64) {
		tmp = t_1;
	} else if (z <= 5.3e+110) {
		tmp = -6.0 * (x * z);
	} else if (z <= 1.9e+216) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (x * -6.0)
	t_1 = 6.0 * (y * z)
	tmp = 0
	if z <= -3.3e+18:
		tmp = t_0
	elif z <= -1.25e-75:
		tmp = t_1
	elif z <= 2.65e-160:
		tmp = x
	elif z <= 2.2e-116:
		tmp = t_1
	elif z <= 3.9e-57:
		tmp = x
	elif z <= 1.5e+64:
		tmp = t_1
	elif z <= 5.3e+110:
		tmp = -6.0 * (x * z)
	elif z <= 1.9e+216:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(x * -6.0))
	t_1 = Float64(6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -3.3e+18)
		tmp = t_0;
	elseif (z <= -1.25e-75)
		tmp = t_1;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = t_1;
	elseif (z <= 3.9e-57)
		tmp = x;
	elseif (z <= 1.5e+64)
		tmp = t_1;
	elseif (z <= 5.3e+110)
		tmp = Float64(-6.0 * Float64(x * z));
	elseif (z <= 1.9e+216)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (x * -6.0);
	t_1 = 6.0 * (y * z);
	tmp = 0.0;
	if (z <= -3.3e+18)
		tmp = t_0;
	elseif (z <= -1.25e-75)
		tmp = t_1;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = t_1;
	elseif (z <= 3.9e-57)
		tmp = x;
	elseif (z <= 1.5e+64)
		tmp = t_1;
	elseif (z <= 5.3e+110)
		tmp = -6.0 * (x * z);
	elseif (z <= 1.9e+216)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+18], t$95$0, If[LessEqual[z, -1.25e-75], t$95$1, If[LessEqual[z, 2.65e-160], x, If[LessEqual[z, 2.2e-116], t$95$1, If[LessEqual[z, 3.9e-57], x, If[LessEqual[z, 1.5e+64], t$95$1, If[LessEqual[z, 5.3e+110], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+216], t$95$1, t$95$0]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.25 \cdot 10^{-75}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{-57}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.5 \cdot 10^{+64}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+216}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.3e18 or 1.90000000000000007e216 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.7%

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

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

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

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

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

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

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

    if -3.3e18 < z < -1.24999999999999995e-75 or 2.6500000000000001e-160 < z < 2.2000000000000001e-116 or 3.90000000000000006e-57 < z < 1.5000000000000001e64 or 5.2999999999999998e110 < z < 1.90000000000000007e216

    1. Initial program 99.7%

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

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

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

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

    if -1.24999999999999995e-75 < z < 2.6500000000000001e-160 or 2.2000000000000001e-116 < z < 3.90000000000000006e-57

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 82.2%

      \[\leadsto \color{blue}{x} \]

    if 1.5000000000000001e64 < z < 5.2999999999999998e110

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in x around inf 90.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.3 \cdot 10^{+18}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{-75}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+64}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{+110}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+216}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \end{array} \]

Alternative 4: 59.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(x \cdot -6\right)\\ t_1 := z \cdot \left(y \cdot 6\right)\\ t_2 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -4.3 \cdot 10^{+18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8.4 \cdot 10^{-60}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+64}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+110}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+216}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* x -6.0))) (t_1 (* z (* y 6.0))) (t_2 (* 6.0 (* y z))))
   (if (<= z -4.3e+18)
     t_0
     (if (<= z -8e-76)
       t_2
       (if (<= z 2.65e-160)
         x
         (if (<= z 2.2e-116)
           t_1
           (if (<= z 8.4e-60)
             x
             (if (<= z 1.5e+64)
               t_2
               (if (<= z 5.2e+110)
                 (* -6.0 (* x z))
                 (if (<= z 3.2e+216) t_1 t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = z * (x * -6.0);
	double t_1 = z * (y * 6.0);
	double t_2 = 6.0 * (y * z);
	double tmp;
	if (z <= -4.3e+18) {
		tmp = t_0;
	} else if (z <= -8e-76) {
		tmp = t_2;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = t_1;
	} else if (z <= 8.4e-60) {
		tmp = x;
	} else if (z <= 1.5e+64) {
		tmp = t_2;
	} else if (z <= 5.2e+110) {
		tmp = -6.0 * (x * z);
	} else if (z <= 3.2e+216) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = z * (x * (-6.0d0))
    t_1 = z * (y * 6.0d0)
    t_2 = 6.0d0 * (y * z)
    if (z <= (-4.3d+18)) then
        tmp = t_0
    else if (z <= (-8d-76)) then
        tmp = t_2
    else if (z <= 2.65d-160) then
        tmp = x
    else if (z <= 2.2d-116) then
        tmp = t_1
    else if (z <= 8.4d-60) then
        tmp = x
    else if (z <= 1.5d+64) then
        tmp = t_2
    else if (z <= 5.2d+110) then
        tmp = (-6.0d0) * (x * z)
    else if (z <= 3.2d+216) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (x * -6.0);
	double t_1 = z * (y * 6.0);
	double t_2 = 6.0 * (y * z);
	double tmp;
	if (z <= -4.3e+18) {
		tmp = t_0;
	} else if (z <= -8e-76) {
		tmp = t_2;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = t_1;
	} else if (z <= 8.4e-60) {
		tmp = x;
	} else if (z <= 1.5e+64) {
		tmp = t_2;
	} else if (z <= 5.2e+110) {
		tmp = -6.0 * (x * z);
	} else if (z <= 3.2e+216) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (x * -6.0)
	t_1 = z * (y * 6.0)
	t_2 = 6.0 * (y * z)
	tmp = 0
	if z <= -4.3e+18:
		tmp = t_0
	elif z <= -8e-76:
		tmp = t_2
	elif z <= 2.65e-160:
		tmp = x
	elif z <= 2.2e-116:
		tmp = t_1
	elif z <= 8.4e-60:
		tmp = x
	elif z <= 1.5e+64:
		tmp = t_2
	elif z <= 5.2e+110:
		tmp = -6.0 * (x * z)
	elif z <= 3.2e+216:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(x * -6.0))
	t_1 = Float64(z * Float64(y * 6.0))
	t_2 = Float64(6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -4.3e+18)
		tmp = t_0;
	elseif (z <= -8e-76)
		tmp = t_2;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = t_1;
	elseif (z <= 8.4e-60)
		tmp = x;
	elseif (z <= 1.5e+64)
		tmp = t_2;
	elseif (z <= 5.2e+110)
		tmp = Float64(-6.0 * Float64(x * z));
	elseif (z <= 3.2e+216)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (x * -6.0);
	t_1 = z * (y * 6.0);
	t_2 = 6.0 * (y * z);
	tmp = 0.0;
	if (z <= -4.3e+18)
		tmp = t_0;
	elseif (z <= -8e-76)
		tmp = t_2;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = t_1;
	elseif (z <= 8.4e-60)
		tmp = x;
	elseif (z <= 1.5e+64)
		tmp = t_2;
	elseif (z <= 5.2e+110)
		tmp = -6.0 * (x * z);
	elseif (z <= 3.2e+216)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.3e+18], t$95$0, If[LessEqual[z, -8e-76], t$95$2, If[LessEqual[z, 2.65e-160], x, If[LessEqual[z, 2.2e-116], t$95$1, If[LessEqual[z, 8.4e-60], x, If[LessEqual[z, 1.5e+64], t$95$2, If[LessEqual[z, 5.2e+110], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+216], t$95$1, t$95$0]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -8 \cdot 10^{-76}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 1.5 \cdot 10^{+64}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;z \leq 3.2 \cdot 10^{+216}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -4.3e18 or 3.1999999999999997e216 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.7%

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

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

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

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

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

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

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

    if -4.3e18 < z < -7.99999999999999942e-76 or 8.39999999999999964e-60 < z < 1.5000000000000001e64

    1. Initial program 99.6%

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

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

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

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

    if -7.99999999999999942e-76 < z < 2.6500000000000001e-160 or 2.2000000000000001e-116 < z < 8.39999999999999964e-60

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 82.2%

      \[\leadsto \color{blue}{x} \]

    if 2.6500000000000001e-160 < z < 2.2000000000000001e-116 or 5.2e110 < z < 3.1999999999999997e216

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if 1.5000000000000001e64 < z < 5.2e110

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in x around inf 90.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+18}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-76}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 8.4 \cdot 10^{-60}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+64}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+110}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+216}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \end{array} \]

Alternative 5: 59.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(x \cdot -6\right)\\ t_1 := z \cdot \left(y \cdot 6\right)\\ \mathbf{if}\;z \leq -1.15 \cdot 10^{+19}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.08 \cdot 10^{-75}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+64}:\\ \;\;\;\;\frac{y \cdot z}{0.16666666666666666}\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{+110}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.22 \cdot 10^{+215}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* x -6.0))) (t_1 (* z (* y 6.0))))
   (if (<= z -1.15e+19)
     t_0
     (if (<= z -1.08e-75)
       (* 6.0 (* y z))
       (if (<= z 2.65e-160)
         x
         (if (<= z 2.2e-116)
           t_1
           (if (<= z 5e-57)
             x
             (if (<= z 1.35e+64)
               (/ (* y z) 0.16666666666666666)
               (if (<= z 5.3e+110)
                 (* -6.0 (* x z))
                 (if (<= z 1.22e+215) t_1 t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = z * (x * -6.0);
	double t_1 = z * (y * 6.0);
	double tmp;
	if (z <= -1.15e+19) {
		tmp = t_0;
	} else if (z <= -1.08e-75) {
		tmp = 6.0 * (y * z);
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = t_1;
	} else if (z <= 5e-57) {
		tmp = x;
	} else if (z <= 1.35e+64) {
		tmp = (y * z) / 0.16666666666666666;
	} else if (z <= 5.3e+110) {
		tmp = -6.0 * (x * z);
	} else if (z <= 1.22e+215) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = z * (x * (-6.0d0))
    t_1 = z * (y * 6.0d0)
    if (z <= (-1.15d+19)) then
        tmp = t_0
    else if (z <= (-1.08d-75)) then
        tmp = 6.0d0 * (y * z)
    else if (z <= 2.65d-160) then
        tmp = x
    else if (z <= 2.2d-116) then
        tmp = t_1
    else if (z <= 5d-57) then
        tmp = x
    else if (z <= 1.35d+64) then
        tmp = (y * z) / 0.16666666666666666d0
    else if (z <= 5.3d+110) then
        tmp = (-6.0d0) * (x * z)
    else if (z <= 1.22d+215) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (x * -6.0);
	double t_1 = z * (y * 6.0);
	double tmp;
	if (z <= -1.15e+19) {
		tmp = t_0;
	} else if (z <= -1.08e-75) {
		tmp = 6.0 * (y * z);
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = t_1;
	} else if (z <= 5e-57) {
		tmp = x;
	} else if (z <= 1.35e+64) {
		tmp = (y * z) / 0.16666666666666666;
	} else if (z <= 5.3e+110) {
		tmp = -6.0 * (x * z);
	} else if (z <= 1.22e+215) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (x * -6.0)
	t_1 = z * (y * 6.0)
	tmp = 0
	if z <= -1.15e+19:
		tmp = t_0
	elif z <= -1.08e-75:
		tmp = 6.0 * (y * z)
	elif z <= 2.65e-160:
		tmp = x
	elif z <= 2.2e-116:
		tmp = t_1
	elif z <= 5e-57:
		tmp = x
	elif z <= 1.35e+64:
		tmp = (y * z) / 0.16666666666666666
	elif z <= 5.3e+110:
		tmp = -6.0 * (x * z)
	elif z <= 1.22e+215:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(x * -6.0))
	t_1 = Float64(z * Float64(y * 6.0))
	tmp = 0.0
	if (z <= -1.15e+19)
		tmp = t_0;
	elseif (z <= -1.08e-75)
		tmp = Float64(6.0 * Float64(y * z));
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = t_1;
	elseif (z <= 5e-57)
		tmp = x;
	elseif (z <= 1.35e+64)
		tmp = Float64(Float64(y * z) / 0.16666666666666666);
	elseif (z <= 5.3e+110)
		tmp = Float64(-6.0 * Float64(x * z));
	elseif (z <= 1.22e+215)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (x * -6.0);
	t_1 = z * (y * 6.0);
	tmp = 0.0;
	if (z <= -1.15e+19)
		tmp = t_0;
	elseif (z <= -1.08e-75)
		tmp = 6.0 * (y * z);
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = t_1;
	elseif (z <= 5e-57)
		tmp = x;
	elseif (z <= 1.35e+64)
		tmp = (y * z) / 0.16666666666666666;
	elseif (z <= 5.3e+110)
		tmp = -6.0 * (x * z);
	elseif (z <= 1.22e+215)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.15e+19], t$95$0, If[LessEqual[z, -1.08e-75], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.65e-160], x, If[LessEqual[z, 2.2e-116], t$95$1, If[LessEqual[z, 5e-57], x, If[LessEqual[z, 1.35e+64], N[(N[(y * z), $MachinePrecision] / 0.16666666666666666), $MachinePrecision], If[LessEqual[z, 5.3e+110], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.22e+215], t$95$1, t$95$0]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5 \cdot 10^{-57}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+64}:\\
\;\;\;\;\frac{y \cdot z}{0.16666666666666666}\\

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

\mathbf{elif}\;z \leq 1.22 \cdot 10^{+215}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -1.15e19 or 1.22000000000000007e215 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.7%

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

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

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

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

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

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

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

    if -1.15e19 < z < -1.08e-75

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.9%

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

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

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

    if -1.08e-75 < z < 2.6500000000000001e-160 or 2.2000000000000001e-116 < z < 5.0000000000000002e-57

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 82.2%

      \[\leadsto \color{blue}{x} \]

    if 2.6500000000000001e-160 < z < 2.2000000000000001e-116 or 5.2999999999999998e110 < z < 1.22000000000000007e215

    1. Initial program 99.9%

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

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

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

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

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

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

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

    if 5.0000000000000002e-57 < z < 1.35e64

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

        \[\leadsto \left(z \cdot \color{blue}{\frac{1}{0.16666666666666666}}\right) \cdot y \]
      3. div-inv65.7%

        \[\leadsto \color{blue}{\frac{z}{0.16666666666666666}} \cdot y \]
      4. associate-*l/65.9%

        \[\leadsto \color{blue}{\frac{z \cdot y}{0.16666666666666666}} \]
    8. Applied egg-rr65.9%

      \[\leadsto \color{blue}{\frac{z \cdot y}{0.16666666666666666}} \]

    if 1.35e64 < z < 5.2999999999999998e110

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in x around inf 90.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.08 \cdot 10^{-75}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+64}:\\ \;\;\;\;\frac{y \cdot z}{0.16666666666666666}\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{+110}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.22 \cdot 10^{+215}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \end{array} \]

Alternative 6: 82.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{if}\;z \leq -5.6 \cdot 10^{-86}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-60}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* (- y x) z))))
   (if (<= z -5.6e-86)
     t_0
     (if (<= z 2.65e-160)
       x
       (if (<= z 2.2e-116) (* z (* y 6.0)) (if (<= z 1.15e-60) x t_0))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * ((y - x) * z);
	double tmp;
	if (z <= -5.6e-86) {
		tmp = t_0;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = z * (y * 6.0);
	} else if (z <= 1.15e-60) {
		tmp = x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * ((y - x) * z)
    if (z <= (-5.6d-86)) then
        tmp = t_0
    else if (z <= 2.65d-160) then
        tmp = x
    else if (z <= 2.2d-116) then
        tmp = z * (y * 6.0d0)
    else if (z <= 1.15d-60) then
        tmp = x
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * ((y - x) * z);
	double tmp;
	if (z <= -5.6e-86) {
		tmp = t_0;
	} else if (z <= 2.65e-160) {
		tmp = x;
	} else if (z <= 2.2e-116) {
		tmp = z * (y * 6.0);
	} else if (z <= 1.15e-60) {
		tmp = x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * ((y - x) * z)
	tmp = 0
	if z <= -5.6e-86:
		tmp = t_0
	elif z <= 2.65e-160:
		tmp = x
	elif z <= 2.2e-116:
		tmp = z * (y * 6.0)
	elif z <= 1.15e-60:
		tmp = x
	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 <= -5.6e-86)
		tmp = t_0;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = Float64(z * Float64(y * 6.0));
	elseif (z <= 1.15e-60)
		tmp = x;
	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 <= -5.6e-86)
		tmp = t_0;
	elseif (z <= 2.65e-160)
		tmp = x;
	elseif (z <= 2.2e-116)
		tmp = z * (y * 6.0);
	elseif (z <= 1.15e-60)
		tmp = x;
	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, -5.6e-86], t$95$0, If[LessEqual[z, 2.65e-160], x, If[LessEqual[z, 2.2e-116], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e-60], x, 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 -5.6 \cdot 10^{-86}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\
\;\;\;\;x\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.60000000000000019e-86 or 1.1500000000000001e-60 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.7%

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

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

    if -5.60000000000000019e-86 < z < 2.6500000000000001e-160 or 2.2000000000000001e-116 < z < 1.1500000000000001e-60

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 82.8%

      \[\leadsto \color{blue}{x} \]

    if 2.6500000000000001e-160 < z < 2.2000000000000001e-116

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.6 \cdot 10^{-86}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-160}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-116}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-60}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 7: 98.4% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.8e13 or 0.170000000000000012 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.7%

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

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

    if -4.8e13 < z < 0.170000000000000012

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in y around inf 98.7%

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

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

Alternative 8: 98.3% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.8e13 or 0.170000000000000012 < z

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 99.7%

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

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

    if -4.8e13 < z < 0.170000000000000012

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in y around inf 98.7%

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

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

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

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

Alternative 9: 60.9% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x\\


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

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in x around inf 62.4%

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

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

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

    if -0.165000000000000008 < z < 0.170000000000000012

    1. Initial program 99.9%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Taylor expanded in z around 0 68.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.17\right):\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 10: 36.9% accurate, 9.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.8%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Taylor expanded in z around 0 35.3%

    \[\leadsto \color{blue}{x} \]
  3. Final simplification35.3%

    \[\leadsto x \]

Developer target: 99.8% accurate, 1.0× speedup?

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

\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}

Reproduce

?
herbie shell --seed 2023178 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
  :precision binary64

  :herbie-target
  (- x (* (* 6.0 z) (- x y)))

  (+ x (* (* (- y x) 6.0) z)))