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

Percentage Accurate: 99.5% → 99.7%
Time: 13.0s
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.7% 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.5%

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

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

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
  4. Add Preprocessing
  5. 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)} \]
  6. Final simplification99.8%

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

Alternative 2: 51.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -560:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-76}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{-198}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-262}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.22 \cdot 10^{-284}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-205}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.63:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+72}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))))
   (if (<= z -560.0)
     t_0
     (if (<= z -7.8e-76)
       (* y 4.0)
       (if (<= z -1.45e-136)
         (* x -3.0)
         (if (<= z -2.2e-198)
           (* y 4.0)
           (if (<= z -4.5e-262)
             (* x -3.0)
             (if (<= z -1.22e-284)
               (* y 4.0)
               (if (<= z 4.2e-205)
                 (* x -3.0)
                 (if (<= z 0.63)
                   (* y 4.0)
                   (if (<= z 1.05e+72) t_0 (* -6.0 (* z y)))))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -560.0) {
		tmp = t_0;
	} else if (z <= -7.8e-76) {
		tmp = y * 4.0;
	} else if (z <= -1.45e-136) {
		tmp = x * -3.0;
	} else if (z <= -2.2e-198) {
		tmp = y * 4.0;
	} else if (z <= -4.5e-262) {
		tmp = x * -3.0;
	} else if (z <= -1.22e-284) {
		tmp = y * 4.0;
	} else if (z <= 4.2e-205) {
		tmp = x * -3.0;
	} else if (z <= 0.63) {
		tmp = y * 4.0;
	} else if (z <= 1.05e+72) {
		tmp = t_0;
	} else {
		tmp = -6.0 * (z * y);
	}
	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 <= (-560.0d0)) then
        tmp = t_0
    else if (z <= (-7.8d-76)) then
        tmp = y * 4.0d0
    else if (z <= (-1.45d-136)) then
        tmp = x * (-3.0d0)
    else if (z <= (-2.2d-198)) then
        tmp = y * 4.0d0
    else if (z <= (-4.5d-262)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.22d-284)) then
        tmp = y * 4.0d0
    else if (z <= 4.2d-205) then
        tmp = x * (-3.0d0)
    else if (z <= 0.63d0) then
        tmp = y * 4.0d0
    else if (z <= 1.05d+72) then
        tmp = t_0
    else
        tmp = (-6.0d0) * (z * y)
    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 <= -560.0) {
		tmp = t_0;
	} else if (z <= -7.8e-76) {
		tmp = y * 4.0;
	} else if (z <= -1.45e-136) {
		tmp = x * -3.0;
	} else if (z <= -2.2e-198) {
		tmp = y * 4.0;
	} else if (z <= -4.5e-262) {
		tmp = x * -3.0;
	} else if (z <= -1.22e-284) {
		tmp = y * 4.0;
	} else if (z <= 4.2e-205) {
		tmp = x * -3.0;
	} else if (z <= 0.63) {
		tmp = y * 4.0;
	} else if (z <= 1.05e+72) {
		tmp = t_0;
	} else {
		tmp = -6.0 * (z * y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	tmp = 0
	if z <= -560.0:
		tmp = t_0
	elif z <= -7.8e-76:
		tmp = y * 4.0
	elif z <= -1.45e-136:
		tmp = x * -3.0
	elif z <= -2.2e-198:
		tmp = y * 4.0
	elif z <= -4.5e-262:
		tmp = x * -3.0
	elif z <= -1.22e-284:
		tmp = y * 4.0
	elif z <= 4.2e-205:
		tmp = x * -3.0
	elif z <= 0.63:
		tmp = y * 4.0
	elif z <= 1.05e+72:
		tmp = t_0
	else:
		tmp = -6.0 * (z * y)
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -560.0)
		tmp = t_0;
	elseif (z <= -7.8e-76)
		tmp = Float64(y * 4.0);
	elseif (z <= -1.45e-136)
		tmp = Float64(x * -3.0);
	elseif (z <= -2.2e-198)
		tmp = Float64(y * 4.0);
	elseif (z <= -4.5e-262)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.22e-284)
		tmp = Float64(y * 4.0);
	elseif (z <= 4.2e-205)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.63)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.05e+72)
		tmp = t_0;
	else
		tmp = Float64(-6.0 * Float64(z * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -560.0)
		tmp = t_0;
	elseif (z <= -7.8e-76)
		tmp = y * 4.0;
	elseif (z <= -1.45e-136)
		tmp = x * -3.0;
	elseif (z <= -2.2e-198)
		tmp = y * 4.0;
	elseif (z <= -4.5e-262)
		tmp = x * -3.0;
	elseif (z <= -1.22e-284)
		tmp = y * 4.0;
	elseif (z <= 4.2e-205)
		tmp = x * -3.0;
	elseif (z <= 0.63)
		tmp = y * 4.0;
	elseif (z <= 1.05e+72)
		tmp = t_0;
	else
		tmp = -6.0 * (z * y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -560.0], t$95$0, If[LessEqual[z, -7.8e-76], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1.45e-136], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -2.2e-198], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -4.5e-262], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.22e-284], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.2e-205], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.63], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.05e+72], t$95$0, N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -7.8 \cdot 10^{-76}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -1.45 \cdot 10^{-136}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -2.2 \cdot 10^{-198}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -4.5 \cdot 10^{-262}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -1.22 \cdot 10^{-284}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{-205}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.63:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{+72}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -560 or 0.630000000000000004 < z < 1.0500000000000001e72

    1. Initial program 99.5%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval61.3%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv61.3%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv61.3%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in61.3%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in61.3%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg61.3%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in61.3%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval61.3%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-161.3%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative61.3%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+61.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval61.3%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*61.3%

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

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

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

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

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

    if -560 < z < -7.8000000000000005e-76 or -1.44999999999999997e-136 < z < -2.2e-198 or -4.49999999999999998e-262 < z < -1.22e-284 or 4.19999999999999965e-205 < z < 0.630000000000000004

    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. Add Preprocessing
    5. Taylor expanded in y around inf 66.8%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified63.5%

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

    if -7.8000000000000005e-76 < z < -1.44999999999999997e-136 or -2.2e-198 < z < -4.49999999999999998e-262 or -1.22e-284 < z < 4.19999999999999965e-205

    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. Add Preprocessing
    5. Taylor expanded in x around inf 70.6%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv70.6%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv70.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg70.6%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-170.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+70.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval70.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*70.6%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified70.6%

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

    if 1.0500000000000001e72 < z

    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. Add Preprocessing
    5. Taylor expanded in y around inf 72.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -560:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-76}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{-198}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-262}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.22 \cdot 10^{-284}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-205}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.63:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+72}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 51.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -275:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{-131}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -4.9 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-263}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-279}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.54:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+71}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))))
   (if (<= z -275.0)
     t_0
     (if (<= z -3.4e-68)
       (* y 4.0)
       (if (<= z -1.85e-131)
         (* x -3.0)
         (if (<= z -4.9e-197)
           (* y 4.0)
           (if (<= z -5.8e-263)
             (* x -3.0)
             (if (<= z -1.3e-279)
               (* y 4.0)
               (if (<= z 3.2e-206)
                 (* x -3.0)
                 (if (<= z 0.54)
                   (* y 4.0)
                   (if (<= z 7.5e+71) t_0 (* y (* -6.0 z)))))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -275.0) {
		tmp = t_0;
	} else if (z <= -3.4e-68) {
		tmp = y * 4.0;
	} else if (z <= -1.85e-131) {
		tmp = x * -3.0;
	} else if (z <= -4.9e-197) {
		tmp = y * 4.0;
	} else if (z <= -5.8e-263) {
		tmp = x * -3.0;
	} else if (z <= -1.3e-279) {
		tmp = y * 4.0;
	} else if (z <= 3.2e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.54) {
		tmp = y * 4.0;
	} else if (z <= 7.5e+71) {
		tmp = t_0;
	} else {
		tmp = 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) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    if (z <= (-275.0d0)) then
        tmp = t_0
    else if (z <= (-3.4d-68)) then
        tmp = y * 4.0d0
    else if (z <= (-1.85d-131)) then
        tmp = x * (-3.0d0)
    else if (z <= (-4.9d-197)) then
        tmp = y * 4.0d0
    else if (z <= (-5.8d-263)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.3d-279)) then
        tmp = y * 4.0d0
    else if (z <= 3.2d-206) then
        tmp = x * (-3.0d0)
    else if (z <= 0.54d0) then
        tmp = y * 4.0d0
    else if (z <= 7.5d+71) then
        tmp = t_0
    else
        tmp = y * ((-6.0d0) * z)
    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 <= -275.0) {
		tmp = t_0;
	} else if (z <= -3.4e-68) {
		tmp = y * 4.0;
	} else if (z <= -1.85e-131) {
		tmp = x * -3.0;
	} else if (z <= -4.9e-197) {
		tmp = y * 4.0;
	} else if (z <= -5.8e-263) {
		tmp = x * -3.0;
	} else if (z <= -1.3e-279) {
		tmp = y * 4.0;
	} else if (z <= 3.2e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.54) {
		tmp = y * 4.0;
	} else if (z <= 7.5e+71) {
		tmp = t_0;
	} else {
		tmp = y * (-6.0 * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	tmp = 0
	if z <= -275.0:
		tmp = t_0
	elif z <= -3.4e-68:
		tmp = y * 4.0
	elif z <= -1.85e-131:
		tmp = x * -3.0
	elif z <= -4.9e-197:
		tmp = y * 4.0
	elif z <= -5.8e-263:
		tmp = x * -3.0
	elif z <= -1.3e-279:
		tmp = y * 4.0
	elif z <= 3.2e-206:
		tmp = x * -3.0
	elif z <= 0.54:
		tmp = y * 4.0
	elif z <= 7.5e+71:
		tmp = t_0
	else:
		tmp = y * (-6.0 * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	tmp = 0.0
	if (z <= -275.0)
		tmp = t_0;
	elseif (z <= -3.4e-68)
		tmp = Float64(y * 4.0);
	elseif (z <= -1.85e-131)
		tmp = Float64(x * -3.0);
	elseif (z <= -4.9e-197)
		tmp = Float64(y * 4.0);
	elseif (z <= -5.8e-263)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.3e-279)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.2e-206)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.54)
		tmp = Float64(y * 4.0);
	elseif (z <= 7.5e+71)
		tmp = t_0;
	else
		tmp = Float64(y * Float64(-6.0 * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -275.0)
		tmp = t_0;
	elseif (z <= -3.4e-68)
		tmp = y * 4.0;
	elseif (z <= -1.85e-131)
		tmp = x * -3.0;
	elseif (z <= -4.9e-197)
		tmp = y * 4.0;
	elseif (z <= -5.8e-263)
		tmp = x * -3.0;
	elseif (z <= -1.3e-279)
		tmp = y * 4.0;
	elseif (z <= 3.2e-206)
		tmp = x * -3.0;
	elseif (z <= 0.54)
		tmp = y * 4.0;
	elseif (z <= 7.5e+71)
		tmp = t_0;
	else
		tmp = y * (-6.0 * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -275.0], t$95$0, If[LessEqual[z, -3.4e-68], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1.85e-131], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -4.9e-197], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -5.8e-263], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.3e-279], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.2e-206], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.54], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 7.5e+71], t$95$0, N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.4 \cdot 10^{-68}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -1.85 \cdot 10^{-131}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -4.9 \cdot 10^{-197}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -5.8 \cdot 10^{-263}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -1.3 \cdot 10^{-279}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{-206}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.54:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 7.5 \cdot 10^{+71}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -275 or 0.54000000000000004 < z < 7.50000000000000007e71

    1. Initial program 99.5%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval61.3%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv61.3%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv61.3%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in61.3%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in61.3%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg61.3%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in61.3%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval61.3%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-161.3%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative61.3%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+61.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval61.3%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*61.3%

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

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

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

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

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

    if -275 < z < -3.40000000000000018e-68 or -1.8500000000000001e-131 < z < -4.9000000000000002e-197 or -5.80000000000000007e-263 < z < -1.3000000000000001e-279 or 3.19999999999999976e-206 < z < 0.54000000000000004

    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. Add Preprocessing
    5. Taylor expanded in y around inf 66.8%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified63.5%

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

    if -3.40000000000000018e-68 < z < -1.8500000000000001e-131 or -4.9000000000000002e-197 < z < -5.80000000000000007e-263 or -1.3000000000000001e-279 < z < 3.19999999999999976e-206

    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. Add Preprocessing
    5. Taylor expanded in x around inf 70.6%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv70.6%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv70.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg70.6%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-170.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+70.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval70.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*70.6%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified70.6%

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

    if 7.50000000000000007e71 < z

    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. Add Preprocessing
    5. Taylor expanded in y around inf 72.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -275:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-68}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{-131}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -4.9 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-263}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-279}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.54:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+71}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 51.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -310:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-73}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-135}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-264}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-275}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{-204}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+72}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -310.0)
   (* 6.0 (* x z))
   (if (<= z -9.2e-73)
     (* y 4.0)
     (if (<= z -2.5e-135)
       (* x -3.0)
       (if (<= z -1.1e-197)
         (* y 4.0)
         (if (<= z -3e-264)
           (* x -3.0)
           (if (<= z -2.8e-275)
             (* y 4.0)
             (if (<= z 9.6e-204)
               (* x -3.0)
               (if (<= z 0.6)
                 (* y 4.0)
                 (if (<= z 6e+72) (* z (* x 6.0)) (* y (* -6.0 z))))))))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -310.0) {
		tmp = 6.0 * (x * z);
	} else if (z <= -9.2e-73) {
		tmp = y * 4.0;
	} else if (z <= -2.5e-135) {
		tmp = x * -3.0;
	} else if (z <= -1.1e-197) {
		tmp = y * 4.0;
	} else if (z <= -3e-264) {
		tmp = x * -3.0;
	} else if (z <= -2.8e-275) {
		tmp = y * 4.0;
	} else if (z <= 9.6e-204) {
		tmp = x * -3.0;
	} else if (z <= 0.6) {
		tmp = y * 4.0;
	} else if (z <= 6e+72) {
		tmp = z * (x * 6.0);
	} else {
		tmp = 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 <= (-310.0d0)) then
        tmp = 6.0d0 * (x * z)
    else if (z <= (-9.2d-73)) then
        tmp = y * 4.0d0
    else if (z <= (-2.5d-135)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.1d-197)) then
        tmp = y * 4.0d0
    else if (z <= (-3d-264)) then
        tmp = x * (-3.0d0)
    else if (z <= (-2.8d-275)) then
        tmp = y * 4.0d0
    else if (z <= 9.6d-204) then
        tmp = x * (-3.0d0)
    else if (z <= 0.6d0) then
        tmp = y * 4.0d0
    else if (z <= 6d+72) then
        tmp = z * (x * 6.0d0)
    else
        tmp = y * ((-6.0d0) * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -310.0) {
		tmp = 6.0 * (x * z);
	} else if (z <= -9.2e-73) {
		tmp = y * 4.0;
	} else if (z <= -2.5e-135) {
		tmp = x * -3.0;
	} else if (z <= -1.1e-197) {
		tmp = y * 4.0;
	} else if (z <= -3e-264) {
		tmp = x * -3.0;
	} else if (z <= -2.8e-275) {
		tmp = y * 4.0;
	} else if (z <= 9.6e-204) {
		tmp = x * -3.0;
	} else if (z <= 0.6) {
		tmp = y * 4.0;
	} else if (z <= 6e+72) {
		tmp = z * (x * 6.0);
	} else {
		tmp = y * (-6.0 * z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -310.0:
		tmp = 6.0 * (x * z)
	elif z <= -9.2e-73:
		tmp = y * 4.0
	elif z <= -2.5e-135:
		tmp = x * -3.0
	elif z <= -1.1e-197:
		tmp = y * 4.0
	elif z <= -3e-264:
		tmp = x * -3.0
	elif z <= -2.8e-275:
		tmp = y * 4.0
	elif z <= 9.6e-204:
		tmp = x * -3.0
	elif z <= 0.6:
		tmp = y * 4.0
	elif z <= 6e+72:
		tmp = z * (x * 6.0)
	else:
		tmp = y * (-6.0 * z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -310.0)
		tmp = Float64(6.0 * Float64(x * z));
	elseif (z <= -9.2e-73)
		tmp = Float64(y * 4.0);
	elseif (z <= -2.5e-135)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.1e-197)
		tmp = Float64(y * 4.0);
	elseif (z <= -3e-264)
		tmp = Float64(x * -3.0);
	elseif (z <= -2.8e-275)
		tmp = Float64(y * 4.0);
	elseif (z <= 9.6e-204)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.6)
		tmp = Float64(y * 4.0);
	elseif (z <= 6e+72)
		tmp = Float64(z * Float64(x * 6.0));
	else
		tmp = Float64(y * Float64(-6.0 * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -310.0)
		tmp = 6.0 * (x * z);
	elseif (z <= -9.2e-73)
		tmp = y * 4.0;
	elseif (z <= -2.5e-135)
		tmp = x * -3.0;
	elseif (z <= -1.1e-197)
		tmp = y * 4.0;
	elseif (z <= -3e-264)
		tmp = x * -3.0;
	elseif (z <= -2.8e-275)
		tmp = y * 4.0;
	elseif (z <= 9.6e-204)
		tmp = x * -3.0;
	elseif (z <= 0.6)
		tmp = y * 4.0;
	elseif (z <= 6e+72)
		tmp = z * (x * 6.0);
	else
		tmp = y * (-6.0 * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -310.0], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.2e-73], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -2.5e-135], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.1e-197], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -3e-264], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -2.8e-275], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 9.6e-204], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.6], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 6e+72], N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -2.5 \cdot 10^{-135}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -1.1 \cdot 10^{-197}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq -2.8 \cdot 10^{-275}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq 9.6 \cdot 10^{-204}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.6:\\
\;\;\;\;y \cdot 4\\

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

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


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

    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. Add Preprocessing
    5. Taylor expanded in x around inf 56.2%

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    6. Step-by-step derivation
      1. metadata-eval56.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv56.2%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv56.2%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in56.2%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in56.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval56.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg56.2%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in56.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval56.2%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-156.2%

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

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+56.2%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval56.2%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*56.2%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      19. metadata-eval56.2%

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

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

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

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

    if -310 < z < -9.19999999999999953e-73 or -2.5000000000000001e-135 < z < -1.1e-197 or -3e-264 < z < -2.79999999999999994e-275 or 9.6e-204 < z < 0.599999999999999978

    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. Add Preprocessing
    5. Taylor expanded in y around inf 66.8%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified63.5%

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

    if -9.19999999999999953e-73 < z < -2.5000000000000001e-135 or -1.1e-197 < z < -3e-264 or -2.79999999999999994e-275 < z < 9.6e-204

    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. Add Preprocessing
    5. Taylor expanded in x around inf 70.6%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv70.6%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv70.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg70.6%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-170.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+70.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval70.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*70.6%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified70.6%

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

    if 0.599999999999999978 < z < 6.00000000000000006e72

    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. Add Preprocessing
    5. Taylor expanded in x around inf 74.7%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv74.7%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv74.7%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in74.7%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in74.7%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval74.7%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg74.7%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in74.7%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval74.7%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-174.7%

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

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+74.7%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval74.7%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*74.7%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      19. metadata-eval74.7%

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

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

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

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\left(6 \cdot x\right)} \]
    11. Simplified61.4%

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

    if 6.00000000000000006e72 < z

    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. Add Preprocessing
    5. Taylor expanded in y around inf 72.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -310:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-73}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-135}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-264}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-275}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{-204}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+72}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -0.062:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-76}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-133}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.96 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.05 \cdot 10^{-262}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-279}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.63:\\ \;\;\;\;y \cdot 4\\ \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.062)
     t_0
     (if (<= z -3.4e-76)
       (* y 4.0)
       (if (<= z -4.5e-133)
         (* x -3.0)
         (if (<= z -1.96e-197)
           (* y 4.0)
           (if (<= z -2.05e-262)
             (* x -3.0)
             (if (<= z -4e-279)
               (* y 4.0)
               (if (<= z 9.5e-206)
                 (* x -3.0)
                 (if (<= z 0.63) (* y 4.0) t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -0.062) {
		tmp = t_0;
	} else if (z <= -3.4e-76) {
		tmp = y * 4.0;
	} else if (z <= -4.5e-133) {
		tmp = x * -3.0;
	} else if (z <= -1.96e-197) {
		tmp = y * 4.0;
	} else if (z <= -2.05e-262) {
		tmp = x * -3.0;
	} else if (z <= -4e-279) {
		tmp = y * 4.0;
	} else if (z <= 9.5e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.63) {
		tmp = y * 4.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.062d0)) then
        tmp = t_0
    else if (z <= (-3.4d-76)) then
        tmp = y * 4.0d0
    else if (z <= (-4.5d-133)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.96d-197)) then
        tmp = y * 4.0d0
    else if (z <= (-2.05d-262)) then
        tmp = x * (-3.0d0)
    else if (z <= (-4d-279)) then
        tmp = y * 4.0d0
    else if (z <= 9.5d-206) then
        tmp = x * (-3.0d0)
    else if (z <= 0.63d0) then
        tmp = y * 4.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.062) {
		tmp = t_0;
	} else if (z <= -3.4e-76) {
		tmp = y * 4.0;
	} else if (z <= -4.5e-133) {
		tmp = x * -3.0;
	} else if (z <= -1.96e-197) {
		tmp = y * 4.0;
	} else if (z <= -2.05e-262) {
		tmp = x * -3.0;
	} else if (z <= -4e-279) {
		tmp = y * 4.0;
	} else if (z <= 9.5e-206) {
		tmp = x * -3.0;
	} else if (z <= 0.63) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * (y - x))
	tmp = 0
	if z <= -0.062:
		tmp = t_0
	elif z <= -3.4e-76:
		tmp = y * 4.0
	elif z <= -4.5e-133:
		tmp = x * -3.0
	elif z <= -1.96e-197:
		tmp = y * 4.0
	elif z <= -2.05e-262:
		tmp = x * -3.0
	elif z <= -4e-279:
		tmp = y * 4.0
	elif z <= 9.5e-206:
		tmp = x * -3.0
	elif z <= 0.63:
		tmp = y * 4.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.062)
		tmp = t_0;
	elseif (z <= -3.4e-76)
		tmp = Float64(y * 4.0);
	elseif (z <= -4.5e-133)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.96e-197)
		tmp = Float64(y * 4.0);
	elseif (z <= -2.05e-262)
		tmp = Float64(x * -3.0);
	elseif (z <= -4e-279)
		tmp = Float64(y * 4.0);
	elseif (z <= 9.5e-206)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.63)
		tmp = Float64(y * 4.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.062)
		tmp = t_0;
	elseif (z <= -3.4e-76)
		tmp = y * 4.0;
	elseif (z <= -4.5e-133)
		tmp = x * -3.0;
	elseif (z <= -1.96e-197)
		tmp = y * 4.0;
	elseif (z <= -2.05e-262)
		tmp = x * -3.0;
	elseif (z <= -4e-279)
		tmp = y * 4.0;
	elseif (z <= 9.5e-206)
		tmp = x * -3.0;
	elseif (z <= 0.63)
		tmp = y * 4.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.062], t$95$0, If[LessEqual[z, -3.4e-76], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -4.5e-133], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.96e-197], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -2.05e-262], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -4e-279], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 9.5e-206], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.63], N[(y * 4.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.062:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -3.4 \cdot 10^{-76}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -4.5 \cdot 10^{-133}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -1.96 \cdot 10^{-197}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -2.05 \cdot 10^{-262}:\\
\;\;\;\;x \cdot -3\\

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

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-206}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq 0.63:\\
\;\;\;\;y \cdot 4\\

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


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

    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. Add Preprocessing
    5. 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)} \]
    6. Taylor expanded in z around inf 94.8%

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

    if -0.062 < z < -3.3999999999999999e-76 or -4.50000000000000009e-133 < z < -1.9600000000000001e-197 or -2.05000000000000013e-262 < z < -4.00000000000000022e-279 or 9.49999999999999979e-206 < z < 0.630000000000000004

    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. Add Preprocessing
    5. Taylor expanded in y around inf 65.8%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified65.0%

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

    if -3.3999999999999999e-76 < z < -4.50000000000000009e-133 or -1.9600000000000001e-197 < z < -2.05000000000000013e-262 or -4.00000000000000022e-279 < z < 9.49999999999999979e-206

    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. Add Preprocessing
    5. Taylor expanded in x around inf 70.6%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv70.6%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv70.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg70.6%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-170.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+70.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval70.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*70.6%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified70.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.062:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-76}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-133}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.96 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.05 \cdot 10^{-262}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-279}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-206}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.63:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -4800:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-69}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-131}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-262}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-284}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-205}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.63:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* y (- 0.6666666666666666 z))))
        (t_1 (* -6.0 (* z (- y x)))))
   (if (<= z -4800.0)
     t_1
     (if (<= z -2.5e-69)
       t_0
       (if (<= z -1.3e-131)
         (* x -3.0)
         (if (<= z -2.5e-197)
           (* y 4.0)
           (if (<= z -2.45e-262)
             (* x -3.0)
             (if (<= z -1.9e-284)
               (* y 4.0)
               (if (<= z 3.6e-205) (* x -3.0) (if (<= z 0.63) t_0 t_1))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -4800.0) {
		tmp = t_1;
	} else if (z <= -2.5e-69) {
		tmp = t_0;
	} else if (z <= -1.3e-131) {
		tmp = x * -3.0;
	} else if (z <= -2.5e-197) {
		tmp = y * 4.0;
	} else if (z <= -2.45e-262) {
		tmp = x * -3.0;
	} else if (z <= -1.9e-284) {
		tmp = y * 4.0;
	} else if (z <= 3.6e-205) {
		tmp = x * -3.0;
	} else if (z <= 0.63) {
		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 = 6.0d0 * (y * (0.6666666666666666d0 - z))
    t_1 = (-6.0d0) * (z * (y - x))
    if (z <= (-4800.0d0)) then
        tmp = t_1
    else if (z <= (-2.5d-69)) then
        tmp = t_0
    else if (z <= (-1.3d-131)) then
        tmp = x * (-3.0d0)
    else if (z <= (-2.5d-197)) then
        tmp = y * 4.0d0
    else if (z <= (-2.45d-262)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.9d-284)) then
        tmp = y * 4.0d0
    else if (z <= 3.6d-205) then
        tmp = x * (-3.0d0)
    else if (z <= 0.63d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (y * (0.6666666666666666 - z));
	double t_1 = -6.0 * (z * (y - x));
	double tmp;
	if (z <= -4800.0) {
		tmp = t_1;
	} else if (z <= -2.5e-69) {
		tmp = t_0;
	} else if (z <= -1.3e-131) {
		tmp = x * -3.0;
	} else if (z <= -2.5e-197) {
		tmp = y * 4.0;
	} else if (z <= -2.45e-262) {
		tmp = x * -3.0;
	} else if (z <= -1.9e-284) {
		tmp = y * 4.0;
	} else if (z <= 3.6e-205) {
		tmp = x * -3.0;
	} else if (z <= 0.63) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (y * (0.6666666666666666 - z))
	t_1 = -6.0 * (z * (y - x))
	tmp = 0
	if z <= -4800.0:
		tmp = t_1
	elif z <= -2.5e-69:
		tmp = t_0
	elif z <= -1.3e-131:
		tmp = x * -3.0
	elif z <= -2.5e-197:
		tmp = y * 4.0
	elif z <= -2.45e-262:
		tmp = x * -3.0
	elif z <= -1.9e-284:
		tmp = y * 4.0
	elif z <= 3.6e-205:
		tmp = x * -3.0
	elif z <= 0.63:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)))
	t_1 = Float64(-6.0 * Float64(z * Float64(y - x)))
	tmp = 0.0
	if (z <= -4800.0)
		tmp = t_1;
	elseif (z <= -2.5e-69)
		tmp = t_0;
	elseif (z <= -1.3e-131)
		tmp = Float64(x * -3.0);
	elseif (z <= -2.5e-197)
		tmp = Float64(y * 4.0);
	elseif (z <= -2.45e-262)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.9e-284)
		tmp = Float64(y * 4.0);
	elseif (z <= 3.6e-205)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.63)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (y * (0.6666666666666666 - z));
	t_1 = -6.0 * (z * (y - x));
	tmp = 0.0;
	if (z <= -4800.0)
		tmp = t_1;
	elseif (z <= -2.5e-69)
		tmp = t_0;
	elseif (z <= -1.3e-131)
		tmp = x * -3.0;
	elseif (z <= -2.5e-197)
		tmp = y * 4.0;
	elseif (z <= -2.45e-262)
		tmp = x * -3.0;
	elseif (z <= -1.9e-284)
		tmp = y * 4.0;
	elseif (z <= 3.6e-205)
		tmp = x * -3.0;
	elseif (z <= 0.63)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4800.0], t$95$1, If[LessEqual[z, -2.5e-69], t$95$0, If[LessEqual[z, -1.3e-131], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -2.5e-197], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -2.45e-262], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.9e-284], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.6e-205], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.63], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.5 \cdot 10^{-69}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -1.3 \cdot 10^{-131}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -2.5 \cdot 10^{-197}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -2.45 \cdot 10^{-262}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -1.9 \cdot 10^{-284}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 0.63:\\
\;\;\;\;t\_0\\

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


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

    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. Add Preprocessing
    5. 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)} \]
    6. Taylor expanded in z around inf 95.8%

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

    if -4800 < z < -2.50000000000000017e-69 or 3.5999999999999998e-205 < z < 0.630000000000000004

    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. Add Preprocessing
    5. Taylor expanded in y around inf 63.0%

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

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

    if -2.50000000000000017e-69 < z < -1.29999999999999998e-131 or -2.5000000000000001e-197 < z < -2.4500000000000001e-262 or -1.8999999999999999e-284 < z < 3.5999999999999998e-205

    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. Add Preprocessing
    5. Taylor expanded in x around inf 70.6%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv70.6%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv70.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg70.6%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-170.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+70.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval70.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*70.6%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified70.6%

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

    if -1.29999999999999998e-131 < z < -2.5000000000000001e-197 or -2.4500000000000001e-262 < z < -1.8999999999999999e-284

    1. Initial program 99.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified78.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4800:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-69}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-131}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-197}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-262}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-284}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-205}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.63:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 50.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -0.65:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-66}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-133}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -6.7 \cdot 10^{-198}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-265}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.46 \cdot 10^{-276}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-203}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 14.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z y))))
   (if (<= z -0.65)
     t_0
     (if (<= z -2.5e-66)
       (* y 4.0)
       (if (<= z -5.5e-133)
         (* x -3.0)
         (if (<= z -6.7e-198)
           (* y 4.0)
           (if (<= z -8e-265)
             (* x -3.0)
             (if (<= z -1.46e-276)
               (* y 4.0)
               (if (<= z 2.2e-203)
                 (* x -3.0)
                 (if (<= z 14.5) (* y 4.0) t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * y);
	double tmp;
	if (z <= -0.65) {
		tmp = t_0;
	} else if (z <= -2.5e-66) {
		tmp = y * 4.0;
	} else if (z <= -5.5e-133) {
		tmp = x * -3.0;
	} else if (z <= -6.7e-198) {
		tmp = y * 4.0;
	} else if (z <= -8e-265) {
		tmp = x * -3.0;
	} else if (z <= -1.46e-276) {
		tmp = y * 4.0;
	} else if (z <= 2.2e-203) {
		tmp = x * -3.0;
	} else if (z <= 14.5) {
		tmp = y * 4.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)
    if (z <= (-0.65d0)) then
        tmp = t_0
    else if (z <= (-2.5d-66)) then
        tmp = y * 4.0d0
    else if (z <= (-5.5d-133)) then
        tmp = x * (-3.0d0)
    else if (z <= (-6.7d-198)) then
        tmp = y * 4.0d0
    else if (z <= (-8d-265)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.46d-276)) then
        tmp = y * 4.0d0
    else if (z <= 2.2d-203) then
        tmp = x * (-3.0d0)
    else if (z <= 14.5d0) then
        tmp = y * 4.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);
	double tmp;
	if (z <= -0.65) {
		tmp = t_0;
	} else if (z <= -2.5e-66) {
		tmp = y * 4.0;
	} else if (z <= -5.5e-133) {
		tmp = x * -3.0;
	} else if (z <= -6.7e-198) {
		tmp = y * 4.0;
	} else if (z <= -8e-265) {
		tmp = x * -3.0;
	} else if (z <= -1.46e-276) {
		tmp = y * 4.0;
	} else if (z <= 2.2e-203) {
		tmp = x * -3.0;
	} else if (z <= 14.5) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * y)
	tmp = 0
	if z <= -0.65:
		tmp = t_0
	elif z <= -2.5e-66:
		tmp = y * 4.0
	elif z <= -5.5e-133:
		tmp = x * -3.0
	elif z <= -6.7e-198:
		tmp = y * 4.0
	elif z <= -8e-265:
		tmp = x * -3.0
	elif z <= -1.46e-276:
		tmp = y * 4.0
	elif z <= 2.2e-203:
		tmp = x * -3.0
	elif z <= 14.5:
		tmp = y * 4.0
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -0.65)
		tmp = t_0;
	elseif (z <= -2.5e-66)
		tmp = Float64(y * 4.0);
	elseif (z <= -5.5e-133)
		tmp = Float64(x * -3.0);
	elseif (z <= -6.7e-198)
		tmp = Float64(y * 4.0);
	elseif (z <= -8e-265)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.46e-276)
		tmp = Float64(y * 4.0);
	elseif (z <= 2.2e-203)
		tmp = Float64(x * -3.0);
	elseif (z <= 14.5)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * y);
	tmp = 0.0;
	if (z <= -0.65)
		tmp = t_0;
	elseif (z <= -2.5e-66)
		tmp = y * 4.0;
	elseif (z <= -5.5e-133)
		tmp = x * -3.0;
	elseif (z <= -6.7e-198)
		tmp = y * 4.0;
	elseif (z <= -8e-265)
		tmp = x * -3.0;
	elseif (z <= -1.46e-276)
		tmp = y * 4.0;
	elseif (z <= 2.2e-203)
		tmp = x * -3.0;
	elseif (z <= 14.5)
		tmp = y * 4.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.65], t$95$0, If[LessEqual[z, -2.5e-66], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -5.5e-133], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -6.7e-198], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -8e-265], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.46e-276], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 2.2e-203], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 14.5], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.5 \cdot 10^{-66}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -5.5 \cdot 10^{-133}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -6.7 \cdot 10^{-198}:\\
\;\;\;\;y \cdot 4\\

\mathbf{elif}\;z \leq -8 \cdot 10^{-265}:\\
\;\;\;\;x \cdot -3\\

\mathbf{elif}\;z \leq -1.46 \cdot 10^{-276}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 14.5:\\
\;\;\;\;y \cdot 4\\

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


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

    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. Add Preprocessing
    5. Taylor expanded in y around inf 55.9%

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

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

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

    if -0.650000000000000022 < z < -2.49999999999999981e-66 or -5.49999999999999977e-133 < z < -6.69999999999999982e-198 or -7.99999999999999988e-265 < z < -1.45999999999999994e-276 or 2.2e-203 < z < 14.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. Add Preprocessing
    5. Taylor expanded in y around inf 64.4%

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

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

      \[\leadsto \color{blue}{4 \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative63.2%

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified63.2%

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

    if -2.49999999999999981e-66 < z < -5.49999999999999977e-133 or -6.69999999999999982e-198 < z < -7.99999999999999988e-265 or -1.45999999999999994e-276 < z < 2.2e-203

    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. Add Preprocessing
    5. Taylor expanded in x around inf 70.6%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv70.6%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv70.6%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg70.6%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in70.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval70.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-170.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative70.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+70.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval70.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*70.6%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified70.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.65:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-66}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-133}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -6.7 \cdot 10^{-198}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-265}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.46 \cdot 10^{-276}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-203}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 14.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 75.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+77} \lor \neg \left(x \leq 0.3\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8000000000000003e77 or 0.299999999999999989 < x

    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. Add Preprocessing
    5. Taylor expanded in x around inf 84.5%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv84.5%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv84.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative84.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in84.5%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg84.5%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in84.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval84.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-184.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative84.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+84.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval84.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*84.6%

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

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

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

    if -5.8000000000000003e77 < x < 0.299999999999999989

    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. Add Preprocessing
    5. Taylor expanded in y around inf 75.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{+77} \lor \neg \left(x \leq 0.3\right):\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 75.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+77} \lor \neg \left(x \leq 13.8\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.8000000000000001e77 or 13.800000000000001 < x

    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. Add Preprocessing
    5. Taylor expanded in x around inf 84.5%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv84.5%

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv84.5%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in84.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative84.5%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in84.5%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg84.5%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in84.6%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval84.6%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-184.6%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative84.6%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+84.6%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval84.6%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*84.6%

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

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

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

    if -3.8000000000000001e77 < x < 13.800000000000001

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

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

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. distribute-rgt-in99.8%

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4} + \left(-z\right) \cdot 6, x\right) \]
      8. distribute-lft-neg-out99.8%

        \[\leadsto \mathsf{fma}\left(y - x, 4 + \color{blue}{\left(-z \cdot 6\right)}, x\right) \]
      9. distribute-rgt-neg-in99.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{+77} \lor \neg \left(x \leq 13.8\right):\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 97.9% accurate, 0.8× 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.52:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;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.52) (+ x (* (- y x) 4.0)) (* 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.52) {
		tmp = x + ((y - x) * 4.0);
	} else {
		tmp = 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.52d0) then
        tmp = x + ((y - x) * 4.0d0)
    else
        tmp = 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.52) {
		tmp = x + ((y - x) * 4.0);
	} else {
		tmp = 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.52:
		tmp = x + ((y - x) * 4.0)
	else:
		tmp = 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.52)
		tmp = Float64(x + Float64(Float64(y - x) * 4.0));
	else
		tmp = 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.52)
		tmp = x + ((y - x) * 4.0);
	else
		tmp = 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.52], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(-6.0 * N[(y - x), $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.52:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\

\mathbf{else}:\\
\;\;\;\;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.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. Add Preprocessing
    5. 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)} \]
    6. Taylor expanded in z around inf 95.0%

      \[\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. Add Preprocessing
    5. Taylor expanded in z around 0 97.7%

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

    if 0.52000000000000002 < z

    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. Add Preprocessing
    5. 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)} \]
    6. Taylor expanded in z around inf 94.7%

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

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

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

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

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

    \[\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.52:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-6 \cdot \left(y - x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 97.9% accurate, 0.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;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.55000000000000004

    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. Add Preprocessing
    5. 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)} \]
    6. Taylor expanded in z around inf 95.0%

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

    if -0.55000000000000004 < 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. Add Preprocessing
    5. Taylor expanded in y around 0 99.4%

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

      \[\leadsto \color{blue}{x + 0.6666666666666666 \cdot \left(-6 \cdot x + 6 \cdot y\right)} \]
    7. Step-by-step derivation
      1. distribute-lft-in97.2%

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

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

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

        \[\leadsto \left(x + \color{blue}{-4} \cdot x\right) + 0.6666666666666666 \cdot \left(6 \cdot y\right) \]
      5. distribute-rgt1-in97.5%

        \[\leadsto \color{blue}{\left(-4 + 1\right) \cdot x} + 0.6666666666666666 \cdot \left(6 \cdot y\right) \]
      6. *-commutative97.5%

        \[\leadsto \color{blue}{x \cdot \left(-4 + 1\right)} + 0.6666666666666666 \cdot \left(6 \cdot y\right) \]
      7. metadata-eval97.5%

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

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

        \[\leadsto x \cdot -3 + \color{blue}{4} \cdot y \]
      10. *-commutative97.7%

        \[\leadsto x \cdot -3 + \color{blue}{y \cdot 4} \]
    8. Simplified97.7%

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

    if 0.52000000000000002 < z

    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. Add Preprocessing
    5. 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)} \]
    6. Taylor expanded in z around inf 94.7%

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

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

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

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

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

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

Alternative 12: 37.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-16} \lor \neg \left(x \leq 2.3 \cdot 10^{+15}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.8e-16) (not (<= x 2.3e+15))) (* x -3.0) (* y 4.0)))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.8e-16) || !(x <= 2.3e+15)) {
		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 <= (-1.8d-16)) .or. (.not. (x <= 2.3d+15))) 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 <= -1.8e-16) || !(x <= 2.3e+15)) {
		tmp = x * -3.0;
	} else {
		tmp = y * 4.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -1.8e-16) or not (x <= 2.3e+15):
		tmp = x * -3.0
	else:
		tmp = y * 4.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.8e-16) || !(x <= 2.3e+15))
		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 <= -1.8e-16) || ~((x <= 2.3e+15)))
		tmp = x * -3.0;
	else
		tmp = y * 4.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.8e-16], N[Not[LessEqual[x, 2.3e+15]], $MachinePrecision]], N[(x * -3.0), $MachinePrecision], N[(y * 4.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-16} \lor \neg \left(x \leq 2.3 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.79999999999999991e-16 or 2.3e15 < x

    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. Add Preprocessing
    5. Taylor expanded in x around inf 79.4%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
      2. cancel-sign-sub-inv79.4%

        \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
      3. *-commutative79.4%

        \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
      4. cancel-sign-sub-inv79.4%

        \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
      5. distribute-lft-neg-in79.4%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(0.6666666666666666 - z\right) \cdot 6\right)}\right) \]
      6. *-commutative79.4%

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
      7. distribute-lft-neg-in79.4%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
      8. metadata-eval79.4%

        \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
      9. sub-neg79.4%

        \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
      10. distribute-lft-in79.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
      11. metadata-eval79.5%

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
      12. neg-mul-179.5%

        \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
      13. *-commutative79.5%

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

        \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
      15. associate-+r+79.5%

        \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
      16. metadata-eval79.5%

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

        \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
      18. associate-*l*79.5%

        \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
      19. metadata-eval79.5%

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    10. Simplified38.6%

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

    if -1.79999999999999991e-16 < x < 2.3e15

    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. Add Preprocessing
    5. Taylor expanded in y around inf 77.9%

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

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

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

        \[\leadsto \color{blue}{y \cdot 4} \]
    9. Simplified37.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-16} \lor \neg \left(x \leq 2.3 \cdot 10^{+15}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 14: 25.5% 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.5%

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

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

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

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

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right)} \cdot \left(0.6666666666666666 - z\right)\right) \]
    2. cancel-sign-sub-inv49.9%

      \[\leadsto x \cdot \color{blue}{\left(1 - 6 \cdot \left(0.6666666666666666 - z\right)\right)} \]
    3. *-commutative49.9%

      \[\leadsto x \cdot \left(1 - \color{blue}{\left(0.6666666666666666 - z\right) \cdot 6}\right) \]
    4. cancel-sign-sub-inv49.9%

      \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\left(0.6666666666666666 - z\right)\right) \cdot 6\right)} \]
    5. distribute-lft-neg-in49.9%

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

      \[\leadsto x \cdot \left(1 + \left(-\color{blue}{6 \cdot \left(0.6666666666666666 - z\right)}\right)\right) \]
    7. distribute-lft-neg-in49.9%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6\right) \cdot \left(0.6666666666666666 - z\right)}\right) \]
    8. metadata-eval49.9%

      \[\leadsto x \cdot \left(1 + \color{blue}{-6} \cdot \left(0.6666666666666666 - z\right)\right) \]
    9. sub-neg49.9%

      \[\leadsto x \cdot \left(1 + -6 \cdot \color{blue}{\left(0.6666666666666666 + \left(-z\right)\right)}\right) \]
    10. distribute-lft-in49.9%

      \[\leadsto x \cdot \left(1 + \color{blue}{\left(-6 \cdot 0.6666666666666666 + -6 \cdot \left(-z\right)\right)}\right) \]
    11. metadata-eval49.9%

      \[\leadsto x \cdot \left(1 + \left(\color{blue}{-4} + -6 \cdot \left(-z\right)\right)\right) \]
    12. neg-mul-149.9%

      \[\leadsto x \cdot \left(1 + \left(-4 + -6 \cdot \color{blue}{\left(-1 \cdot z\right)}\right)\right) \]
    13. *-commutative49.9%

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

      \[\leadsto x \cdot \left(1 + \left(-4 + \color{blue}{\left(-6 \cdot z\right) \cdot -1}\right)\right) \]
    15. associate-+r+49.9%

      \[\leadsto x \cdot \color{blue}{\left(\left(1 + -4\right) + \left(-6 \cdot z\right) \cdot -1\right)} \]
    16. metadata-eval49.9%

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

      \[\leadsto x \cdot \left(-3 + \color{blue}{\left(z \cdot -6\right)} \cdot -1\right) \]
    18. associate-*l*49.9%

      \[\leadsto x \cdot \left(-3 + \color{blue}{z \cdot \left(-6 \cdot -1\right)}\right) \]
    19. metadata-eval49.9%

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

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

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

      \[\leadsto \color{blue}{x \cdot -3} \]
  10. Simplified25.2%

    \[\leadsto \color{blue}{x \cdot -3} \]
  11. Final simplification25.2%

    \[\leadsto x \cdot -3 \]
  12. Add Preprocessing

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.5%

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

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

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

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

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

    \[\leadsto x \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024050 
(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))))