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

Percentage Accurate: 99.5% → 99.8%
Time: 8.7s
Alternatives: 15
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.9× speedup?

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

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

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

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

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

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

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

Alternative 2: 73.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -1650:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-209}:\\ \;\;\;\;x \cdot \left(z \cdot 6 - 3\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-184}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+15}:\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z (- y x)))))
   (if (<= z -1650.0)
     t_0
     (if (<= z -1.2e-209)
       (* x (- (* z 6.0) 3.0))
       (if (<= z 1.8e-184)
         (* y 4.0)
         (if (<= z 7e-71)
           (* x -3.0)
           (if (<= z 5.6e+15) (* y (+ 4.0 (* -6.0 z))) t_0)))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -1650.0) {
		tmp = t_0;
	} else if (z <= -1.2e-209) {
		tmp = x * ((z * 6.0) - 3.0);
	} else if (z <= 1.8e-184) {
		tmp = y * 4.0;
	} else if (z <= 7e-71) {
		tmp = x * -3.0;
	} else if (z <= 5.6e+15) {
		tmp = y * (4.0 + (-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) :: tmp
    t_0 = (-6.0d0) * (z * (y - x))
    if (z <= (-1650.0d0)) then
        tmp = t_0
    else if (z <= (-1.2d-209)) then
        tmp = x * ((z * 6.0d0) - 3.0d0)
    else if (z <= 1.8d-184) then
        tmp = y * 4.0d0
    else if (z <= 7d-71) then
        tmp = x * (-3.0d0)
    else if (z <= 5.6d+15) then
        tmp = y * (4.0d0 + ((-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 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -1650.0) {
		tmp = t_0;
	} else if (z <= -1.2e-209) {
		tmp = x * ((z * 6.0) - 3.0);
	} else if (z <= 1.8e-184) {
		tmp = y * 4.0;
	} else if (z <= 7e-71) {
		tmp = x * -3.0;
	} else if (z <= 5.6e+15) {
		tmp = y * (4.0 + (-6.0 * z));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * (y - x))
	tmp = 0
	if z <= -1650.0:
		tmp = t_0
	elif z <= -1.2e-209:
		tmp = x * ((z * 6.0) - 3.0)
	elif z <= 1.8e-184:
		tmp = y * 4.0
	elif z <= 7e-71:
		tmp = x * -3.0
	elif z <= 5.6e+15:
		tmp = y * (4.0 + (-6.0 * z))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * Float64(y - x)))
	tmp = 0.0
	if (z <= -1650.0)
		tmp = t_0;
	elseif (z <= -1.2e-209)
		tmp = Float64(x * Float64(Float64(z * 6.0) - 3.0));
	elseif (z <= 1.8e-184)
		tmp = Float64(y * 4.0);
	elseif (z <= 7e-71)
		tmp = Float64(x * -3.0);
	elseif (z <= 5.6e+15)
		tmp = Float64(y * Float64(4.0 + Float64(-6.0 * z)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * (y - x));
	tmp = 0.0;
	if (z <= -1650.0)
		tmp = t_0;
	elseif (z <= -1.2e-209)
		tmp = x * ((z * 6.0) - 3.0);
	elseif (z <= 1.8e-184)
		tmp = y * 4.0;
	elseif (z <= 7e-71)
		tmp = x * -3.0;
	elseif (z <= 5.6e+15)
		tmp = y * (4.0 + (-6.0 * z));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1650.0], t$95$0, If[LessEqual[z, -1.2e-209], N[(x * N[(N[(z * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-184], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 7e-71], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 5.6e+15], N[(y * N[(4.0 + N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-184}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 7 \cdot 10^{-71}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 5.6 \cdot 10^{+15}:\\
\;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1650 or 5.6e15 < z

    1. Initial program 99.8%

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

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

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

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

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

    if -1650 < z < -1.2000000000000001e-209

    1. Initial program 99.4%

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

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

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

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

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

    if -1.2000000000000001e-209 < z < 1.8000000000000001e-184

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified67.0%

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

    if 1.8000000000000001e-184 < z < 6.9999999999999998e-71

    1. Initial program 99.2%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified72.1%

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

    if 6.9999999999999998e-71 < z < 5.6e15

    1. Initial program 99.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1650:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-209}:\\ \;\;\;\;x \cdot \left(z \cdot 6 - 3\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-184}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+15}:\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]

Alternative 3: 73.2% accurate, 0.9× speedup?

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

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

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

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-182}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

    if -0.0550000000000000003 < z < -1.60000000000000014e-210 or 9.4999999999999994e-182 < z < 0.5

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified65.6%

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

    if -1.60000000000000014e-210 < z < 9.4999999999999994e-182

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified67.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.055:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-210}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-182}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]

Alternative 4: 73.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6 - 3\right)\\ t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -670:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-206}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-182}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6200:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (- (* z 6.0) 3.0))) (t_1 (* -6.0 (* z (- y x)))))
   (if (<= z -670.0)
     t_1
     (if (<= z -2.6e-206)
       t_0
       (if (<= z 1.25e-182) (* y 4.0) (if (<= z 6200.0) t_0 t_1))))))
double code(double x, double y, double z) {
	double t_0 = x * ((z * 6.0) - 3.0);
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -670.0) {
		tmp = t_1;
	} else if (z <= -2.6e-206) {
		tmp = t_0;
	} else if (z <= 1.25e-182) {
		tmp = y * 4.0;
	} else if (z <= 6200.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * ((z * 6.0d0) - 3.0d0)
    t_1 = (-6.0d0) * (z * (y - x))
    if (z <= (-670.0d0)) then
        tmp = t_1
    else if (z <= (-2.6d-206)) then
        tmp = t_0
    else if (z <= 1.25d-182) then
        tmp = y * 4.0d0
    else if (z <= 6200.0d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * ((z * 6.0) - 3.0);
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -670.0) {
		tmp = t_1;
	} else if (z <= -2.6e-206) {
		tmp = t_0;
	} else if (z <= 1.25e-182) {
		tmp = y * 4.0;
	} else if (z <= 6200.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * ((z * 6.0) - 3.0)
	t_1 = -6.0 * (z * (y - x))
	tmp = 0
	if z <= -670.0:
		tmp = t_1
	elif z <= -2.6e-206:
		tmp = t_0
	elif z <= 1.25e-182:
		tmp = y * 4.0
	elif z <= 6200.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(Float64(z * 6.0) - 3.0))
	t_1 = Float64(-6.0 * Float64(z * Float64(y - x)))
	tmp = 0.0
	if (z <= -670.0)
		tmp = t_1;
	elseif (z <= -2.6e-206)
		tmp = t_0;
	elseif (z <= 1.25e-182)
		tmp = Float64(y * 4.0);
	elseif (z <= 6200.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * ((z * 6.0) - 3.0);
	t_1 = -6.0 * (z * (y - x));
	tmp = 0.0;
	if (z <= -670.0)
		tmp = t_1;
	elseif (z <= -2.6e-206)
		tmp = t_0;
	elseif (z <= 1.25e-182)
		tmp = y * 4.0;
	elseif (z <= 6200.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -670.0], t$95$1, If[LessEqual[z, -2.6e-206], t$95$0, If[LessEqual[z, 1.25e-182], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 6200.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.6 \cdot 10^{-206}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.25 \cdot 10^{-182}:\\
\;\;\;\;y \cdot 4\\

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

    if -670 < z < -2.6e-206 or 1.25000000000000006e-182 < z < 6200

    1. Initial program 99.4%

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

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

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

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

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

    if -2.6e-206 < z < 1.25000000000000006e-182

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified67.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -670:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-206}:\\ \;\;\;\;x \cdot \left(z \cdot 6 - 3\right)\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-182}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6200:\\ \;\;\;\;x \cdot \left(z \cdot 6 - 3\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]

Alternative 5: 50.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -1850:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-207}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-184}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))))
   (if (<= z -1850.0)
     t_0
     (if (<= z -3.5e-207)
       (* x -3.0)
       (if (<= z 3.8e-184) (* y 4.0) (if (<= z 6.2e-33) (* x -3.0) t_0))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -1850.0) {
		tmp = t_0;
	} else if (z <= -3.5e-207) {
		tmp = x * -3.0;
	} else if (z <= 3.8e-184) {
		tmp = y * 4.0;
	} else if (z <= 6.2e-33) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    if (z <= (-1850.0d0)) then
        tmp = t_0
    else if (z <= (-3.5d-207)) then
        tmp = x * (-3.0d0)
    else if (z <= 3.8d-184) then
        tmp = y * 4.0d0
    else if (z <= 6.2d-33) then
        tmp = x * (-3.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -1850.0) {
		tmp = t_0;
	} else if (z <= -3.5e-207) {
		tmp = x * -3.0;
	} else if (z <= 3.8e-184) {
		tmp = y * 4.0;
	} else if (z <= 6.2e-33) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	tmp = 0
	if z <= -1850.0:
		tmp = t_0
	elif z <= -3.5e-207:
		tmp = x * -3.0
	elif z <= 3.8e-184:
		tmp = y * 4.0
	elif z <= 6.2e-33:
		tmp = x * -3.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -1850.0)
		tmp = t_0;
	elseif (z <= -3.5e-207)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.8e-184)
		tmp = Float64(y * 4.0);
	elseif (z <= 6.2e-33)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -1850.0)
		tmp = t_0;
	elseif (z <= -3.5e-207)
		tmp = x * -3.0;
	elseif (z <= 3.8e-184)
		tmp = y * 4.0;
	elseif (z <= 6.2e-33)
		tmp = x * -3.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1850.0], t$95$0, If[LessEqual[z, -3.5e-207], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.8e-184], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 6.2e-33], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.5 \cdot 10^{-207}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 3.8 \cdot 10^{-184}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1850 or 6.19999999999999994e-33 < z

    1. Initial program 99.8%

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

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

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

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

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

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

    if -1850 < z < -3.5000000000000002e-207 or 3.80000000000000017e-184 < z < 6.19999999999999994e-33

    1. Initial program 99.3%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified68.3%

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

    if -3.5000000000000002e-207 < z < 3.80000000000000017e-184

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified67.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1850:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-207}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-184}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 6: 50.4% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;z \leq 2.6 \cdot 10^{-185}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\
\;\;\;\;x \cdot -3\\

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

    if -1850 < z < -1.6000000000000001e-208 or 2.59999999999999985e-185 < z < 6.19999999999999994e-33

    1. Initial program 99.3%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified68.3%

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

    if -1.6000000000000001e-208 < z < 2.59999999999999985e-185

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified67.0%

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

    if 6.19999999999999994e-33 < z

    1. Initial program 99.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1850:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-208}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-185}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 7: 50.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \left(x \cdot 6\right)\\ \mathbf{if}\;z \leq -1850:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{-209}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{-181}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (* x 6.0))))
   (if (<= z -1850.0)
     t_0
     (if (<= z -2.2e-209)
       (* x -3.0)
       (if (<= z 9.2e-181) (* y 4.0) (if (<= z 6.2e-33) (* x -3.0) t_0))))))
double code(double x, double y, double z) {
	double t_0 = z * (x * 6.0);
	double tmp;
	if (z <= -1850.0) {
		tmp = t_0;
	} else if (z <= -2.2e-209) {
		tmp = x * -3.0;
	} else if (z <= 9.2e-181) {
		tmp = y * 4.0;
	} else if (z <= 6.2e-33) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z * (x * 6.0d0)
    if (z <= (-1850.0d0)) then
        tmp = t_0
    else if (z <= (-2.2d-209)) then
        tmp = x * (-3.0d0)
    else if (z <= 9.2d-181) then
        tmp = y * 4.0d0
    else if (z <= 6.2d-33) then
        tmp = x * (-3.0d0)
    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 tmp;
	if (z <= -1850.0) {
		tmp = t_0;
	} else if (z <= -2.2e-209) {
		tmp = x * -3.0;
	} else if (z <= 9.2e-181) {
		tmp = y * 4.0;
	} else if (z <= 6.2e-33) {
		tmp = x * -3.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (x * 6.0)
	tmp = 0
	if z <= -1850.0:
		tmp = t_0
	elif z <= -2.2e-209:
		tmp = x * -3.0
	elif z <= 9.2e-181:
		tmp = y * 4.0
	elif z <= 6.2e-33:
		tmp = x * -3.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(x * 6.0))
	tmp = 0.0
	if (z <= -1850.0)
		tmp = t_0;
	elseif (z <= -2.2e-209)
		tmp = Float64(x * -3.0);
	elseif (z <= 9.2e-181)
		tmp = Float64(y * 4.0);
	elseif (z <= 6.2e-33)
		tmp = Float64(x * -3.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (x * 6.0);
	tmp = 0.0;
	if (z <= -1850.0)
		tmp = t_0;
	elseif (z <= -2.2e-209)
		tmp = x * -3.0;
	elseif (z <= 9.2e-181)
		tmp = y * 4.0;
	elseif (z <= 6.2e-33)
		tmp = x * -3.0;
	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]}, If[LessEqual[z, -1850.0], t$95$0, If[LessEqual[z, -2.2e-209], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 9.2e-181], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 6.2e-33], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.2 \cdot 10^{-209}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 9.2 \cdot 10^{-181}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1850 or 6.19999999999999994e-33 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

    if -1850 < z < -2.2000000000000001e-209 or 9.19999999999999963e-181 < z < 6.19999999999999994e-33

    1. Initial program 99.3%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified68.3%

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

    if -2.2000000000000001e-209 < z < 9.19999999999999963e-181

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified67.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1850:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{-209}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{-181}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-33}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \end{array} \]

Alternative 8: 97.7% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq 0.58:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\

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


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

    1. Initial program 99.7%

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

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

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

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

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

    if -0.57999999999999996 < z < 0.57999999999999996

    1. Initial program 99.4%

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

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

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

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

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

    if 0.57999999999999996 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

Alternative 9: 38.0% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+107} \lor \neg \left(x \leq -1.6 \cdot 10^{+71} \lor \neg \left(x \leq -2.2 \cdot 10^{+17}\right) \land x \leq 5.8 \cdot 10^{-56}\right):\\
\;\;\;\;x \cdot -3\\

\mathbf{else}:\\
\;\;\;\;y \cdot 4\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4000000000000001e107 or -1.60000000000000012e71 < x < -2.2e17 or 5.79999999999999982e-56 < x

    1. Initial program 99.6%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    7. Simplified44.4%

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

    if -2.4000000000000001e107 < x < -1.60000000000000012e71 or -2.2e17 < x < 5.79999999999999982e-56

    1. Initial program 99.4%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    7. Simplified44.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+107} \lor \neg \left(x \leq -1.6 \cdot 10^{+71} \lor \neg \left(x \leq -2.2 \cdot 10^{+17}\right) \land x \leq 5.8 \cdot 10^{-56}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]

Alternative 10: 97.7% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

    if -0.57999999999999996 < z < 0.52000000000000002

    1. Initial program 99.4%

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

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

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

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

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

Alternative 11: 97.7% accurate, 1.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\


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

    1. Initial program 99.8%

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

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

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

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

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

    if -0.599999999999999978 < z < 0.619999999999999996

    1. Initial program 99.4%

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

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

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

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

      \[\leadsto \color{blue}{-3 \cdot x + 4 \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.9%

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

Alternative 12: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 13: 99.7% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(6, \left(y - x\right) \cdot \left(0.6666666666666666 - z\right), x\right)} \]
  4. Step-by-step derivation
    1. fma-udef99.5%

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

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

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

      \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)} + x \]
  5. Applied egg-rr99.8%

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

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

Alternative 14: 26.3% accurate, 4.3× speedup?

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

\\
x \cdot -3
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot -3} \]
  7. Simplified28.9%

    \[\leadsto \color{blue}{x \cdot -3} \]
  8. Final simplification28.9%

    \[\leadsto x \cdot -3 \]

Alternative 15: 2.6% accurate, 13.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
	return x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
public static double code(double x, double y, double z) {
	return x;
}
def code(x, y, z):
	return x
function code(x, y, z)
	return x
end
function tmp = code(x, y, z)
	tmp = x;
end
code[x_, y_, z_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(0.6666666666666666 - z\right), x\right)} \]
  4. Step-by-step derivation
    1. add-cube-cbrt98.3%

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

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{{\left(\sqrt[3]{6 \cdot \left(0.6666666666666666 - z\right)}\right)}^{3}}, x\right) \]
  5. Applied egg-rr98.3%

    \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{{\left(\sqrt[3]{6 \cdot \left(0.6666666666666666 - z\right)}\right)}^{3}}, x\right) \]
  6. Taylor expanded in z around inf 2.5%

    \[\leadsto \color{blue}{x} \]
  7. Final simplification2.5%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023318 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))