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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 51.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(z \cdot -6\right)\\ t_1 := x \cdot \left(z \cdot 6\right)\\ \mathbf{if}\;z \leq -1.5 \cdot 10^{+44}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-268}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-226}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+65}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (* z -6.0))) (t_1 (* x (* z 6.0))))
   (if (<= z -1.5e+44)
     t_0
     (if (<= z -7.8e-13)
       t_1
       (if (<= z 1.65e-268)
         (* x -3.0)
         (if (<= z 1.6e-226)
           (* y 4.0)
           (if (<= z 0.6) (* x -3.0) (if (<= z 1.8e+65) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = y * (z * -6.0);
	double t_1 = x * (z * 6.0);
	double tmp;
	if (z <= -1.5e+44) {
		tmp = t_0;
	} else if (z <= -7.8e-13) {
		tmp = t_1;
	} else if (z <= 1.65e-268) {
		tmp = x * -3.0;
	} else if (z <= 1.6e-226) {
		tmp = y * 4.0;
	} else if (z <= 0.6) {
		tmp = x * -3.0;
	} else if (z <= 1.8e+65) {
		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 = y * (z * (-6.0d0))
    t_1 = x * (z * 6.0d0)
    if (z <= (-1.5d+44)) then
        tmp = t_0
    else if (z <= (-7.8d-13)) then
        tmp = t_1
    else if (z <= 1.65d-268) then
        tmp = x * (-3.0d0)
    else if (z <= 1.6d-226) then
        tmp = y * 4.0d0
    else if (z <= 0.6d0) then
        tmp = x * (-3.0d0)
    else if (z <= 1.8d+65) 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 = y * (z * -6.0);
	double t_1 = x * (z * 6.0);
	double tmp;
	if (z <= -1.5e+44) {
		tmp = t_0;
	} else if (z <= -7.8e-13) {
		tmp = t_1;
	} else if (z <= 1.65e-268) {
		tmp = x * -3.0;
	} else if (z <= 1.6e-226) {
		tmp = y * 4.0;
	} else if (z <= 0.6) {
		tmp = x * -3.0;
	} else if (z <= 1.8e+65) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (z * -6.0)
	t_1 = x * (z * 6.0)
	tmp = 0
	if z <= -1.5e+44:
		tmp = t_0
	elif z <= -7.8e-13:
		tmp = t_1
	elif z <= 1.65e-268:
		tmp = x * -3.0
	elif z <= 1.6e-226:
		tmp = y * 4.0
	elif z <= 0.6:
		tmp = x * -3.0
	elif z <= 1.8e+65:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(z * -6.0))
	t_1 = Float64(x * Float64(z * 6.0))
	tmp = 0.0
	if (z <= -1.5e+44)
		tmp = t_0;
	elseif (z <= -7.8e-13)
		tmp = t_1;
	elseif (z <= 1.65e-268)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.6e-226)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.6)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.8e+65)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (z * -6.0);
	t_1 = x * (z * 6.0);
	tmp = 0.0;
	if (z <= -1.5e+44)
		tmp = t_0;
	elseif (z <= -7.8e-13)
		tmp = t_1;
	elseif (z <= 1.65e-268)
		tmp = x * -3.0;
	elseif (z <= 1.6e-226)
		tmp = y * 4.0;
	elseif (z <= 0.6)
		tmp = x * -3.0;
	elseif (z <= 1.8e+65)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.5e+44], t$95$0, If[LessEqual[z, -7.8e-13], t$95$1, If[LessEqual[z, 1.65e-268], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.6e-226], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.6], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.8e+65], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\
\;\;\;\;t_1\\

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

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

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

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+65}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.49999999999999993e44 or 0.599999999999999978 < z < 1.79999999999999989e65

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 62.7%

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

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

    if -1.49999999999999993e44 < z < -7.80000000000000009e-13 or 1.79999999999999989e65 < 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. Taylor expanded in x around inf 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.80000000000000009e-13 < z < 1.64999999999999996e-268 or 1.59999999999999991e-226 < z < 0.599999999999999978

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified61.4%

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

    if 1.64999999999999996e-268 < z < 1.59999999999999991e-226

    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. +-commutative99.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 79.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+44}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-268}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-226}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+65}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]

Alternative 3: 51.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(z \cdot -6\right)\\ \mathbf{if}\;z \leq -4.6 \cdot 10^{+44}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-266}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-226}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+65}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (* z -6.0))))
   (if (<= z -4.6e+44)
     t_0
     (if (<= z -7.8e-13)
       (* z (* x 6.0))
       (if (<= z 4.5e-266)
         (* x -3.0)
         (if (<= z 1.65e-226)
           (* y 4.0)
           (if (<= z 0.5)
             (* x -3.0)
             (if (<= z 2.1e+65) t_0 (* x (* z 6.0))))))))))
double code(double x, double y, double z) {
	double t_0 = y * (z * -6.0);
	double tmp;
	if (z <= -4.6e+44) {
		tmp = t_0;
	} else if (z <= -7.8e-13) {
		tmp = z * (x * 6.0);
	} else if (z <= 4.5e-266) {
		tmp = x * -3.0;
	} else if (z <= 1.65e-226) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 2.1e+65) {
		tmp = t_0;
	} else {
		tmp = x * (z * 6.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 = y * (z * (-6.0d0))
    if (z <= (-4.6d+44)) then
        tmp = t_0
    else if (z <= (-7.8d-13)) then
        tmp = z * (x * 6.0d0)
    else if (z <= 4.5d-266) then
        tmp = x * (-3.0d0)
    else if (z <= 1.65d-226) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 2.1d+65) then
        tmp = t_0
    else
        tmp = x * (z * 6.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (z * -6.0);
	double tmp;
	if (z <= -4.6e+44) {
		tmp = t_0;
	} else if (z <= -7.8e-13) {
		tmp = z * (x * 6.0);
	} else if (z <= 4.5e-266) {
		tmp = x * -3.0;
	} else if (z <= 1.65e-226) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 2.1e+65) {
		tmp = t_0;
	} else {
		tmp = x * (z * 6.0);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (z * -6.0)
	tmp = 0
	if z <= -4.6e+44:
		tmp = t_0
	elif z <= -7.8e-13:
		tmp = z * (x * 6.0)
	elif z <= 4.5e-266:
		tmp = x * -3.0
	elif z <= 1.65e-226:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 2.1e+65:
		tmp = t_0
	else:
		tmp = x * (z * 6.0)
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(z * -6.0))
	tmp = 0.0
	if (z <= -4.6e+44)
		tmp = t_0;
	elseif (z <= -7.8e-13)
		tmp = Float64(z * Float64(x * 6.0));
	elseif (z <= 4.5e-266)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.65e-226)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.1e+65)
		tmp = t_0;
	else
		tmp = Float64(x * Float64(z * 6.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (z * -6.0);
	tmp = 0.0;
	if (z <= -4.6e+44)
		tmp = t_0;
	elseif (z <= -7.8e-13)
		tmp = z * (x * 6.0);
	elseif (z <= 4.5e-266)
		tmp = x * -3.0;
	elseif (z <= 1.65e-226)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 2.1e+65)
		tmp = t_0;
	else
		tmp = x * (z * 6.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.6e+44], t$95$0, If[LessEqual[z, -7.8e-13], N[(z * N[(x * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e-266], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.65e-226], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.1e+65], t$95$0, N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\

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

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

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

\mathbf{elif}\;z \leq 2.1 \cdot 10^{+65}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -4.60000000000000009e44 or 0.5 < z < 2.09999999999999991e65

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 62.7%

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

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

    if -4.60000000000000009e44 < z < -7.80000000000000009e-13

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    if -7.80000000000000009e-13 < z < 4.5000000000000003e-266 or 1.65e-226 < z < 0.5

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified61.4%

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

    if 4.5000000000000003e-266 < z < 1.65e-226

    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. +-commutative99.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 79.3%

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

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

    if 2.09999999999999991e65 < 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. Taylor expanded in x around inf 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.6 \cdot 10^{+44}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-266}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-226}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{+65}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]

Alternative 4: 51.9% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -5.99999999999999974e44 or 0.55000000000000004 < z < 1.15e66

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

    if -5.99999999999999974e44 < z < -7.80000000000000009e-13

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    if -7.80000000000000009e-13 < z < 5.50000000000000026e-266 or 9.49999999999999953e-227 < z < 0.55000000000000004

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified61.4%

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

    if 5.50000000000000026e-266 < z < 9.49999999999999953e-227

    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. +-commutative99.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 79.3%

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

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

    if 1.15e66 < 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. Taylor expanded in x around inf 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+44}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-13}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-266}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-227}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.55:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{+66}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]

Alternative 5: 52.0% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq -0.14:\\
\;\;\;\;-6 \cdot \left(x \cdot \left(0.6666666666666666 - z\right)\right)\\

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

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

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

\mathbf{elif}\;z \leq 6.3 \cdot 10^{+65}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.04999999999999993e44 or 0.5 < z < 6.29999999999999997e65

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

    if -1.04999999999999993e44 < z < -0.14000000000000001

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt66.7%

        \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{x}} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right) \]
      2. fma-def66.7%

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

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

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

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

    if -0.14000000000000001 < z < 9.19999999999999986e-266 or 2.4999999999999999e-226 < z < 0.5

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.19999999999999986e-266 < z < 2.4999999999999999e-226

    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. +-commutative99.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 79.3%

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

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

    if 6.29999999999999997e65 < 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. Taylor expanded in x around inf 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+44}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -0.14:\\ \;\;\;\;-6 \cdot \left(x \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{-266}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-226}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.3 \cdot 10^{+65}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]

Alternative 6: 76.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+44}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-9}:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+66}:\\ \;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))))
   (if (<= z -4.2e+44)
     (* z (* y -6.0))
     (if (<= z -8.5e-7)
       t_0
       (if (<= z 1.55e-9)
         (+ x (* (- y x) 4.0))
         (if (<= z 5.2e+66) (* (- 0.6666666666666666 z) (* y 6.0)) t_0))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double tmp;
	if (z <= -4.2e+44) {
		tmp = z * (y * -6.0);
	} else if (z <= -8.5e-7) {
		tmp = t_0;
	} else if (z <= 1.55e-9) {
		tmp = x + ((y - x) * 4.0);
	} else if (z <= 5.2e+66) {
		tmp = (0.6666666666666666 - z) * (y * 6.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 = x * ((-3.0d0) + (z * 6.0d0))
    if (z <= (-4.2d+44)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-8.5d-7)) then
        tmp = t_0
    else if (z <= 1.55d-9) then
        tmp = x + ((y - x) * 4.0d0)
    else if (z <= 5.2d+66) then
        tmp = (0.6666666666666666d0 - z) * (y * 6.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double tmp;
	if (z <= -4.2e+44) {
		tmp = z * (y * -6.0);
	} else if (z <= -8.5e-7) {
		tmp = t_0;
	} else if (z <= 1.55e-9) {
		tmp = x + ((y - x) * 4.0);
	} else if (z <= 5.2e+66) {
		tmp = (0.6666666666666666 - z) * (y * 6.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	tmp = 0
	if z <= -4.2e+44:
		tmp = z * (y * -6.0)
	elif z <= -8.5e-7:
		tmp = t_0
	elif z <= 1.55e-9:
		tmp = x + ((y - x) * 4.0)
	elif z <= 5.2e+66:
		tmp = (0.6666666666666666 - z) * (y * 6.0)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	tmp = 0.0
	if (z <= -4.2e+44)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -8.5e-7)
		tmp = t_0;
	elseif (z <= 1.55e-9)
		tmp = Float64(x + Float64(Float64(y - x) * 4.0));
	elseif (z <= 5.2e+66)
		tmp = Float64(Float64(0.6666666666666666 - z) * Float64(y * 6.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	tmp = 0.0;
	if (z <= -4.2e+44)
		tmp = z * (y * -6.0);
	elseif (z <= -8.5e-7)
		tmp = t_0;
	elseif (z <= 1.55e-9)
		tmp = x + ((y - x) * 4.0);
	elseif (z <= 5.2e+66)
		tmp = (0.6666666666666666 - z) * (y * 6.0);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+44], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.5e-7], t$95$0, If[LessEqual[z, 1.55e-9], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+66], N[(N[(0.6666666666666666 - z), $MachinePrecision] * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 1.55 \cdot 10^{-9}:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{+66}:\\
\;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -4.19999999999999974e44 < z < -8.50000000000000014e-7 or 5.20000000000000024e66 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-1 \cdot 4} + -6 \cdot \left(-z\right)\right)\right) \]
      5. mul-1-neg77.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.50000000000000014e-7 < z < 1.55000000000000002e-9

    1. Initial program 99.2%

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

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

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

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

    if 1.55000000000000002e-9 < z < 5.20000000000000024e66

    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. Taylor expanded in x around 0 99.4%

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

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

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

        \[\leadsto \color{blue}{\left(0.6666666666666666 - z\right) \cdot \left(6 \cdot y\right)} \]
    7. Simplified66.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.2 \cdot 10^{+44}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-7}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-9}:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+66}:\\ \;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]

Alternative 7: 76.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+44}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.16 \cdot 10^{-8}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+67}:\\ \;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))))
   (if (<= z -2.5e+44)
     (* z (* y -6.0))
     (if (<= z -1.16e-8)
       t_0
       (if (<= z 1.15e-9)
         (+ (* y 4.0) (* x -3.0))
         (if (<= z 6.2e+67) (* (- 0.6666666666666666 z) (* y 6.0)) t_0))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double tmp;
	if (z <= -2.5e+44) {
		tmp = z * (y * -6.0);
	} else if (z <= -1.16e-8) {
		tmp = t_0;
	} else if (z <= 1.15e-9) {
		tmp = (y * 4.0) + (x * -3.0);
	} else if (z <= 6.2e+67) {
		tmp = (0.6666666666666666 - z) * (y * 6.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 = x * ((-3.0d0) + (z * 6.0d0))
    if (z <= (-2.5d+44)) then
        tmp = z * (y * (-6.0d0))
    else if (z <= (-1.16d-8)) then
        tmp = t_0
    else if (z <= 1.15d-9) then
        tmp = (y * 4.0d0) + (x * (-3.0d0))
    else if (z <= 6.2d+67) then
        tmp = (0.6666666666666666d0 - z) * (y * 6.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double tmp;
	if (z <= -2.5e+44) {
		tmp = z * (y * -6.0);
	} else if (z <= -1.16e-8) {
		tmp = t_0;
	} else if (z <= 1.15e-9) {
		tmp = (y * 4.0) + (x * -3.0);
	} else if (z <= 6.2e+67) {
		tmp = (0.6666666666666666 - z) * (y * 6.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	tmp = 0
	if z <= -2.5e+44:
		tmp = z * (y * -6.0)
	elif z <= -1.16e-8:
		tmp = t_0
	elif z <= 1.15e-9:
		tmp = (y * 4.0) + (x * -3.0)
	elif z <= 6.2e+67:
		tmp = (0.6666666666666666 - z) * (y * 6.0)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	tmp = 0.0
	if (z <= -2.5e+44)
		tmp = Float64(z * Float64(y * -6.0));
	elseif (z <= -1.16e-8)
		tmp = t_0;
	elseif (z <= 1.15e-9)
		tmp = Float64(Float64(y * 4.0) + Float64(x * -3.0));
	elseif (z <= 6.2e+67)
		tmp = Float64(Float64(0.6666666666666666 - z) * Float64(y * 6.0));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	tmp = 0.0;
	if (z <= -2.5e+44)
		tmp = z * (y * -6.0);
	elseif (z <= -1.16e-8)
		tmp = t_0;
	elseif (z <= 1.15e-9)
		tmp = (y * 4.0) + (x * -3.0);
	elseif (z <= 6.2e+67)
		tmp = (0.6666666666666666 - z) * (y * 6.0);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e+44], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.16e-8], t$95$0, If[LessEqual[z, 1.15e-9], N[(N[(y * 4.0), $MachinePrecision] + N[(x * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e+67], N[(N[(0.6666666666666666 - z), $MachinePrecision] * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.16 \cdot 10^{-8}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.15 \cdot 10^{-9}:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{+67}:\\
\;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -2.4999999999999998e44 < z < -1.15999999999999996e-8 or 6.19999999999999992e67 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-1 \cdot 4} + -6 \cdot \left(-z\right)\right)\right) \]
      5. mul-1-neg77.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15999999999999996e-8 < z < 1.15e-9

    1. Initial program 99.2%

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

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

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

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

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

    if 1.15e-9 < z < 6.19999999999999992e67

    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. Taylor expanded in x around 0 99.4%

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

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

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

        \[\leadsto \color{blue}{\left(0.6666666666666666 - z\right) \cdot \left(6 \cdot y\right)} \]
    7. Simplified66.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+44}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.16 \cdot 10^{-8}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-9}:\\ \;\;\;\;y \cdot 4 + x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+67}:\\ \;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]

Alternative 8: 50.6% accurate, 1.0× speedup?

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

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

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-1 \cdot 4} + -6 \cdot \left(-z\right)\right)\right) \]
      5. mul-1-neg55.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.80000000000000009e-13 < z < 2.1000000000000001e-267 or 5.3000000000000004e-226 < z < 0.5

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified61.4%

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

    if 2.1000000000000001e-267 < z < 5.3000000000000004e-226

    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. +-commutative99.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 79.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{-13}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-267}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{-226}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]

Alternative 9: 50.6% accurate, 1.0× speedup?

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

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

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

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-1 \cdot 4} + -6 \cdot \left(-z\right)\right)\right) \]
      5. mul-1-neg46.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.80000000000000009e-13 < z < 1.42000000000000001e-266 or 1.99999999999999984e-226 < z < 0.5

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot -3} \]
    9. Simplified61.4%

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

    if 1.42000000000000001e-266 < z < 1.99999999999999984e-226

    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. +-commutative99.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 79.3%

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

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

    if 0.5 < 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. Taylor expanded in x around inf 64.3%

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-1 \cdot 4} + -6 \cdot \left(-z\right)\right)\right) \]
      5. mul-1-neg64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{-13}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq 1.42 \cdot 10^{-266}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-226}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]

Alternative 10: 58.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{-157}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 1.2 \cdot 10^{-159}:\\
\;\;\;\;x + y \cdot 4\\

\mathbf{elif}\;x \leq 9 \cdot 10^{-109}:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.99999999999999977e-157 or 9.0000000000000002e-109 < 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. Taylor expanded in x around inf 73.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999977e-157 < x < 1.19999999999999999e-159

    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. Taylor expanded in y around inf 89.8%

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

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

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

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

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

        \[\leadsto x + \color{blue}{y \cdot 4} \]
    9. Simplified53.3%

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

    if 1.19999999999999999e-159 < x < 9.0000000000000002e-109

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 89.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-157}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-159}:\\ \;\;\;\;x + y \cdot 4\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-109}:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]

Alternative 11: 97.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

    if -0.57999999999999996 < z < 0.55000000000000004

    1. Initial program 99.2%

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

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

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

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

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

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

Alternative 12: 97.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

    if -0.55000000000000004 < z < 0.5

    1. Initial program 99.2%

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

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

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

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

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

    if 0.5 < 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. Taylor expanded in z around inf 99.6%

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

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

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

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

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

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

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

Alternative 13: 72.6% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.1999999999999998e-111 or 5.9999999999999994e-107 < 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. Taylor expanded in x around inf 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1999999999999998e-111 < x < 5.9999999999999994e-107

    1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)} \]
      4. 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. Taylor expanded in y around inf 85.1%

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

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

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

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

Alternative 15: 36.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{+85} \lor \neg \left(x \leq 1.45 \cdot 10^{-102}\right):\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.39999999999999966e85 or 1.44999999999999993e-102 < x

    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. Taylor expanded in x around inf 81.9%

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(\color{blue}{-1 \cdot 4} + -6 \cdot \left(-z\right)\right)\right) \]
      5. mul-1-neg81.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.39999999999999966e85 < x < 1.44999999999999993e-102

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

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

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

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

        \[\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. Taylor expanded in y around inf 70.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.4 \cdot 10^{+85} \lor \neg \left(x \leq 1.45 \cdot 10^{-102}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]

Alternative 16: 26.2% 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. Taylor expanded in x around inf 57.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot -3} \]
  9. Simplified31.4%

    \[\leadsto \color{blue}{x \cdot -3} \]
  10. Final simplification31.4%

    \[\leadsto x \cdot -3 \]

Reproduce

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