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

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

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

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

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

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

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

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

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

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

Alternative 2: 59.9% 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 -5.2 \cdot 10^{+248}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -6 \cdot 10^{+190}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+63}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.3 \cdot 10^{-65}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-123}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-18}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+82} \lor \neg \left(z \leq 5.6 \cdot 10^{+233}\right) \land z \leq 1.55 \cdot 10^{+264}:\\ \;\;\;\;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 -5.2e+248)
     t_0
     (if (<= z -6e+190)
       t_1
       (if (<= z -1.6e+63)
         t_0
         (if (<= z -4.3e-65)
           t_1
           (if (<= z 1.12e-175)
             x
             (if (<= z 1.05e-123)
               t_1
               (if (<= z 5.2e-18)
                 x
                 (if (or (<= z 4.2e+82)
                         (and (not (<= z 5.6e+233)) (<= z 1.55e+264)))
                   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 <= -5.2e+248) {
		tmp = t_0;
	} else if (z <= -6e+190) {
		tmp = t_1;
	} else if (z <= -1.6e+63) {
		tmp = t_0;
	} else if (z <= -4.3e-65) {
		tmp = t_1;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 1.05e-123) {
		tmp = t_1;
	} else if (z <= 5.2e-18) {
		tmp = x;
	} else if ((z <= 4.2e+82) || (!(z <= 5.6e+233) && (z <= 1.55e+264))) {
		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 <= (-5.2d+248)) then
        tmp = t_0
    else if (z <= (-6d+190)) then
        tmp = t_1
    else if (z <= (-1.6d+63)) then
        tmp = t_0
    else if (z <= (-4.3d-65)) then
        tmp = t_1
    else if (z <= 1.12d-175) then
        tmp = x
    else if (z <= 1.05d-123) then
        tmp = t_1
    else if (z <= 5.2d-18) then
        tmp = x
    else if ((z <= 4.2d+82) .or. (.not. (z <= 5.6d+233)) .and. (z <= 1.55d+264)) 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 <= -5.2e+248) {
		tmp = t_0;
	} else if (z <= -6e+190) {
		tmp = t_1;
	} else if (z <= -1.6e+63) {
		tmp = t_0;
	} else if (z <= -4.3e-65) {
		tmp = t_1;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 1.05e-123) {
		tmp = t_1;
	} else if (z <= 5.2e-18) {
		tmp = x;
	} else if ((z <= 4.2e+82) || (!(z <= 5.6e+233) && (z <= 1.55e+264))) {
		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 <= -5.2e+248:
		tmp = t_0
	elif z <= -6e+190:
		tmp = t_1
	elif z <= -1.6e+63:
		tmp = t_0
	elif z <= -4.3e-65:
		tmp = t_1
	elif z <= 1.12e-175:
		tmp = x
	elif z <= 1.05e-123:
		tmp = t_1
	elif z <= 5.2e-18:
		tmp = x
	elif (z <= 4.2e+82) or (not (z <= 5.6e+233) and (z <= 1.55e+264)):
		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 <= -5.2e+248)
		tmp = t_0;
	elseif (z <= -6e+190)
		tmp = t_1;
	elseif (z <= -1.6e+63)
		tmp = t_0;
	elseif (z <= -4.3e-65)
		tmp = t_1;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 1.05e-123)
		tmp = t_1;
	elseif (z <= 5.2e-18)
		tmp = x;
	elseif ((z <= 4.2e+82) || (!(z <= 5.6e+233) && (z <= 1.55e+264)))
		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 <= -5.2e+248)
		tmp = t_0;
	elseif (z <= -6e+190)
		tmp = t_1;
	elseif (z <= -1.6e+63)
		tmp = t_0;
	elseif (z <= -4.3e-65)
		tmp = t_1;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 1.05e-123)
		tmp = t_1;
	elseif (z <= 5.2e-18)
		tmp = x;
	elseif ((z <= 4.2e+82) || (~((z <= 5.6e+233)) && (z <= 1.55e+264)))
		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, -5.2e+248], t$95$0, If[LessEqual[z, -6e+190], t$95$1, If[LessEqual[z, -1.6e+63], t$95$0, If[LessEqual[z, -4.3e-65], t$95$1, If[LessEqual[z, 1.12e-175], x, If[LessEqual[z, 1.05e-123], t$95$1, If[LessEqual[z, 5.2e-18], x, If[Or[LessEqual[z, 4.2e+82], And[N[Not[LessEqual[z, 5.6e+233]], $MachinePrecision], LessEqual[z, 1.55e+264]]], 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 -5.2 \cdot 10^{+248}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -6 \cdot 10^{+190}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -1.6 \cdot 10^{+63}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -4.3 \cdot 10^{-65}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-18}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+82} \lor \neg \left(z \leq 5.6 \cdot 10^{+233}\right) \land z \leq 1.55 \cdot 10^{+264}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.20000000000000019e248 or -5.99999999999999964e190 < z < -1.60000000000000006e63 or 4.2e82 < z < 5.60000000000000021e233 or 1.54999999999999991e264 < 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 71.8%

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

    if -5.20000000000000019e248 < z < -5.99999999999999964e190 or -1.60000000000000006e63 < z < -4.30000000000000024e-65 or 1.1200000000000001e-175 < z < 1.05e-123 or 5.2000000000000001e-18 < z < 4.2e82 or 5.60000000000000021e233 < z < 1.54999999999999991e264

    1. Initial program 98.5%

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

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

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

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

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

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

    if -4.30000000000000024e-65 < z < 1.1200000000000001e-175 or 1.05e-123 < z < 5.2000000000000001e-18

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+248}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -6 \cdot 10^{+190}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+63}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -4.3 \cdot 10^{-65}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-123}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-18}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+82} \lor \neg \left(z \leq 5.6 \cdot 10^{+233}\right) \land z \leq 1.55 \cdot 10^{+264}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 3: 59.6% 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.5 \cdot 10^{+254}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{+190}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{+71}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-65}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-123}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-19}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.38 \cdot 10^{+84} \lor \neg \left(z \leq 2.55 \cdot 10^{+237}\right) \land z \leq 9.6 \cdot 10^{+262}:\\ \;\;\;\;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.5e+254)
     t_0
     (if (<= z -3.3e+190)
       t_1
       (if (<= z -1.35e+71)
         t_0
         (if (<= z -5e-65)
           t_1
           (if (<= z 1.12e-175)
             x
             (if (<= z 1.05e-123)
               t_1
               (if (<= z 8.5e-19)
                 x
                 (if (or (<= z 1.38e+84)
                         (and (not (<= z 2.55e+237)) (<= z 9.6e+262)))
                   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.5e+254) {
		tmp = t_0;
	} else if (z <= -3.3e+190) {
		tmp = t_1;
	} else if (z <= -1.35e+71) {
		tmp = t_0;
	} else if (z <= -5e-65) {
		tmp = t_1;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 1.05e-123) {
		tmp = t_1;
	} else if (z <= 8.5e-19) {
		tmp = x;
	} else if ((z <= 1.38e+84) || (!(z <= 2.55e+237) && (z <= 9.6e+262))) {
		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.5d+254)) then
        tmp = t_0
    else if (z <= (-3.3d+190)) then
        tmp = t_1
    else if (z <= (-1.35d+71)) then
        tmp = t_0
    else if (z <= (-5d-65)) then
        tmp = t_1
    else if (z <= 1.12d-175) then
        tmp = x
    else if (z <= 1.05d-123) then
        tmp = t_1
    else if (z <= 8.5d-19) then
        tmp = x
    else if ((z <= 1.38d+84) .or. (.not. (z <= 2.55d+237)) .and. (z <= 9.6d+262)) 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.5e+254) {
		tmp = t_0;
	} else if (z <= -3.3e+190) {
		tmp = t_1;
	} else if (z <= -1.35e+71) {
		tmp = t_0;
	} else if (z <= -5e-65) {
		tmp = t_1;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 1.05e-123) {
		tmp = t_1;
	} else if (z <= 8.5e-19) {
		tmp = x;
	} else if ((z <= 1.38e+84) || (!(z <= 2.55e+237) && (z <= 9.6e+262))) {
		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.5e+254:
		tmp = t_0
	elif z <= -3.3e+190:
		tmp = t_1
	elif z <= -1.35e+71:
		tmp = t_0
	elif z <= -5e-65:
		tmp = t_1
	elif z <= 1.12e-175:
		tmp = x
	elif z <= 1.05e-123:
		tmp = t_1
	elif z <= 8.5e-19:
		tmp = x
	elif (z <= 1.38e+84) or (not (z <= 2.55e+237) and (z <= 9.6e+262)):
		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.5e+254)
		tmp = t_0;
	elseif (z <= -3.3e+190)
		tmp = t_1;
	elseif (z <= -1.35e+71)
		tmp = t_0;
	elseif (z <= -5e-65)
		tmp = t_1;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 1.05e-123)
		tmp = t_1;
	elseif (z <= 8.5e-19)
		tmp = x;
	elseif ((z <= 1.38e+84) || (!(z <= 2.55e+237) && (z <= 9.6e+262)))
		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.5e+254)
		tmp = t_0;
	elseif (z <= -3.3e+190)
		tmp = t_1;
	elseif (z <= -1.35e+71)
		tmp = t_0;
	elseif (z <= -5e-65)
		tmp = t_1;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 1.05e-123)
		tmp = t_1;
	elseif (z <= 8.5e-19)
		tmp = x;
	elseif ((z <= 1.38e+84) || (~((z <= 2.55e+237)) && (z <= 9.6e+262)))
		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.5e+254], t$95$0, If[LessEqual[z, -3.3e+190], t$95$1, If[LessEqual[z, -1.35e+71], t$95$0, If[LessEqual[z, -5e-65], t$95$1, If[LessEqual[z, 1.12e-175], x, If[LessEqual[z, 1.05e-123], t$95$1, If[LessEqual[z, 8.5e-19], x, If[Or[LessEqual[z, 1.38e+84], And[N[Not[LessEqual[z, 2.55e+237]], $MachinePrecision], LessEqual[z, 9.6e+262]]], 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.5 \cdot 10^{+254}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -3.3 \cdot 10^{+190}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq -5 \cdot 10^{-65}:\\
\;\;\;\;t_1\\

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

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

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-19}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.38 \cdot 10^{+84} \lor \neg \left(z \leq 2.55 \cdot 10^{+237}\right) \land z \leq 9.6 \cdot 10^{+262}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.50000000000000017e254 or -3.3e190 < z < -1.34999999999999998e71 or 1.38e84 < z < 2.54999999999999989e237 or 9.59999999999999932e262 < 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 71.8%

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

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

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

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

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

    if -3.50000000000000017e254 < z < -3.3e190 or -1.34999999999999998e71 < z < -4.99999999999999983e-65 or 1.1200000000000001e-175 < z < 1.05e-123 or 8.50000000000000003e-19 < z < 1.38e84 or 2.54999999999999989e237 < z < 9.59999999999999932e262

    1. Initial program 98.5%

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

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

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

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

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

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

    if -4.99999999999999983e-65 < z < 1.1200000000000001e-175 or 1.05e-123 < z < 8.50000000000000003e-19

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.5 \cdot 10^{+254}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{+190}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{+71}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-65}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-123}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-19}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.38 \cdot 10^{+84} \lor \neg \left(z \leq 2.55 \cdot 10^{+237}\right) \land z \leq 9.6 \cdot 10^{+262}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \end{array} \]

Alternative 4: 59.9% 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 -1.6 \cdot 10^{+252}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{+190}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+66}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4.3 \cdot 10^{-65}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-122}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+82}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+231} \lor \neg \left(z \leq 5.4 \cdot 10^{+261}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 -1.6e+252)
     t_0
     (if (<= z -1.4e+190)
       t_1
       (if (<= z -8.5e+66)
         t_0
         (if (<= z -4.3e-65)
           t_1
           (if (<= z 1.12e-175)
             x
             (if (<= z 6.2e-122)
               t_2
               (if (<= z 5.6e-20)
                 x
                 (if (<= z 4.2e+82)
                   t_2
                   (if (or (<= z 2.1e+231) (not (<= z 5.4e+261)))
                     t_0
                     t_1)))))))))))
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 <= -1.6e+252) {
		tmp = t_0;
	} else if (z <= -1.4e+190) {
		tmp = t_1;
	} else if (z <= -8.5e+66) {
		tmp = t_0;
	} else if (z <= -4.3e-65) {
		tmp = t_1;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 6.2e-122) {
		tmp = t_2;
	} else if (z <= 5.6e-20) {
		tmp = x;
	} else if (z <= 4.2e+82) {
		tmp = t_2;
	} else if ((z <= 2.1e+231) || !(z <= 5.4e+261)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = z * (x * (-6.0d0))
    t_1 = z * (y * 6.0d0)
    t_2 = 6.0d0 * (y * z)
    if (z <= (-1.6d+252)) then
        tmp = t_0
    else if (z <= (-1.4d+190)) then
        tmp = t_1
    else if (z <= (-8.5d+66)) then
        tmp = t_0
    else if (z <= (-4.3d-65)) then
        tmp = t_1
    else if (z <= 1.12d-175) then
        tmp = x
    else if (z <= 6.2d-122) then
        tmp = t_2
    else if (z <= 5.6d-20) then
        tmp = x
    else if (z <= 4.2d+82) then
        tmp = t_2
    else if ((z <= 2.1d+231) .or. (.not. (z <= 5.4d+261))) 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 = z * (x * -6.0);
	double t_1 = z * (y * 6.0);
	double t_2 = 6.0 * (y * z);
	double tmp;
	if (z <= -1.6e+252) {
		tmp = t_0;
	} else if (z <= -1.4e+190) {
		tmp = t_1;
	} else if (z <= -8.5e+66) {
		tmp = t_0;
	} else if (z <= -4.3e-65) {
		tmp = t_1;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 6.2e-122) {
		tmp = t_2;
	} else if (z <= 5.6e-20) {
		tmp = x;
	} else if (z <= 4.2e+82) {
		tmp = t_2;
	} else if ((z <= 2.1e+231) || !(z <= 5.4e+261)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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 <= -1.6e+252:
		tmp = t_0
	elif z <= -1.4e+190:
		tmp = t_1
	elif z <= -8.5e+66:
		tmp = t_0
	elif z <= -4.3e-65:
		tmp = t_1
	elif z <= 1.12e-175:
		tmp = x
	elif z <= 6.2e-122:
		tmp = t_2
	elif z <= 5.6e-20:
		tmp = x
	elif z <= 4.2e+82:
		tmp = t_2
	elif (z <= 2.1e+231) or not (z <= 5.4e+261):
		tmp = t_0
	else:
		tmp = t_1
	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 <= -1.6e+252)
		tmp = t_0;
	elseif (z <= -1.4e+190)
		tmp = t_1;
	elseif (z <= -8.5e+66)
		tmp = t_0;
	elseif (z <= -4.3e-65)
		tmp = t_1;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 6.2e-122)
		tmp = t_2;
	elseif (z <= 5.6e-20)
		tmp = x;
	elseif (z <= 4.2e+82)
		tmp = t_2;
	elseif ((z <= 2.1e+231) || !(z <= 5.4e+261))
		tmp = t_0;
	else
		tmp = t_1;
	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 <= -1.6e+252)
		tmp = t_0;
	elseif (z <= -1.4e+190)
		tmp = t_1;
	elseif (z <= -8.5e+66)
		tmp = t_0;
	elseif (z <= -4.3e-65)
		tmp = t_1;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 6.2e-122)
		tmp = t_2;
	elseif (z <= 5.6e-20)
		tmp = x;
	elseif (z <= 4.2e+82)
		tmp = t_2;
	elseif ((z <= 2.1e+231) || ~((z <= 5.4e+261)))
		tmp = t_0;
	else
		tmp = t_1;
	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, -1.6e+252], t$95$0, If[LessEqual[z, -1.4e+190], t$95$1, If[LessEqual[z, -8.5e+66], t$95$0, If[LessEqual[z, -4.3e-65], t$95$1, If[LessEqual[z, 1.12e-175], x, If[LessEqual[z, 6.2e-122], t$95$2, If[LessEqual[z, 5.6e-20], x, If[LessEqual[z, 4.2e+82], t$95$2, If[Or[LessEqual[z, 2.1e+231], N[Not[LessEqual[z, 5.4e+261]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]]]]]
\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 -1.6 \cdot 10^{+252}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -1.4 \cdot 10^{+190}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -8.5 \cdot 10^{+66}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq -4.3 \cdot 10^{-65}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 6.2 \cdot 10^{-122}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{-20}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+82}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 2.1 \cdot 10^{+231} \lor \neg \left(z \leq 5.4 \cdot 10^{+261}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.6000000000000001e252 or -1.39999999999999998e190 < z < -8.5000000000000004e66 or 4.2e82 < z < 2.09999999999999984e231 or 5.40000000000000005e261 < 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 71.8%

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

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

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

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

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

    if -1.6000000000000001e252 < z < -1.39999999999999998e190 or -8.5000000000000004e66 < z < -4.30000000000000024e-65 or 2.09999999999999984e231 < z < 5.40000000000000005e261

    1. Initial program 99.8%

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

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

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

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

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

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

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

    if -4.30000000000000024e-65 < z < 1.1200000000000001e-175 or 6.1999999999999997e-122 < z < 5.6000000000000005e-20

    1. Initial program 99.9%

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

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

    if 1.1200000000000001e-175 < z < 6.1999999999999997e-122 or 5.6000000000000005e-20 < z < 4.2e82

    1. Initial program 96.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+252}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{+190}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+66}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -4.3 \cdot 10^{-65}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-122}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+82}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+231} \lor \neg \left(z \leq 5.4 \cdot 10^{+261}\right):\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \end{array} \]

Alternative 5: 59.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ t_1 := z \cdot \left(x \cdot -6\right)\\ t_2 := z \cdot \left(y \cdot 6\right)\\ \mathbf{if}\;z \leq -6.5 \cdot 10^{+255}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+193}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.56 \cdot 10^{+63}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+84}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{+233} \lor \neg \left(z \leq 10^{+262}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y z))) (t_1 (* z (* x -6.0))) (t_2 (* z (* y 6.0))))
   (if (<= z -6.5e+255)
     (* x (* z -6.0))
     (if (<= z -3e+193)
       t_2
       (if (<= z -1.56e+63)
         t_1
         (if (<= z -5e-65)
           t_2
           (if (<= z 1.12e-175)
             x
             (if (<= z 2.8e-123)
               t_0
               (if (<= z 7.2e-20)
                 x
                 (if (<= z 1.9e+84)
                   t_0
                   (if (or (<= z 6.8e+233) (not (<= z 1e+262)))
                     t_1
                     t_2)))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * z);
	double t_1 = z * (x * -6.0);
	double t_2 = z * (y * 6.0);
	double tmp;
	if (z <= -6.5e+255) {
		tmp = x * (z * -6.0);
	} else if (z <= -3e+193) {
		tmp = t_2;
	} else if (z <= -1.56e+63) {
		tmp = t_1;
	} else if (z <= -5e-65) {
		tmp = t_2;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 2.8e-123) {
		tmp = t_0;
	} else if (z <= 7.2e-20) {
		tmp = x;
	} else if (z <= 1.9e+84) {
		tmp = t_0;
	} else if ((z <= 6.8e+233) || !(z <= 1e+262)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = 6.0d0 * (y * z)
    t_1 = z * (x * (-6.0d0))
    t_2 = z * (y * 6.0d0)
    if (z <= (-6.5d+255)) then
        tmp = x * (z * (-6.0d0))
    else if (z <= (-3d+193)) then
        tmp = t_2
    else if (z <= (-1.56d+63)) then
        tmp = t_1
    else if (z <= (-5d-65)) then
        tmp = t_2
    else if (z <= 1.12d-175) then
        tmp = x
    else if (z <= 2.8d-123) then
        tmp = t_0
    else if (z <= 7.2d-20) then
        tmp = x
    else if (z <= 1.9d+84) then
        tmp = t_0
    else if ((z <= 6.8d+233) .or. (.not. (z <= 1d+262))) then
        tmp = t_1
    else
        tmp = t_2
    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 = z * (x * -6.0);
	double t_2 = z * (y * 6.0);
	double tmp;
	if (z <= -6.5e+255) {
		tmp = x * (z * -6.0);
	} else if (z <= -3e+193) {
		tmp = t_2;
	} else if (z <= -1.56e+63) {
		tmp = t_1;
	} else if (z <= -5e-65) {
		tmp = t_2;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 2.8e-123) {
		tmp = t_0;
	} else if (z <= 7.2e-20) {
		tmp = x;
	} else if (z <= 1.9e+84) {
		tmp = t_0;
	} else if ((z <= 6.8e+233) || !(z <= 1e+262)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * z)
	t_1 = z * (x * -6.0)
	t_2 = z * (y * 6.0)
	tmp = 0
	if z <= -6.5e+255:
		tmp = x * (z * -6.0)
	elif z <= -3e+193:
		tmp = t_2
	elif z <= -1.56e+63:
		tmp = t_1
	elif z <= -5e-65:
		tmp = t_2
	elif z <= 1.12e-175:
		tmp = x
	elif z <= 2.8e-123:
		tmp = t_0
	elif z <= 7.2e-20:
		tmp = x
	elif z <= 1.9e+84:
		tmp = t_0
	elif (z <= 6.8e+233) or not (z <= 1e+262):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * z))
	t_1 = Float64(z * Float64(x * -6.0))
	t_2 = Float64(z * Float64(y * 6.0))
	tmp = 0.0
	if (z <= -6.5e+255)
		tmp = Float64(x * Float64(z * -6.0));
	elseif (z <= -3e+193)
		tmp = t_2;
	elseif (z <= -1.56e+63)
		tmp = t_1;
	elseif (z <= -5e-65)
		tmp = t_2;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 2.8e-123)
		tmp = t_0;
	elseif (z <= 7.2e-20)
		tmp = x;
	elseif (z <= 1.9e+84)
		tmp = t_0;
	elseif ((z <= 6.8e+233) || !(z <= 1e+262))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * z);
	t_1 = z * (x * -6.0);
	t_2 = z * (y * 6.0);
	tmp = 0.0;
	if (z <= -6.5e+255)
		tmp = x * (z * -6.0);
	elseif (z <= -3e+193)
		tmp = t_2;
	elseif (z <= -1.56e+63)
		tmp = t_1;
	elseif (z <= -5e-65)
		tmp = t_2;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 2.8e-123)
		tmp = t_0;
	elseif (z <= 7.2e-20)
		tmp = x;
	elseif (z <= 1.9e+84)
		tmp = t_0;
	elseif ((z <= 6.8e+233) || ~((z <= 1e+262)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e+255], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3e+193], t$95$2, If[LessEqual[z, -1.56e+63], t$95$1, If[LessEqual[z, -5e-65], t$95$2, If[LessEqual[z, 1.12e-175], x, If[LessEqual[z, 2.8e-123], t$95$0, If[LessEqual[z, 7.2e-20], x, If[LessEqual[z, 1.9e+84], t$95$0, If[Or[LessEqual[z, 6.8e+233], N[Not[LessEqual[z, 1e+262]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3 \cdot 10^{+193}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -1.56 \cdot 10^{+63}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -5 \cdot 10^{-65}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-123}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-20}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+84}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 6.8 \cdot 10^{+233} \lor \neg \left(z \leq 10^{+262}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


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

    1. Initial program 99.6%

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

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

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

    if -6.50000000000000003e255 < z < -3e193 or -1.56e63 < z < -4.99999999999999983e-65 or 6.80000000000000044e233 < z < 1e262

    1. Initial program 99.8%

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

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

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

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

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

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

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

    if -3e193 < z < -1.56e63 or 1.9e84 < z < 6.80000000000000044e233 or 1e262 < 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 68.4%

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

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

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

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

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

    if -4.99999999999999983e-65 < z < 1.1200000000000001e-175 or 2.7999999999999999e-123 < z < 7.19999999999999948e-20

    1. Initial program 99.9%

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

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

    if 1.1200000000000001e-175 < z < 2.7999999999999999e-123 or 7.19999999999999948e-20 < z < 1.9e84

    1. Initial program 96.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+255}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+193}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.56 \cdot 10^{+63}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-65}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-123}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+84}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{+233} \lor \neg \left(z \leq 10^{+262}\right):\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \end{array} \]

Alternative 6: 82.5% 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 -3.7 \cdot 10^{-65}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-123}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-18}:\\ \;\;\;\;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 -3.7e-65)
     t_0
     (if (<= z 1.12e-175)
       x
       (if (<= z 1.05e-123) (* 6.0 (* y z)) (if (<= z 3.6e-18) x t_0))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * ((y - x) * z);
	double tmp;
	if (z <= -3.7e-65) {
		tmp = t_0;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 1.05e-123) {
		tmp = 6.0 * (y * z);
	} else if (z <= 3.6e-18) {
		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 <= (-3.7d-65)) then
        tmp = t_0
    else if (z <= 1.12d-175) then
        tmp = x
    else if (z <= 1.05d-123) then
        tmp = 6.0d0 * (y * z)
    else if (z <= 3.6d-18) 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 <= -3.7e-65) {
		tmp = t_0;
	} else if (z <= 1.12e-175) {
		tmp = x;
	} else if (z <= 1.05e-123) {
		tmp = 6.0 * (y * z);
	} else if (z <= 3.6e-18) {
		tmp = x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * ((y - x) * z)
	tmp = 0
	if z <= -3.7e-65:
		tmp = t_0
	elif z <= 1.12e-175:
		tmp = x
	elif z <= 1.05e-123:
		tmp = 6.0 * (y * z)
	elif z <= 3.6e-18:
		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 <= -3.7e-65)
		tmp = t_0;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 1.05e-123)
		tmp = Float64(6.0 * Float64(y * z));
	elseif (z <= 3.6e-18)
		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 <= -3.7e-65)
		tmp = t_0;
	elseif (z <= 1.12e-175)
		tmp = x;
	elseif (z <= 1.05e-123)
		tmp = 6.0 * (y * z);
	elseif (z <= 3.6e-18)
		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, -3.7e-65], t$95$0, If[LessEqual[z, 1.12e-175], x, If[LessEqual[z, 1.05e-123], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e-18], 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 -3.7 \cdot 10^{-65}:\\
\;\;\;\;t_0\\

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

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

\mathbf{elif}\;z \leq 3.6 \cdot 10^{-18}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.7e-65 or 3.6000000000000001e-18 < z

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

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

    if -3.7e-65 < z < 1.1200000000000001e-175 or 1.05e-123 < z < 3.6000000000000001e-18

    1. Initial program 99.9%

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

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

    if 1.1200000000000001e-175 < z < 1.05e-123

    1. Initial program 94.4%

      \[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 67.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.7 \cdot 10^{-65}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-175}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-123}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-18}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 7: 80.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+59} \lor \neg \left(x \leq 1.1 \cdot 10^{+75}\right):\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.3999999999999999e59 or 1.10000000000000006e75 < x

    1. Initial program 99.9%

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

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

    if -1.3999999999999999e59 < x < 1.10000000000000006e75

    1. Initial program 99.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+59} \lor \neg \left(x \leq 1.1 \cdot 10^{+75}\right):\\ \;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array} \]

Alternative 8: 98.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.00086\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 -0.17) (not (<= z 0.00086)))
   (* 6.0 (* (- y x) z))
   (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.17) || !(z <= 0.00086)) {
		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 <= (-0.17d0)) .or. (.not. (z <= 0.00086d0))) 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 <= -0.17) || !(z <= 0.00086)) {
		tmp = 6.0 * ((y - x) * z);
	} else {
		tmp = x + (6.0 * (y * z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -0.17) or not (z <= 0.00086):
		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 <= -0.17) || !(z <= 0.00086))
		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 <= -0.17) || ~((z <= 0.00086)))
		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, -0.17], N[Not[LessEqual[z, 0.00086]], $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 -0.17 \lor \neg \left(z \leq 0.00086\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 < -0.170000000000000012 or 8.59999999999999979e-4 < 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.6%

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

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

    if -0.170000000000000012 < z < 8.59999999999999979e-4

    1. Initial program 99.0%

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

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

Alternative 9: 98.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.17999999999999999 or 0.165000000000000008 < 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.6%

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

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

    if -0.17999999999999999 < z < 0.165000000000000008

    1. Initial program 99.0%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Step-by-step derivation
      1. associate-*r*99.9%

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

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

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

        \[\leadsto x + \color{blue}{\frac{\left(6 \cdot z\right) \cdot \left(y \cdot y - x \cdot x\right)}{y + x}} \]
    3. Applied egg-rr48.3%

      \[\leadsto x + \color{blue}{\frac{\left(6 \cdot z\right) \cdot \left(y \cdot y - x \cdot x\right)}{y + x}} \]
    4. Step-by-step derivation
      1. associate-/l*48.3%

        \[\leadsto x + \color{blue}{\frac{6 \cdot z}{\frac{y + x}{y \cdot y - x \cdot x}}} \]
      2. *-commutative48.3%

        \[\leadsto x + \frac{\color{blue}{z \cdot 6}}{\frac{y + x}{y \cdot y - x \cdot x}} \]
      3. associate-/l*48.3%

        \[\leadsto x + \color{blue}{\frac{z}{\frac{\frac{y + x}{y \cdot y - x \cdot x}}{6}}} \]
      4. difference-of-squares48.4%

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

        \[\leadsto x + \frac{z}{\frac{\color{blue}{\frac{\frac{y + x}{y + x}}{y - x}}}{6}} \]
      6. *-inverses99.8%

        \[\leadsto x + \frac{z}{\frac{\frac{\color{blue}{1}}{y - x}}{6}} \]
    5. Simplified99.8%

      \[\leadsto x + \color{blue}{\frac{z}{\frac{\frac{1}{y - x}}{6}}} \]
    6. Taylor expanded in y around inf 98.6%

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

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

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

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

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

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

Alternative 10: 61.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.0205 \lor \neg \left(z \leq 0.165\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.0205) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.0205) || !(z <= 0.165)) {
		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.0205d0)) .or. (.not. (z <= 0.165d0))) 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.0205) || !(z <= 0.165)) {
		tmp = -6.0 * (x * z);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -0.0205) or not (z <= 0.165):
		tmp = -6.0 * (x * z)
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -0.0205) || !(z <= 0.165))
		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.0205) || ~((z <= 0.165)))
		tmp = -6.0 * (x * z);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.0205], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0205 \lor \neg \left(z \leq 0.165\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.0205000000000000009 or 0.165000000000000008 < 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.6%

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

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

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

    if -0.0205000000000000009 < z < 0.165000000000000008

    1. Initial program 99.0%

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

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

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

Alternative 11: 99.7% accurate, 1.0× speedup?

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

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

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

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

Alternative 12: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y - x\right) \cdot \left(6 \cdot z\right) \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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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