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

Percentage Accurate: 99.6% → 99.6%
Time: 6.7s
Alternatives: 12
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 12 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.6% 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.6% accurate, 0.8× speedup?

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

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

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

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

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

Alternative 2: 60.5% 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 -7.5 \cdot 10^{+241}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+199}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{+79}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{+45}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3300000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-90}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+14} \lor \neg \left(z \leq 1.06 \cdot 10^{+27}\right) \land z \leq 5.5 \cdot 10^{+140}:\\ \;\;\;\;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 -7.5e+241)
     t_0
     (if (<= z -5.2e+199)
       t_1
       (if (<= z -2.45e+79)
         t_0
         (if (<= z -6.2e+45)
           t_1
           (if (<= z -3300000000000.0)
             t_0
             (if (<= z -1.15e-39)
               t_1
               (if (<= z 7.6e-90)
                 x
                 (if (or (<= z 2.15e+14)
                         (and (not (<= z 1.06e+27)) (<= z 5.5e+140)))
                   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 <= -7.5e+241) {
		tmp = t_0;
	} else if (z <= -5.2e+199) {
		tmp = t_1;
	} else if (z <= -2.45e+79) {
		tmp = t_0;
	} else if (z <= -6.2e+45) {
		tmp = t_1;
	} else if (z <= -3300000000000.0) {
		tmp = t_0;
	} else if (z <= -1.15e-39) {
		tmp = t_1;
	} else if (z <= 7.6e-90) {
		tmp = x;
	} else if ((z <= 2.15e+14) || (!(z <= 1.06e+27) && (z <= 5.5e+140))) {
		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 <= (-7.5d+241)) then
        tmp = t_0
    else if (z <= (-5.2d+199)) then
        tmp = t_1
    else if (z <= (-2.45d+79)) then
        tmp = t_0
    else if (z <= (-6.2d+45)) then
        tmp = t_1
    else if (z <= (-3300000000000.0d0)) then
        tmp = t_0
    else if (z <= (-1.15d-39)) then
        tmp = t_1
    else if (z <= 7.6d-90) then
        tmp = x
    else if ((z <= 2.15d+14) .or. (.not. (z <= 1.06d+27)) .and. (z <= 5.5d+140)) 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 <= -7.5e+241) {
		tmp = t_0;
	} else if (z <= -5.2e+199) {
		tmp = t_1;
	} else if (z <= -2.45e+79) {
		tmp = t_0;
	} else if (z <= -6.2e+45) {
		tmp = t_1;
	} else if (z <= -3300000000000.0) {
		tmp = t_0;
	} else if (z <= -1.15e-39) {
		tmp = t_1;
	} else if (z <= 7.6e-90) {
		tmp = x;
	} else if ((z <= 2.15e+14) || (!(z <= 1.06e+27) && (z <= 5.5e+140))) {
		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 <= -7.5e+241:
		tmp = t_0
	elif z <= -5.2e+199:
		tmp = t_1
	elif z <= -2.45e+79:
		tmp = t_0
	elif z <= -6.2e+45:
		tmp = t_1
	elif z <= -3300000000000.0:
		tmp = t_0
	elif z <= -1.15e-39:
		tmp = t_1
	elif z <= 7.6e-90:
		tmp = x
	elif (z <= 2.15e+14) or (not (z <= 1.06e+27) and (z <= 5.5e+140)):
		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 <= -7.5e+241)
		tmp = t_0;
	elseif (z <= -5.2e+199)
		tmp = t_1;
	elseif (z <= -2.45e+79)
		tmp = t_0;
	elseif (z <= -6.2e+45)
		tmp = t_1;
	elseif (z <= -3300000000000.0)
		tmp = t_0;
	elseif (z <= -1.15e-39)
		tmp = t_1;
	elseif (z <= 7.6e-90)
		tmp = x;
	elseif ((z <= 2.15e+14) || (!(z <= 1.06e+27) && (z <= 5.5e+140)))
		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 <= -7.5e+241)
		tmp = t_0;
	elseif (z <= -5.2e+199)
		tmp = t_1;
	elseif (z <= -2.45e+79)
		tmp = t_0;
	elseif (z <= -6.2e+45)
		tmp = t_1;
	elseif (z <= -3300000000000.0)
		tmp = t_0;
	elseif (z <= -1.15e-39)
		tmp = t_1;
	elseif (z <= 7.6e-90)
		tmp = x;
	elseif ((z <= 2.15e+14) || (~((z <= 1.06e+27)) && (z <= 5.5e+140)))
		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, -7.5e+241], t$95$0, If[LessEqual[z, -5.2e+199], t$95$1, If[LessEqual[z, -2.45e+79], t$95$0, If[LessEqual[z, -6.2e+45], t$95$1, If[LessEqual[z, -3300000000000.0], t$95$0, If[LessEqual[z, -1.15e-39], t$95$1, If[LessEqual[z, 7.6e-90], x, If[Or[LessEqual[z, 2.15e+14], And[N[Not[LessEqual[z, 1.06e+27]], $MachinePrecision], LessEqual[z, 5.5e+140]]], 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 -7.5 \cdot 10^{+241}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -5.2 \cdot 10^{+199}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.45 \cdot 10^{+79}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -6.2 \cdot 10^{+45}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq -1.15 \cdot 10^{-39}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 2.15 \cdot 10^{+14} \lor \neg \left(z \leq 1.06 \cdot 10^{+27}\right) \land z \leq 5.5 \cdot 10^{+140}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -7.5000000000000001e241 or -5.2000000000000003e199 < z < -2.4499999999999999e79 or -6.19999999999999975e45 < z < -3.3e12 or 2.15e14 < z < 1.05999999999999994e27 or 5.5e140 < z

    1. Initial program 99.8%

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

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

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

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

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

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

    if -7.5000000000000001e241 < z < -5.2000000000000003e199 or -2.4499999999999999e79 < z < -6.19999999999999975e45 or -3.3e12 < z < -1.15000000000000004e-39 or 7.6e-90 < z < 2.15e14 or 1.05999999999999994e27 < z < 5.5e140

    1. Initial program 99.7%

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

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

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

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

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

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

    if -1.15000000000000004e-39 < z < 7.6e-90

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{+241}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+199}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{+79}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{+45}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -3300000000000:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-39}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-90}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+14} \lor \neg \left(z \leq 1.06 \cdot 10^{+27}\right) \land z \leq 5.5 \cdot 10^{+140}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 60.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-6 \cdot z\right)\\ t_1 := -6 \cdot \left(x \cdot z\right)\\ t_2 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -6 \cdot 10^{+241}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+200}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{+80}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{+47}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1350000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{-40}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{+14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.18 \cdot 10^{+27}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{+195}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* -6.0 z))) (t_1 (* -6.0 (* x z))) (t_2 (* 6.0 (* y z))))
   (if (<= z -6e+241)
     t_0
     (if (<= z -1.15e+200)
       t_2
       (if (<= z -2.4e+80)
         t_0
         (if (<= z -1.45e+47)
           t_2
           (if (<= z -1350000000000.0)
             t_1
             (if (<= z -5.4e-40)
               t_2
               (if (<= z 3.9e-89)
                 x
                 (if (<= z 2.7e+14)
                   t_2
                   (if (<= z 1.18e+27)
                     t_1
                     (if (<= z 3.6e+195) t_2 t_0))))))))))))
double code(double x, double y, double z) {
	double t_0 = x * (-6.0 * z);
	double t_1 = -6.0 * (x * z);
	double t_2 = 6.0 * (y * z);
	double tmp;
	if (z <= -6e+241) {
		tmp = t_0;
	} else if (z <= -1.15e+200) {
		tmp = t_2;
	} else if (z <= -2.4e+80) {
		tmp = t_0;
	} else if (z <= -1.45e+47) {
		tmp = t_2;
	} else if (z <= -1350000000000.0) {
		tmp = t_1;
	} else if (z <= -5.4e-40) {
		tmp = t_2;
	} else if (z <= 3.9e-89) {
		tmp = x;
	} else if (z <= 2.7e+14) {
		tmp = t_2;
	} else if (z <= 1.18e+27) {
		tmp = t_1;
	} else if (z <= 3.6e+195) {
		tmp = t_2;
	} 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 = x * ((-6.0d0) * z)
    t_1 = (-6.0d0) * (x * z)
    t_2 = 6.0d0 * (y * z)
    if (z <= (-6d+241)) then
        tmp = t_0
    else if (z <= (-1.15d+200)) then
        tmp = t_2
    else if (z <= (-2.4d+80)) then
        tmp = t_0
    else if (z <= (-1.45d+47)) then
        tmp = t_2
    else if (z <= (-1350000000000.0d0)) then
        tmp = t_1
    else if (z <= (-5.4d-40)) then
        tmp = t_2
    else if (z <= 3.9d-89) then
        tmp = x
    else if (z <= 2.7d+14) then
        tmp = t_2
    else if (z <= 1.18d+27) then
        tmp = t_1
    else if (z <= 3.6d+195) then
        tmp = t_2
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-6.0 * z);
	double t_1 = -6.0 * (x * z);
	double t_2 = 6.0 * (y * z);
	double tmp;
	if (z <= -6e+241) {
		tmp = t_0;
	} else if (z <= -1.15e+200) {
		tmp = t_2;
	} else if (z <= -2.4e+80) {
		tmp = t_0;
	} else if (z <= -1.45e+47) {
		tmp = t_2;
	} else if (z <= -1350000000000.0) {
		tmp = t_1;
	} else if (z <= -5.4e-40) {
		tmp = t_2;
	} else if (z <= 3.9e-89) {
		tmp = x;
	} else if (z <= 2.7e+14) {
		tmp = t_2;
	} else if (z <= 1.18e+27) {
		tmp = t_1;
	} else if (z <= 3.6e+195) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-6.0 * z)
	t_1 = -6.0 * (x * z)
	t_2 = 6.0 * (y * z)
	tmp = 0
	if z <= -6e+241:
		tmp = t_0
	elif z <= -1.15e+200:
		tmp = t_2
	elif z <= -2.4e+80:
		tmp = t_0
	elif z <= -1.45e+47:
		tmp = t_2
	elif z <= -1350000000000.0:
		tmp = t_1
	elif z <= -5.4e-40:
		tmp = t_2
	elif z <= 3.9e-89:
		tmp = x
	elif z <= 2.7e+14:
		tmp = t_2
	elif z <= 1.18e+27:
		tmp = t_1
	elif z <= 3.6e+195:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-6.0 * z))
	t_1 = Float64(-6.0 * Float64(x * z))
	t_2 = Float64(6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -6e+241)
		tmp = t_0;
	elseif (z <= -1.15e+200)
		tmp = t_2;
	elseif (z <= -2.4e+80)
		tmp = t_0;
	elseif (z <= -1.45e+47)
		tmp = t_2;
	elseif (z <= -1350000000000.0)
		tmp = t_1;
	elseif (z <= -5.4e-40)
		tmp = t_2;
	elseif (z <= 3.9e-89)
		tmp = x;
	elseif (z <= 2.7e+14)
		tmp = t_2;
	elseif (z <= 1.18e+27)
		tmp = t_1;
	elseif (z <= 3.6e+195)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-6.0 * z);
	t_1 = -6.0 * (x * z);
	t_2 = 6.0 * (y * z);
	tmp = 0.0;
	if (z <= -6e+241)
		tmp = t_0;
	elseif (z <= -1.15e+200)
		tmp = t_2;
	elseif (z <= -2.4e+80)
		tmp = t_0;
	elseif (z <= -1.45e+47)
		tmp = t_2;
	elseif (z <= -1350000000000.0)
		tmp = t_1;
	elseif (z <= -5.4e-40)
		tmp = t_2;
	elseif (z <= 3.9e-89)
		tmp = x;
	elseif (z <= 2.7e+14)
		tmp = t_2;
	elseif (z <= 1.18e+27)
		tmp = t_1;
	elseif (z <= 3.6e+195)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e+241], t$95$0, If[LessEqual[z, -1.15e+200], t$95$2, If[LessEqual[z, -2.4e+80], t$95$0, If[LessEqual[z, -1.45e+47], t$95$2, If[LessEqual[z, -1350000000000.0], t$95$1, If[LessEqual[z, -5.4e-40], t$95$2, If[LessEqual[z, 3.9e-89], x, If[LessEqual[z, 2.7e+14], t$95$2, If[LessEqual[z, 1.18e+27], t$95$1, If[LessEqual[z, 3.6e+195], t$95$2, t$95$0]]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.15 \cdot 10^{+200}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -2.4 \cdot 10^{+80}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -1.45 \cdot 10^{+47}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -1350000000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -5.4 \cdot 10^{-40}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;z \leq 2.7 \cdot 10^{+14}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.18 \cdot 10^{+27}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 3.6 \cdot 10^{+195}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -6.00000000000000031e241 or -1.15000000000000002e200 < z < -2.39999999999999979e80 or 3.5999999999999999e195 < z

    1. Initial program 99.9%

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

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

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

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

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

    if -6.00000000000000031e241 < z < -1.15000000000000002e200 or -2.39999999999999979e80 < z < -1.4499999999999999e47 or -1.35e12 < z < -5.4e-40 or 3.89999999999999978e-89 < z < 2.7e14 or 1.18000000000000006e27 < z < 3.5999999999999999e195

    1. Initial program 99.7%

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

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

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

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

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

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

    if -1.4499999999999999e47 < z < -1.35e12 or 2.7e14 < z < 1.18000000000000006e27

    1. Initial program 99.5%

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

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

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

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

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

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

    if -5.4e-40 < z < 3.89999999999999978e-89

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+241}:\\ \;\;\;\;x \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+200}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{+80}:\\ \;\;\;\;x \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{+47}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1350000000000:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -5.4 \cdot 10^{-40}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{+14}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1.18 \cdot 10^{+27}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{+195}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-6 \cdot z\right)\\ \end{array} \]

Alternative 4: 60.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(6 \cdot y\right) \cdot z\\ t_1 := x \cdot \left(-6 \cdot z\right)\\ t_2 := -6 \cdot \left(x \cdot z\right)\\ t_3 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -7.5 \cdot 10^{+241}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{+200}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{+47}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -1050000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{-39}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{-98}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+26}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.18 \cdot 10^{+201}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (* 6.0 y) z))
        (t_1 (* x (* -6.0 z)))
        (t_2 (* -6.0 (* x z)))
        (t_3 (* 6.0 (* y z))))
   (if (<= z -7.5e+241)
     t_1
     (if (<= z -1.25e+200)
       t_3
       (if (<= z -1.05e+81)
         t_1
         (if (<= z -1.45e+47)
           t_3
           (if (<= z -1050000000000.0)
             t_2
             (if (<= z -1.26e-39)
               t_0
               (if (<= z 2.35e-98)
                 x
                 (if (<= z 4e+14)
                   t_0
                   (if (<= z 3.2e+26)
                     t_2
                     (if (<= z 1.18e+201) t_0 t_1))))))))))))
double code(double x, double y, double z) {
	double t_0 = (6.0 * y) * z;
	double t_1 = x * (-6.0 * z);
	double t_2 = -6.0 * (x * z);
	double t_3 = 6.0 * (y * z);
	double tmp;
	if (z <= -7.5e+241) {
		tmp = t_1;
	} else if (z <= -1.25e+200) {
		tmp = t_3;
	} else if (z <= -1.05e+81) {
		tmp = t_1;
	} else if (z <= -1.45e+47) {
		tmp = t_3;
	} else if (z <= -1050000000000.0) {
		tmp = t_2;
	} else if (z <= -1.26e-39) {
		tmp = t_0;
	} else if (z <= 2.35e-98) {
		tmp = x;
	} else if (z <= 4e+14) {
		tmp = t_0;
	} else if (z <= 3.2e+26) {
		tmp = t_2;
	} else if (z <= 1.18e+201) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = (6.0d0 * y) * z
    t_1 = x * ((-6.0d0) * z)
    t_2 = (-6.0d0) * (x * z)
    t_3 = 6.0d0 * (y * z)
    if (z <= (-7.5d+241)) then
        tmp = t_1
    else if (z <= (-1.25d+200)) then
        tmp = t_3
    else if (z <= (-1.05d+81)) then
        tmp = t_1
    else if (z <= (-1.45d+47)) then
        tmp = t_3
    else if (z <= (-1050000000000.0d0)) then
        tmp = t_2
    else if (z <= (-1.26d-39)) then
        tmp = t_0
    else if (z <= 2.35d-98) then
        tmp = x
    else if (z <= 4d+14) then
        tmp = t_0
    else if (z <= 3.2d+26) then
        tmp = t_2
    else if (z <= 1.18d+201) 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) * z;
	double t_1 = x * (-6.0 * z);
	double t_2 = -6.0 * (x * z);
	double t_3 = 6.0 * (y * z);
	double tmp;
	if (z <= -7.5e+241) {
		tmp = t_1;
	} else if (z <= -1.25e+200) {
		tmp = t_3;
	} else if (z <= -1.05e+81) {
		tmp = t_1;
	} else if (z <= -1.45e+47) {
		tmp = t_3;
	} else if (z <= -1050000000000.0) {
		tmp = t_2;
	} else if (z <= -1.26e-39) {
		tmp = t_0;
	} else if (z <= 2.35e-98) {
		tmp = x;
	} else if (z <= 4e+14) {
		tmp = t_0;
	} else if (z <= 3.2e+26) {
		tmp = t_2;
	} else if (z <= 1.18e+201) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (6.0 * y) * z
	t_1 = x * (-6.0 * z)
	t_2 = -6.0 * (x * z)
	t_3 = 6.0 * (y * z)
	tmp = 0
	if z <= -7.5e+241:
		tmp = t_1
	elif z <= -1.25e+200:
		tmp = t_3
	elif z <= -1.05e+81:
		tmp = t_1
	elif z <= -1.45e+47:
		tmp = t_3
	elif z <= -1050000000000.0:
		tmp = t_2
	elif z <= -1.26e-39:
		tmp = t_0
	elif z <= 2.35e-98:
		tmp = x
	elif z <= 4e+14:
		tmp = t_0
	elif z <= 3.2e+26:
		tmp = t_2
	elif z <= 1.18e+201:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(6.0 * y) * z)
	t_1 = Float64(x * Float64(-6.0 * z))
	t_2 = Float64(-6.0 * Float64(x * z))
	t_3 = Float64(6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -7.5e+241)
		tmp = t_1;
	elseif (z <= -1.25e+200)
		tmp = t_3;
	elseif (z <= -1.05e+81)
		tmp = t_1;
	elseif (z <= -1.45e+47)
		tmp = t_3;
	elseif (z <= -1050000000000.0)
		tmp = t_2;
	elseif (z <= -1.26e-39)
		tmp = t_0;
	elseif (z <= 2.35e-98)
		tmp = x;
	elseif (z <= 4e+14)
		tmp = t_0;
	elseif (z <= 3.2e+26)
		tmp = t_2;
	elseif (z <= 1.18e+201)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (6.0 * y) * z;
	t_1 = x * (-6.0 * z);
	t_2 = -6.0 * (x * z);
	t_3 = 6.0 * (y * z);
	tmp = 0.0;
	if (z <= -7.5e+241)
		tmp = t_1;
	elseif (z <= -1.25e+200)
		tmp = t_3;
	elseif (z <= -1.05e+81)
		tmp = t_1;
	elseif (z <= -1.45e+47)
		tmp = t_3;
	elseif (z <= -1050000000000.0)
		tmp = t_2;
	elseif (z <= -1.26e-39)
		tmp = t_0;
	elseif (z <= 2.35e-98)
		tmp = x;
	elseif (z <= 4e+14)
		tmp = t_0;
	elseif (z <= 3.2e+26)
		tmp = t_2;
	elseif (z <= 1.18e+201)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+241], t$95$1, If[LessEqual[z, -1.25e+200], t$95$3, If[LessEqual[z, -1.05e+81], t$95$1, If[LessEqual[z, -1.45e+47], t$95$3, If[LessEqual[z, -1050000000000.0], t$95$2, If[LessEqual[z, -1.26e-39], t$95$0, If[LessEqual[z, 2.35e-98], x, If[LessEqual[z, 4e+14], t$95$0, If[LessEqual[z, 3.2e+26], t$95$2, If[LessEqual[z, 1.18e+201], t$95$0, t$95$1]]]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.25 \cdot 10^{+200}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -1.05 \cdot 10^{+81}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.45 \cdot 10^{+47}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -1050000000000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -1.26 \cdot 10^{-39}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 2.35 \cdot 10^{-98}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4 \cdot 10^{+14}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{+26}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.18 \cdot 10^{+201}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -7.5000000000000001e241 or -1.25000000000000005e200 < z < -1.0499999999999999e81 or 1.18e201 < z

    1. Initial program 99.9%

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

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

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

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

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

    if -7.5000000000000001e241 < z < -1.25000000000000005e200 or -1.0499999999999999e81 < z < -1.4499999999999999e47

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

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

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

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

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

    if -1.4499999999999999e47 < z < -1.05e12 or 4e14 < z < 3.20000000000000029e26

    1. Initial program 99.5%

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

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

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

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

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

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

    if -1.05e12 < z < -1.26e-39 or 2.35000000000000003e-98 < z < 4e14 or 3.20000000000000029e26 < z < 1.18e201

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

    if -1.26e-39 < z < 2.35000000000000003e-98

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{+241}:\\ \;\;\;\;x \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.25 \cdot 10^{+200}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{+81}:\\ \;\;\;\;x \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{+47}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1050000000000:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{-39}:\\ \;\;\;\;\left(6 \cdot y\right) \cdot z\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{-98}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+14}:\\ \;\;\;\;\left(6 \cdot y\right) \cdot z\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+26}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.18 \cdot 10^{+201}:\\ \;\;\;\;\left(6 \cdot y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-6 \cdot z\right)\\ \end{array} \]

Alternative 5: 84.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{-40} \lor \neg \left(z \leq 9 \cdot 10^{-89}\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.5999999999999998e-40 or 8.9999999999999998e-89 < 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 x + \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    3. Taylor expanded in z around inf 91.2%

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

    if -7.5999999999999998e-40 < z < 8.9999999999999998e-89

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.6 \cdot 10^{-40} \lor \neg \left(z \leq 9 \cdot 10^{-89}\right):\\ \;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 6: 83.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-39} \lor \neg \left(z \leq 2.9 \cdot 10^{-90}\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.99999999999999929e-40 or 2.89999999999999983e-90 < 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 x + \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    3. Taylor expanded in z around inf 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999929e-40 < z < 2.89999999999999983e-90

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-39} \lor \neg \left(z \leq 2.9 \cdot 10^{-90}\right):\\ \;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 7: 98.7% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.141999999999999987 < z < 0.170000000000000012

    1. Initial program 99.8%

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

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

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

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

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

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

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

Alternative 8: 98.7% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.00559999999999999994 < 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}{\left(6 \cdot y\right)} \cdot z \]

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

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

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

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

Alternative 9: 61.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.0056 \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.0056) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.0056) || !(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.0056d0)) .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.0056) || !(z <= 0.17)) {
		tmp = -6.0 * (x * z);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -0.0056) 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.0056) || !(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.0056) || ~((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.0056], 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.0056 \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.00559999999999999994 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 51.7%

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

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

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

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

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

    if -0.00559999999999999994 < 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 67.6%

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

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

Alternative 10: 99.8% accurate, 1.0× speedup?

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

\\
x + 6 \cdot \left(z \cdot \left(y - x\right)\right)
\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 99.8%

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

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

Alternative 11: 99.6% accurate, 1.0× speedup?

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

\\
x + z \cdot \left(6 \cdot \left(y - x\right)\right)
\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 + z \cdot \left(6 \cdot \left(y - x\right)\right) \]

Alternative 12: 36.1% 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 38.0%

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

    \[\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 2023311 
(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)))