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

Percentage Accurate: 99.7% → 99.8%
Time: 9.0s
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, 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.8%

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

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

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

Alternative 2: 59.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot -6\right)\\ t_1 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -1.52 \cdot 10^{+266}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -5 \cdot 10^{+180}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{+96}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-97}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{+26} \lor \neg \left(z \leq 2.3 \cdot 10^{+164}\right):\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
   (if (<= z -1.52e+266)
     t_0
     (if (<= z -5e+180)
       t_1
       (if (<= z -2.4e+96)
         t_0
         (if (<= z -6.6e-97)
           t_1
           (if (<= z 2e-118)
             x
             (if (or (<= z 1.26e+26) (not (<= z 2.3e+164)))
               (* y (* 6.0 z))
               t_0))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * -6.0);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -1.52e+266) {
		tmp = t_0;
	} else if (z <= -5e+180) {
		tmp = t_1;
	} else if (z <= -2.4e+96) {
		tmp = t_0;
	} else if (z <= -6.6e-97) {
		tmp = t_1;
	} else if (z <= 2e-118) {
		tmp = x;
	} else if ((z <= 1.26e+26) || !(z <= 2.3e+164)) {
		tmp = y * (6.0 * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (z * (-6.0d0))
    t_1 = 6.0d0 * (y * z)
    if (z <= (-1.52d+266)) then
        tmp = t_0
    else if (z <= (-5d+180)) then
        tmp = t_1
    else if (z <= (-2.4d+96)) then
        tmp = t_0
    else if (z <= (-6.6d-97)) then
        tmp = t_1
    else if (z <= 2d-118) then
        tmp = x
    else if ((z <= 1.26d+26) .or. (.not. (z <= 2.3d+164))) then
        tmp = y * (6.0d0 * z)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * -6.0);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -1.52e+266) {
		tmp = t_0;
	} else if (z <= -5e+180) {
		tmp = t_1;
	} else if (z <= -2.4e+96) {
		tmp = t_0;
	} else if (z <= -6.6e-97) {
		tmp = t_1;
	} else if (z <= 2e-118) {
		tmp = x;
	} else if ((z <= 1.26e+26) || !(z <= 2.3e+164)) {
		tmp = y * (6.0 * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * -6.0)
	t_1 = 6.0 * (y * z)
	tmp = 0
	if z <= -1.52e+266:
		tmp = t_0
	elif z <= -5e+180:
		tmp = t_1
	elif z <= -2.4e+96:
		tmp = t_0
	elif z <= -6.6e-97:
		tmp = t_1
	elif z <= 2e-118:
		tmp = x
	elif (z <= 1.26e+26) or not (z <= 2.3e+164):
		tmp = y * (6.0 * z)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * -6.0))
	t_1 = Float64(6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -1.52e+266)
		tmp = t_0;
	elseif (z <= -5e+180)
		tmp = t_1;
	elseif (z <= -2.4e+96)
		tmp = t_0;
	elseif (z <= -6.6e-97)
		tmp = t_1;
	elseif (z <= 2e-118)
		tmp = x;
	elseif ((z <= 1.26e+26) || !(z <= 2.3e+164))
		tmp = Float64(y * Float64(6.0 * z));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * -6.0);
	t_1 = 6.0 * (y * z);
	tmp = 0.0;
	if (z <= -1.52e+266)
		tmp = t_0;
	elseif (z <= -5e+180)
		tmp = t_1;
	elseif (z <= -2.4e+96)
		tmp = t_0;
	elseif (z <= -6.6e-97)
		tmp = t_1;
	elseif (z <= 2e-118)
		tmp = x;
	elseif ((z <= 1.26e+26) || ~((z <= 2.3e+164)))
		tmp = y * (6.0 * z);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.52e+266], t$95$0, If[LessEqual[z, -5e+180], t$95$1, If[LessEqual[z, -2.4e+96], t$95$0, If[LessEqual[z, -6.6e-97], t$95$1, If[LessEqual[z, 2e-118], x, If[Or[LessEqual[z, 1.26e+26], N[Not[LessEqual[z, 2.3e+164]], $MachinePrecision]], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -5 \cdot 10^{+180}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2.4 \cdot 10^{+96}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -6.6 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 1.26 \cdot 10^{+26} \lor \neg \left(z \leq 2.3 \cdot 10^{+164}\right):\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.52000000000000006e266 or -4.9999999999999996e180 < z < -2.39999999999999993e96 or 1.25999999999999995e26 < z < 2.3e164

    1. Initial program 99.8%

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

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

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

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

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

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

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

    if -1.52000000000000006e266 < z < -4.9999999999999996e180 or -2.39999999999999993e96 < z < -6.6000000000000002e-97

    1. Initial program 99.6%

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

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

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

    if -6.6000000000000002e-97 < z < 1.99999999999999997e-118

    1. Initial program 100.0%

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

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

    if 1.99999999999999997e-118 < z < 1.25999999999999995e26 or 2.3e164 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.52 \cdot 10^{+266}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -5 \cdot 10^{+180}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{+96}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-97}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{+26} \lor \neg \left(z \leq 2.3 \cdot 10^{+164}\right):\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 59.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot -6\right)\\ t_1 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -1.36 \cdot 10^{+265}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+179}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{+94}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-97}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+25} \lor \neg \left(z \leq 1.15 \cdot 10^{+164}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
   (if (<= z -1.36e+265)
     t_0
     (if (<= z -8.5e+179)
       t_1
       (if (<= z -2.3e+94)
         t_0
         (if (<= z -7e-97)
           t_1
           (if (<= z 2e-118)
             x
             (if (or (<= z 4.2e+25) (not (<= z 1.15e+164))) t_1 t_0))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * -6.0);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -1.36e+265) {
		tmp = t_0;
	} else if (z <= -8.5e+179) {
		tmp = t_1;
	} else if (z <= -2.3e+94) {
		tmp = t_0;
	} else if (z <= -7e-97) {
		tmp = t_1;
	} else if (z <= 2e-118) {
		tmp = x;
	} else if ((z <= 4.2e+25) || !(z <= 1.15e+164)) {
		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 = x * (z * (-6.0d0))
    t_1 = 6.0d0 * (y * z)
    if (z <= (-1.36d+265)) then
        tmp = t_0
    else if (z <= (-8.5d+179)) then
        tmp = t_1
    else if (z <= (-2.3d+94)) then
        tmp = t_0
    else if (z <= (-7d-97)) then
        tmp = t_1
    else if (z <= 2d-118) then
        tmp = x
    else if ((z <= 4.2d+25) .or. (.not. (z <= 1.15d+164))) 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 = x * (z * -6.0);
	double t_1 = 6.0 * (y * z);
	double tmp;
	if (z <= -1.36e+265) {
		tmp = t_0;
	} else if (z <= -8.5e+179) {
		tmp = t_1;
	} else if (z <= -2.3e+94) {
		tmp = t_0;
	} else if (z <= -7e-97) {
		tmp = t_1;
	} else if (z <= 2e-118) {
		tmp = x;
	} else if ((z <= 4.2e+25) || !(z <= 1.15e+164)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * -6.0)
	t_1 = 6.0 * (y * z)
	tmp = 0
	if z <= -1.36e+265:
		tmp = t_0
	elif z <= -8.5e+179:
		tmp = t_1
	elif z <= -2.3e+94:
		tmp = t_0
	elif z <= -7e-97:
		tmp = t_1
	elif z <= 2e-118:
		tmp = x
	elif (z <= 4.2e+25) or not (z <= 1.15e+164):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * -6.0))
	t_1 = Float64(6.0 * Float64(y * z))
	tmp = 0.0
	if (z <= -1.36e+265)
		tmp = t_0;
	elseif (z <= -8.5e+179)
		tmp = t_1;
	elseif (z <= -2.3e+94)
		tmp = t_0;
	elseif (z <= -7e-97)
		tmp = t_1;
	elseif (z <= 2e-118)
		tmp = x;
	elseif ((z <= 4.2e+25) || !(z <= 1.15e+164))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * -6.0);
	t_1 = 6.0 * (y * z);
	tmp = 0.0;
	if (z <= -1.36e+265)
		tmp = t_0;
	elseif (z <= -8.5e+179)
		tmp = t_1;
	elseif (z <= -2.3e+94)
		tmp = t_0;
	elseif (z <= -7e-97)
		tmp = t_1;
	elseif (z <= 2e-118)
		tmp = x;
	elseif ((z <= 4.2e+25) || ~((z <= 1.15e+164)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.36e+265], t$95$0, If[LessEqual[z, -8.5e+179], t$95$1, If[LessEqual[z, -2.3e+94], t$95$0, If[LessEqual[z, -7e-97], t$95$1, If[LessEqual[z, 2e-118], x, If[Or[LessEqual[z, 4.2e+25], N[Not[LessEqual[z, 1.15e+164]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -8.5 \cdot 10^{+179}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2.3 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -7 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+25} \lor \neg \left(z \leq 1.15 \cdot 10^{+164}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.36e265 or -8.49999999999999962e179 < z < -2.3e94 or 4.1999999999999998e25 < z < 1.15e164

    1. Initial program 99.8%

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

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

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

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

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

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

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

    if -1.36e265 < z < -8.49999999999999962e179 or -2.3e94 < z < -7.00000000000000038e-97 or 1.99999999999999997e-118 < z < 4.1999999999999998e25 or 1.15e164 < z

    1. Initial program 99.6%

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

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

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

    if -7.00000000000000038e-97 < z < 1.99999999999999997e-118

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.36 \cdot 10^{+265}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+179}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-97}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+25} \lor \neg \left(z \leq 1.15 \cdot 10^{+164}\right):\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 59.7% accurate, 0.2× 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 -3.1 \cdot 10^{+264}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{+177}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{+95}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-97}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+24} \lor \neg \left(z \leq 2.5 \cdot 10^{+163}\right):\\ \;\;\;\;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 -3.1e+264)
     t_0
     (if (<= z -1.8e+177)
       t_1
       (if (<= z -2.8e+95)
         t_0
         (if (<= z -7e-97)
           t_1
           (if (<= z 2e-118)
             x
             (if (or (<= z 8.2e+24) (not (<= z 2.5e+163))) 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 <= -3.1e+264) {
		tmp = t_0;
	} else if (z <= -1.8e+177) {
		tmp = t_1;
	} else if (z <= -2.8e+95) {
		tmp = t_0;
	} else if (z <= -7e-97) {
		tmp = t_1;
	} else if (z <= 2e-118) {
		tmp = x;
	} else if ((z <= 8.2e+24) || !(z <= 2.5e+163)) {
		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 <= (-3.1d+264)) then
        tmp = t_0
    else if (z <= (-1.8d+177)) then
        tmp = t_1
    else if (z <= (-2.8d+95)) then
        tmp = t_0
    else if (z <= (-7d-97)) then
        tmp = t_1
    else if (z <= 2d-118) then
        tmp = x
    else if ((z <= 8.2d+24) .or. (.not. (z <= 2.5d+163))) 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 <= -3.1e+264) {
		tmp = t_0;
	} else if (z <= -1.8e+177) {
		tmp = t_1;
	} else if (z <= -2.8e+95) {
		tmp = t_0;
	} else if (z <= -7e-97) {
		tmp = t_1;
	} else if (z <= 2e-118) {
		tmp = x;
	} else if ((z <= 8.2e+24) || !(z <= 2.5e+163)) {
		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 <= -3.1e+264:
		tmp = t_0
	elif z <= -1.8e+177:
		tmp = t_1
	elif z <= -2.8e+95:
		tmp = t_0
	elif z <= -7e-97:
		tmp = t_1
	elif z <= 2e-118:
		tmp = x
	elif (z <= 8.2e+24) or not (z <= 2.5e+163):
		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 <= -3.1e+264)
		tmp = t_0;
	elseif (z <= -1.8e+177)
		tmp = t_1;
	elseif (z <= -2.8e+95)
		tmp = t_0;
	elseif (z <= -7e-97)
		tmp = t_1;
	elseif (z <= 2e-118)
		tmp = x;
	elseif ((z <= 8.2e+24) || !(z <= 2.5e+163))
		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 <= -3.1e+264)
		tmp = t_0;
	elseif (z <= -1.8e+177)
		tmp = t_1;
	elseif (z <= -2.8e+95)
		tmp = t_0;
	elseif (z <= -7e-97)
		tmp = t_1;
	elseif (z <= 2e-118)
		tmp = x;
	elseif ((z <= 8.2e+24) || ~((z <= 2.5e+163)))
		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, -3.1e+264], t$95$0, If[LessEqual[z, -1.8e+177], t$95$1, If[LessEqual[z, -2.8e+95], t$95$0, If[LessEqual[z, -7e-97], t$95$1, If[LessEqual[z, 2e-118], x, If[Or[LessEqual[z, 8.2e+24], N[Not[LessEqual[z, 2.5e+163]], $MachinePrecision]], 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 -3.1 \cdot 10^{+264}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -1.8 \cdot 10^{+177}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq -7 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 8.2 \cdot 10^{+24} \lor \neg \left(z \leq 2.5 \cdot 10^{+163}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.09999999999999981e264 or -1.80000000000000001e177 < z < -2.7999999999999998e95 or 8.2000000000000002e24 < z < 2.5e163

    1. Initial program 99.8%

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

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

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

    if -3.09999999999999981e264 < z < -1.80000000000000001e177 or -2.7999999999999998e95 < z < -7.00000000000000038e-97 or 1.99999999999999997e-118 < z < 8.2000000000000002e24 or 2.5e163 < z

    1. Initial program 99.6%

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

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

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

    if -7.00000000000000038e-97 < z < 1.99999999999999997e-118

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{+264}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{+177}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{+95}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-97}:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+24} \lor \neg \left(z \leq 2.5 \cdot 10^{+163}\right):\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{+106} \lor \neg \left(y \leq -500 \lor \neg \left(y \leq -5 \cdot 10^{-140}\right) \land y \leq 2.4 \cdot 10^{-9}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.3999999999999999e106 or -500 < y < -5.00000000000000015e-140 or 2.4e-9 < y

    1. Initial program 99.7%

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

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

    if -7.3999999999999999e106 < y < -500 or -5.00000000000000015e-140 < y < 2.4e-9

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+106} \lor \neg \left(y \leq -500 \lor \neg \left(y \leq -5 \cdot 10^{-140}\right) \land y \leq 2.4 \cdot 10^{-9}\right):\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.4% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \cdot 10^{+102} \lor \neg \left(y \leq 1800 \lor \neg \left(y \leq 6.5 \cdot 10^{+51}\right) \land y \leq 8 \cdot 10^{+89}\right):\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.6499999999999998e102 or 1800 < y < 6.5e51 or 7.99999999999999996e89 < y

    1. Initial program 99.8%

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

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

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

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

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

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

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

    if -2.6499999999999998e102 < y < 1800 or 6.5e51 < y < 7.99999999999999996e89

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.65 \cdot 10^{+102} \lor \neg \left(y \leq 1800 \lor \neg \left(y \leq 6.5 \cdot 10^{+51}\right) \land y \leq 8 \cdot 10^{+89}\right):\\ \;\;\;\;y \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 83.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + y \cdot \left(6 \cdot z\right)\\ \mathbf{if}\;y \leq -7.4 \cdot 10^{+106}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -500:\\ \;\;\;\;x + z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-140} \lor \neg \left(y \leq 1.8 \cdot 10^{-5}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (* y (* 6.0 z)))))
   (if (<= y -7.4e+106)
     t_0
     (if (<= y -500.0)
       (+ x (* z (* x -6.0)))
       (if (or (<= y -5.5e-140) (not (<= y 1.8e-5)))
         t_0
         (+ x (* -6.0 (* x z))))))))
double code(double x, double y, double z) {
	double t_0 = x + (y * (6.0 * z));
	double tmp;
	if (y <= -7.4e+106) {
		tmp = t_0;
	} else if (y <= -500.0) {
		tmp = x + (z * (x * -6.0));
	} else if ((y <= -5.5e-140) || !(y <= 1.8e-5)) {
		tmp = t_0;
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (y * (6.0d0 * z))
    if (y <= (-7.4d+106)) then
        tmp = t_0
    else if (y <= (-500.0d0)) then
        tmp = x + (z * (x * (-6.0d0)))
    else if ((y <= (-5.5d-140)) .or. (.not. (y <= 1.8d-5))) then
        tmp = t_0
    else
        tmp = x + ((-6.0d0) * (x * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (y * (6.0 * z));
	double tmp;
	if (y <= -7.4e+106) {
		tmp = t_0;
	} else if (y <= -500.0) {
		tmp = x + (z * (x * -6.0));
	} else if ((y <= -5.5e-140) || !(y <= 1.8e-5)) {
		tmp = t_0;
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (y * (6.0 * z))
	tmp = 0
	if y <= -7.4e+106:
		tmp = t_0
	elif y <= -500.0:
		tmp = x + (z * (x * -6.0))
	elif (y <= -5.5e-140) or not (y <= 1.8e-5):
		tmp = t_0
	else:
		tmp = x + (-6.0 * (x * z))
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(y * Float64(6.0 * z)))
	tmp = 0.0
	if (y <= -7.4e+106)
		tmp = t_0;
	elseif (y <= -500.0)
		tmp = Float64(x + Float64(z * Float64(x * -6.0)));
	elseif ((y <= -5.5e-140) || !(y <= 1.8e-5))
		tmp = t_0;
	else
		tmp = Float64(x + Float64(-6.0 * Float64(x * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (y * (6.0 * z));
	tmp = 0.0;
	if (y <= -7.4e+106)
		tmp = t_0;
	elseif (y <= -500.0)
		tmp = x + (z * (x * -6.0));
	elseif ((y <= -5.5e-140) || ~((y <= 1.8e-5)))
		tmp = t_0;
	else
		tmp = x + (-6.0 * (x * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.4e+106], t$95$0, If[LessEqual[y, -500.0], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -5.5e-140], N[Not[LessEqual[y, 1.8e-5]], $MachinePrecision]], t$95$0, N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -5.5 \cdot 10^{-140} \lor \neg \left(y \leq 1.8 \cdot 10^{-5}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.3999999999999999e106 or -500 < y < -5.50000000000000026e-140 or 1.80000000000000005e-5 < y

    1. Initial program 99.7%

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

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

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

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

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

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

    if -7.3999999999999999e106 < y < -500

    1. Initial program 99.9%

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

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

    if -5.50000000000000026e-140 < y < 1.80000000000000005e-5

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+106}:\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;y \leq -500:\\ \;\;\;\;x + z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-140} \lor \neg \left(y \leq 1.8 \cdot 10^{-5}\right):\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 83.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + y \cdot \left(6 \cdot z\right)\\ \mathbf{if}\;y \leq -7.4 \cdot 10^{+106}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -65:\\ \;\;\;\;x + x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-140} \lor \neg \left(y \leq 0.000165\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (* y (* 6.0 z)))))
   (if (<= y -7.4e+106)
     t_0
     (if (<= y -65.0)
       (+ x (* x (* z -6.0)))
       (if (or (<= y -5.5e-140) (not (<= y 0.000165)))
         t_0
         (+ x (* -6.0 (* x z))))))))
double code(double x, double y, double z) {
	double t_0 = x + (y * (6.0 * z));
	double tmp;
	if (y <= -7.4e+106) {
		tmp = t_0;
	} else if (y <= -65.0) {
		tmp = x + (x * (z * -6.0));
	} else if ((y <= -5.5e-140) || !(y <= 0.000165)) {
		tmp = t_0;
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (y * (6.0d0 * z))
    if (y <= (-7.4d+106)) then
        tmp = t_0
    else if (y <= (-65.0d0)) then
        tmp = x + (x * (z * (-6.0d0)))
    else if ((y <= (-5.5d-140)) .or. (.not. (y <= 0.000165d0))) then
        tmp = t_0
    else
        tmp = x + ((-6.0d0) * (x * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (y * (6.0 * z));
	double tmp;
	if (y <= -7.4e+106) {
		tmp = t_0;
	} else if (y <= -65.0) {
		tmp = x + (x * (z * -6.0));
	} else if ((y <= -5.5e-140) || !(y <= 0.000165)) {
		tmp = t_0;
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (y * (6.0 * z))
	tmp = 0
	if y <= -7.4e+106:
		tmp = t_0
	elif y <= -65.0:
		tmp = x + (x * (z * -6.0))
	elif (y <= -5.5e-140) or not (y <= 0.000165):
		tmp = t_0
	else:
		tmp = x + (-6.0 * (x * z))
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(y * Float64(6.0 * z)))
	tmp = 0.0
	if (y <= -7.4e+106)
		tmp = t_0;
	elseif (y <= -65.0)
		tmp = Float64(x + Float64(x * Float64(z * -6.0)));
	elseif ((y <= -5.5e-140) || !(y <= 0.000165))
		tmp = t_0;
	else
		tmp = Float64(x + Float64(-6.0 * Float64(x * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (y * (6.0 * z));
	tmp = 0.0;
	if (y <= -7.4e+106)
		tmp = t_0;
	elseif (y <= -65.0)
		tmp = x + (x * (z * -6.0));
	elseif ((y <= -5.5e-140) || ~((y <= 0.000165)))
		tmp = t_0;
	else
		tmp = x + (-6.0 * (x * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.4e+106], t$95$0, If[LessEqual[y, -65.0], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -5.5e-140], N[Not[LessEqual[y, 0.000165]], $MachinePrecision]], t$95$0, N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -5.5 \cdot 10^{-140} \lor \neg \left(y \leq 0.000165\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.3999999999999999e106 or -65 < y < -5.50000000000000026e-140 or 1.65e-4 < y

    1. Initial program 99.7%

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

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

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

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

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

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

    if -7.3999999999999999e106 < y < -65

    1. Initial program 99.9%

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

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

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

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

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

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

    if -5.50000000000000026e-140 < y < 1.65e-4

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+106}:\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;y \leq -65:\\ \;\;\;\;x + x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-140} \lor \neg \left(y \leq 0.000165\right):\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 83.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;y \leq -7.4 \cdot 10^{+106}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -500:\\ \;\;\;\;x + x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-140} \lor \neg \left(y \leq 1.1 \cdot 10^{-9}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (* 6.0 (* y z)))))
   (if (<= y -7.4e+106)
     t_0
     (if (<= y -500.0)
       (+ x (* x (* z -6.0)))
       (if (or (<= y -5e-140) (not (<= y 1.1e-9)))
         t_0
         (+ x (* -6.0 (* x z))))))))
double code(double x, double y, double z) {
	double t_0 = x + (6.0 * (y * z));
	double tmp;
	if (y <= -7.4e+106) {
		tmp = t_0;
	} else if (y <= -500.0) {
		tmp = x + (x * (z * -6.0));
	} else if ((y <= -5e-140) || !(y <= 1.1e-9)) {
		tmp = t_0;
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (6.0d0 * (y * z))
    if (y <= (-7.4d+106)) then
        tmp = t_0
    else if (y <= (-500.0d0)) then
        tmp = x + (x * (z * (-6.0d0)))
    else if ((y <= (-5d-140)) .or. (.not. (y <= 1.1d-9))) then
        tmp = t_0
    else
        tmp = x + ((-6.0d0) * (x * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (6.0 * (y * z));
	double tmp;
	if (y <= -7.4e+106) {
		tmp = t_0;
	} else if (y <= -500.0) {
		tmp = x + (x * (z * -6.0));
	} else if ((y <= -5e-140) || !(y <= 1.1e-9)) {
		tmp = t_0;
	} else {
		tmp = x + (-6.0 * (x * z));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (6.0 * (y * z))
	tmp = 0
	if y <= -7.4e+106:
		tmp = t_0
	elif y <= -500.0:
		tmp = x + (x * (z * -6.0))
	elif (y <= -5e-140) or not (y <= 1.1e-9):
		tmp = t_0
	else:
		tmp = x + (-6.0 * (x * z))
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(6.0 * Float64(y * z)))
	tmp = 0.0
	if (y <= -7.4e+106)
		tmp = t_0;
	elseif (y <= -500.0)
		tmp = Float64(x + Float64(x * Float64(z * -6.0)));
	elseif ((y <= -5e-140) || !(y <= 1.1e-9))
		tmp = t_0;
	else
		tmp = Float64(x + Float64(-6.0 * Float64(x * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (6.0 * (y * z));
	tmp = 0.0;
	if (y <= -7.4e+106)
		tmp = t_0;
	elseif (y <= -500.0)
		tmp = x + (x * (z * -6.0));
	elseif ((y <= -5e-140) || ~((y <= 1.1e-9)))
		tmp = t_0;
	else
		tmp = x + (-6.0 * (x * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.4e+106], t$95$0, If[LessEqual[y, -500.0], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -5e-140], N[Not[LessEqual[y, 1.1e-9]], $MachinePrecision]], t$95$0, N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -5 \cdot 10^{-140} \lor \neg \left(y \leq 1.1 \cdot 10^{-9}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.3999999999999999e106 or -500 < y < -5.00000000000000015e-140 or 1.0999999999999999e-9 < y

    1. Initial program 99.7%

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

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

    if -7.3999999999999999e106 < y < -500

    1. Initial program 99.9%

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

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

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

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

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

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

    if -5.00000000000000015e-140 < y < 1.0999999999999999e-9

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+106}:\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;y \leq -500:\\ \;\;\;\;x + x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-140} \lor \neg \left(y \leq 1.1 \cdot 10^{-9}\right):\\ \;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 98.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.16 \lor \neg \left(z \leq 0.166\right):\\
\;\;\;\;z \cdot \left(x \cdot -6 + y \cdot 6\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.160000000000000003 or 0.166000000000000009 < z

    1. Initial program 99.7%

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

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

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

    if -0.160000000000000003 < z < 0.166000000000000009

    1. Initial program 99.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.16 \lor \neg \left(z \leq 0.166\right):\\ \;\;\;\;z \cdot \left(x \cdot -6 + y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(6 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 60.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.166\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.170000000000000012 or 0.166000000000000009 < z

    1. Initial program 99.7%

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

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

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

    if -0.170000000000000012 < z < 0.166000000000000009

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 13: 35.7% 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. Add Preprocessing
  3. Taylor expanded in z around 0 33.3%

    \[\leadsto \color{blue}{x} \]
  4. Add Preprocessing

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 2024103 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
  :precision binary64

  :alt
  (- x (* (* 6.0 z) (- x y)))

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