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

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.2× speedup?

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

\\
x + \left(y - x\right) \cdot \left(4 + -6 \cdot 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. Add Preprocessing
  3. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + \color{blue}{x} \]
    2. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)\right), \color{blue}{x}\right) \]
    3. associate-*l*N/A

      \[\leadsto \mathsf{+.f64}\left(\left(\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right), x\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(y - x\right), \left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right), x\right) \]
    5. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right), x\right) \]
    6. sub-negN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(6 \cdot \left(\frac{2}{3} + \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
    7. distribute-lft-inN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(6 \cdot \frac{2}{3} + 6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right), x\right) \]
    8. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(\left(6 \cdot \frac{2}{3}\right), \left(6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(\left(6 \cdot \frac{2}{3}\right), \left(6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
    11. neg-mul-1N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(6 \cdot \left(-1 \cdot z\right)\right)\right)\right), x\right) \]
    12. associate-*r*N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(\left(6 \cdot -1\right) \cdot z\right)\right)\right), x\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(-6 \cdot z\right)\right)\right), x\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(\left(\mathsf{neg}\left(6\right)\right) \cdot z\right)\right)\right), x\right) \]
    15. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(\left(\mathsf{neg}\left(6\right)\right), z\right)\right)\right), x\right) \]
    16. metadata-eval99.8%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(-6, z\right)\right)\right), x\right) \]
  4. Applied egg-rr99.8%

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

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

Alternative 2: 50.0% accurate, 0.4× speedup?

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

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

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

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

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6494.4%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified94.4%

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

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

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

        \[\leadsto \left(-6 \cdot z\right) \cdot \color{blue}{y} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-6 \cdot z\right), \color{blue}{y}\right) \]
      4. *-lowering-*.f6454.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-6, z\right), y\right) \]
    8. Simplified54.7%

      \[\leadsto \color{blue}{\left(-6 \cdot z\right) \cdot y} \]
    9. Step-by-step derivation
      1. associate-*l*N/A

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

        \[\leadsto \left(z \cdot y\right) \cdot \color{blue}{-6} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(z \cdot y\right), \color{blue}{-6}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(y \cdot z\right), -6\right) \]
      5. *-lowering-*.f6454.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, z\right), -6\right) \]
    10. Applied egg-rr54.7%

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

    if -0.0560000000000000012 < z < -1.5999999999999999e-150 or 5.40000000000000028e-149 < z < 0.52000000000000002

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval98.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around 0

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto x \cdot \color{blue}{-3} \]
      2. *-lowering-*.f6461.4%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-3}\right) \]
    8. Simplified61.4%

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

    if -1.5999999999999999e-150 < z < 5.40000000000000028e-149

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval99.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified61.3%

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

    if 0.52000000000000002 < z < 1.5e247

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6496.5%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified96.5%

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

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

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

        \[\leadsto \left(-6 \cdot z\right) \cdot \color{blue}{y} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-6 \cdot z\right), \color{blue}{y}\right) \]
      4. *-lowering-*.f6456.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-6, z\right), y\right) \]
    8. Simplified56.9%

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

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

        \[\leadsto \left(y \cdot -6\right) \cdot \color{blue}{z} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(y \cdot -6\right), \color{blue}{z}\right) \]
      4. *-lowering-*.f6456.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, -6\right), z\right) \]
    10. Applied egg-rr56.9%

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

    if 1.5e247 < z

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6499.8%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified99.8%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
      3. *-commutativeN/A

        \[\leadsto x \cdot \left(6 \cdot \color{blue}{z}\right) \]
      4. metadata-evalN/A

        \[\leadsto x \cdot \left(\left(-1 \cdot -6\right) \cdot z\right) \]
      5. associate-*r*N/A

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(-1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(-1 \cdot -6\right) \cdot \color{blue}{z}\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(6 \cdot z\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(z \cdot \color{blue}{6}\right)\right) \]
      10. *-lowering-*.f6472.7%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(z, \color{blue}{6}\right)\right) \]
    8. Simplified72.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.056:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-150}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-149}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.52:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+247}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 49.9% accurate, 0.4× speedup?

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

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

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

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

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6494.4%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified94.4%

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

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

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

        \[\leadsto \left(-6 \cdot z\right) \cdot \color{blue}{y} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-6 \cdot z\right), \color{blue}{y}\right) \]
      4. *-lowering-*.f6454.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-6, z\right), y\right) \]
    8. Simplified54.7%

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

    if -0.0054999999999999997 < z < -1.9500000000000001e-153 or 1.0200000000000001e-149 < z < 0.52000000000000002

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval98.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around 0

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto x \cdot \color{blue}{-3} \]
      2. *-lowering-*.f6461.4%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-3}\right) \]
    8. Simplified61.4%

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

    if -1.9500000000000001e-153 < z < 1.0200000000000001e-149

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval99.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified61.3%

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

    if 0.52000000000000002 < z < 1.2499999999999999e248

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6496.5%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified96.5%

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

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

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

        \[\leadsto \left(-6 \cdot z\right) \cdot \color{blue}{y} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-6 \cdot z\right), \color{blue}{y}\right) \]
      4. *-lowering-*.f6456.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-6, z\right), y\right) \]
    8. Simplified56.9%

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

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

        \[\leadsto \left(y \cdot -6\right) \cdot \color{blue}{z} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(y \cdot -6\right), \color{blue}{z}\right) \]
      4. *-lowering-*.f6456.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(y, -6\right), z\right) \]
    10. Applied egg-rr56.9%

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

    if 1.2499999999999999e248 < z

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6499.8%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified99.8%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
      3. *-commutativeN/A

        \[\leadsto x \cdot \left(6 \cdot \color{blue}{z}\right) \]
      4. metadata-evalN/A

        \[\leadsto x \cdot \left(\left(-1 \cdot -6\right) \cdot z\right) \]
      5. associate-*r*N/A

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(-1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(-1 \cdot -6\right) \cdot \color{blue}{z}\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(6 \cdot z\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(z \cdot \color{blue}{6}\right)\right) \]
      10. *-lowering-*.f6472.7%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(z, \color{blue}{6}\right)\right) \]
    8. Simplified72.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0055:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-153}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-149}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.52:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+248}:\\ \;\;\;\;z \cdot \left(y \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 49.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(-6 \cdot z\right)\\ \mathbf{if}\;z \leq -0.32:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-153}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-146}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.58:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+249}:\\ \;\;\;\;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 (* -6.0 z))))
   (if (<= z -0.32)
     t_0
     (if (<= z -9.2e-153)
       (* x -3.0)
       (if (<= z 6.4e-146)
         (* y 4.0)
         (if (<= z 0.58)
           (* x -3.0)
           (if (<= z 3.8e+249) t_0 (* x (* z 6.0)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (-6.0 * z);
	double tmp;
	if (z <= -0.32) {
		tmp = t_0;
	} else if (z <= -9.2e-153) {
		tmp = x * -3.0;
	} else if (z <= 6.4e-146) {
		tmp = y * 4.0;
	} else if (z <= 0.58) {
		tmp = x * -3.0;
	} else if (z <= 3.8e+249) {
		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 * ((-6.0d0) * z)
    if (z <= (-0.32d0)) then
        tmp = t_0
    else if (z <= (-9.2d-153)) then
        tmp = x * (-3.0d0)
    else if (z <= 6.4d-146) then
        tmp = y * 4.0d0
    else if (z <= 0.58d0) then
        tmp = x * (-3.0d0)
    else if (z <= 3.8d+249) 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 * (-6.0 * z);
	double tmp;
	if (z <= -0.32) {
		tmp = t_0;
	} else if (z <= -9.2e-153) {
		tmp = x * -3.0;
	} else if (z <= 6.4e-146) {
		tmp = y * 4.0;
	} else if (z <= 0.58) {
		tmp = x * -3.0;
	} else if (z <= 3.8e+249) {
		tmp = t_0;
	} else {
		tmp = x * (z * 6.0);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (-6.0 * z)
	tmp = 0
	if z <= -0.32:
		tmp = t_0
	elif z <= -9.2e-153:
		tmp = x * -3.0
	elif z <= 6.4e-146:
		tmp = y * 4.0
	elif z <= 0.58:
		tmp = x * -3.0
	elif z <= 3.8e+249:
		tmp = t_0
	else:
		tmp = x * (z * 6.0)
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(-6.0 * z))
	tmp = 0.0
	if (z <= -0.32)
		tmp = t_0;
	elseif (z <= -9.2e-153)
		tmp = Float64(x * -3.0);
	elseif (z <= 6.4e-146)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.58)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.8e+249)
		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 * (-6.0 * z);
	tmp = 0.0;
	if (z <= -0.32)
		tmp = t_0;
	elseif (z <= -9.2e-153)
		tmp = x * -3.0;
	elseif (z <= 6.4e-146)
		tmp = y * 4.0;
	elseif (z <= 0.58)
		tmp = x * -3.0;
	elseif (z <= 3.8e+249)
		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[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.32], t$95$0, If[LessEqual[z, -9.2e-153], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6.4e-146], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.58], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.8e+249], t$95$0, N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;z \leq 3.8 \cdot 10^{+249}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -0.320000000000000007 or 0.57999999999999996 < z < 3.7999999999999997e249

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6495.4%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified95.4%

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

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

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

        \[\leadsto \left(-6 \cdot z\right) \cdot \color{blue}{y} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(-6 \cdot z\right), \color{blue}{y}\right) \]
      4. *-lowering-*.f6455.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(-6, z\right), y\right) \]
    8. Simplified55.8%

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

    if -0.320000000000000007 < z < -9.19999999999999988e-153 or 6.3999999999999998e-146 < z < 0.57999999999999996

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval98.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around 0

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto x \cdot \color{blue}{-3} \]
      2. *-lowering-*.f6461.4%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-3}\right) \]
    8. Simplified61.4%

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

    if -9.19999999999999988e-153 < z < 6.3999999999999998e-146

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval99.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified61.3%

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

    if 3.7999999999999997e249 < z

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6499.8%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified99.8%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
      3. *-commutativeN/A

        \[\leadsto x \cdot \left(6 \cdot \color{blue}{z}\right) \]
      4. metadata-evalN/A

        \[\leadsto x \cdot \left(\left(-1 \cdot -6\right) \cdot z\right) \]
      5. associate-*r*N/A

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(-1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(-1 \cdot -6\right) \cdot \color{blue}{z}\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(6 \cdot z\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(z \cdot \color{blue}{6}\right)\right) \]
      10. *-lowering-*.f6472.7%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(z, \color{blue}{6}\right)\right) \]
    8. Simplified72.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.32:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-153}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{-146}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.58:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+249}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.3% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq -9 \cdot 10^{-153}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6497.3%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified97.3%

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

    if -1e5 < z < -9e-153 or 2.60000000000000008e-148 < z < 14.5

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
    4. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \left(\color{blue}{1} + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
      2. neg-mul-1N/A

        \[\leadsto \left(\mathsf{neg}\left(-1 \cdot x\right)\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(\left(-1 \cdot x\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right)\right)} \]
      5. distribute-neg-inN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-6 \cdot \left(\frac{2}{3} - z\right)\right)\right)}\right) \]
      6. metadata-evalN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(\color{blue}{-6 \cdot \left(\frac{2}{3} - z\right)}\right)\right)\right) \]
      7. distribute-lft-neg-inN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(-6\right)\right) \cdot \color{blue}{\left(\frac{2}{3} - z\right)}\right) \]
      8. metadata-evalN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + 6 \cdot \left(\color{blue}{\frac{2}{3}} - z\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \color{blue}{-1}\right) \]
      10. metadata-evalN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - \color{blue}{1}\right) \]
      12. associate-*r*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)} \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto x \cdot \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)} \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)}\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + -1\right)\right)\right)\right) \]
      18. distribute-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}\right)\right) \]
      19. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6\right)\right) \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(\color{blue}{-1}\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(-1\right)\right)\right)\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + 1\right)\right) \]
    5. Simplified63.4%

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

    if -9e-153 < z < 2.60000000000000008e-148

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval99.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified61.3%

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

    if 14.5 < z

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6498.2%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified98.2%

      \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(x - y\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto 6 \cdot \left(\left(x - y\right) \cdot \color{blue}{z}\right) \]
      2. associate-*r*N/A

        \[\leadsto \left(6 \cdot \left(x - y\right)\right) \cdot \color{blue}{z} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(6 \cdot \left(x - y\right)\right), \color{blue}{z}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(6, \left(x - y\right)\right), z\right) \]
      5. --lowering--.f6498.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, y\right)\right), z\right) \]
    7. Applied egg-rr98.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -100000:\\ \;\;\;\;6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-153}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-148}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 14.5:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(6 \cdot \left(x - y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ t_1 := 6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{if}\;z \leq -215000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-148}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-152}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 14.5:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (+ -3.0 (* z 6.0)))) (t_1 (* 6.0 (* z (- x y)))))
   (if (<= z -215000.0)
     t_1
     (if (<= z -3.8e-148)
       t_0
       (if (<= z 4.2e-152) (* y 4.0) (if (<= z 14.5) t_0 t_1))))))
double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = 6.0 * (z * (x - y));
	double tmp;
	if (z <= -215000.0) {
		tmp = t_1;
	} else if (z <= -3.8e-148) {
		tmp = t_0;
	} else if (z <= 4.2e-152) {
		tmp = y * 4.0;
	} else if (z <= 14.5) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * ((-3.0d0) + (z * 6.0d0))
    t_1 = 6.0d0 * (z * (x - y))
    if (z <= (-215000.0d0)) then
        tmp = t_1
    else if (z <= (-3.8d-148)) then
        tmp = t_0
    else if (z <= 4.2d-152) then
        tmp = y * 4.0d0
    else if (z <= 14.5d0) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-3.0 + (z * 6.0));
	double t_1 = 6.0 * (z * (x - y));
	double tmp;
	if (z <= -215000.0) {
		tmp = t_1;
	} else if (z <= -3.8e-148) {
		tmp = t_0;
	} else if (z <= 4.2e-152) {
		tmp = y * 4.0;
	} else if (z <= 14.5) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-3.0 + (z * 6.0))
	t_1 = 6.0 * (z * (x - y))
	tmp = 0
	if z <= -215000.0:
		tmp = t_1
	elif z <= -3.8e-148:
		tmp = t_0
	elif z <= 4.2e-152:
		tmp = y * 4.0
	elif z <= 14.5:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0)))
	t_1 = Float64(6.0 * Float64(z * Float64(x - y)))
	tmp = 0.0
	if (z <= -215000.0)
		tmp = t_1;
	elseif (z <= -3.8e-148)
		tmp = t_0;
	elseif (z <= 4.2e-152)
		tmp = Float64(y * 4.0);
	elseif (z <= 14.5)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-3.0 + (z * 6.0));
	t_1 = 6.0 * (z * (x - y));
	tmp = 0.0;
	if (z <= -215000.0)
		tmp = t_1;
	elseif (z <= -3.8e-148)
		tmp = t_0;
	elseif (z <= 4.2e-152)
		tmp = y * 4.0;
	elseif (z <= 14.5)
		tmp = t_0;
	else
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -215000.0], t$95$1, If[LessEqual[z, -3.8e-148], t$95$0, If[LessEqual[z, 4.2e-152], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 14.5], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6497.8%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified97.8%

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

    if -215000 < z < -3.80000000000000014e-148 or 4.19999999999999998e-152 < z < 14.5

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
    4. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \left(\color{blue}{1} + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
      2. neg-mul-1N/A

        \[\leadsto \left(\mathsf{neg}\left(-1 \cdot x\right)\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(\left(-1 \cdot x\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right)\right)} \]
      5. distribute-neg-inN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-6 \cdot \left(\frac{2}{3} - z\right)\right)\right)}\right) \]
      6. metadata-evalN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(\color{blue}{-6 \cdot \left(\frac{2}{3} - z\right)}\right)\right)\right) \]
      7. distribute-lft-neg-inN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(-6\right)\right) \cdot \color{blue}{\left(\frac{2}{3} - z\right)}\right) \]
      8. metadata-evalN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + 6 \cdot \left(\color{blue}{\frac{2}{3}} - z\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \color{blue}{-1}\right) \]
      10. metadata-evalN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - \color{blue}{1}\right) \]
      12. associate-*r*N/A

        \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)} \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto x \cdot \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)} \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)}\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right) \]
      17. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + -1\right)\right)\right)\right) \]
      18. distribute-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}\right)\right) \]
      19. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6\right)\right) \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(\color{blue}{-1}\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(-1\right)\right)\right)\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + 1\right)\right) \]
    5. Simplified63.4%

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

    if -3.80000000000000014e-148 < z < 4.19999999999999998e-152

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval99.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified61.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -215000:\\ \;\;\;\;6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-148}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-152}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 14.5:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.7% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.0145000000000000007 or 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. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6495.9%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified95.9%

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

    if -0.0145000000000000007 < z < -1.5199999999999999e-149 or 9.6000000000000006e-146 < z < 0.5

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval98.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around 0

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto x \cdot \color{blue}{-3} \]
      2. *-lowering-*.f6461.4%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-3}\right) \]
    8. Simplified61.4%

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

    if -1.5199999999999999e-149 < z < 9.6000000000000006e-146

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval99.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified61.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0145:\\ \;\;\;\;6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{elif}\;z \leq -1.52 \cdot 10^{-149}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{-146}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 50.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ \mathbf{if}\;z \leq -0.5:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-148}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-146}:\\ \;\;\;\;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 (* x (* z 6.0))))
   (if (<= z -0.5)
     t_0
     (if (<= z -1.6e-148)
       (* x -3.0)
       (if (<= z 3.3e-146) (* y 4.0) (if (<= z 0.5) (* x -3.0) t_0))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double tmp;
	if (z <= -0.5) {
		tmp = t_0;
	} else if (z <= -1.6e-148) {
		tmp = x * -3.0;
	} else if (z <= 3.3e-146) {
		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 = x * (z * 6.0d0)
    if (z <= (-0.5d0)) then
        tmp = t_0
    else if (z <= (-1.6d-148)) then
        tmp = x * (-3.0d0)
    else if (z <= 3.3d-146) 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 = x * (z * 6.0);
	double tmp;
	if (z <= -0.5) {
		tmp = t_0;
	} else if (z <= -1.6e-148) {
		tmp = x * -3.0;
	} else if (z <= 3.3e-146) {
		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 = x * (z * 6.0)
	tmp = 0
	if z <= -0.5:
		tmp = t_0
	elif z <= -1.6e-148:
		tmp = x * -3.0
	elif z <= 3.3e-146:
		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(x * Float64(z * 6.0))
	tmp = 0.0
	if (z <= -0.5)
		tmp = t_0;
	elseif (z <= -1.6e-148)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.3e-146)
		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 = x * (z * 6.0);
	tmp = 0.0;
	if (z <= -0.5)
		tmp = t_0;
	elseif (z <= -1.6e-148)
		tmp = x * -3.0;
	elseif (z <= 3.3e-146)
		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[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.5], t$95$0, If[LessEqual[z, -1.6e-148], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.3e-146], 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 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -0.5:\\
\;\;\;\;t\_0\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.5 or 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. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6495.9%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified95.9%

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
      3. *-commutativeN/A

        \[\leadsto x \cdot \left(6 \cdot \color{blue}{z}\right) \]
      4. metadata-evalN/A

        \[\leadsto x \cdot \left(\left(-1 \cdot -6\right) \cdot z\right) \]
      5. associate-*r*N/A

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(-6 \cdot z\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(-1 \cdot \left(-6 \cdot z\right)\right)}\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(-1 \cdot -6\right) \cdot \color{blue}{z}\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(6 \cdot z\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(z \cdot \color{blue}{6}\right)\right) \]
      10. *-lowering-*.f6445.5%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(z, \color{blue}{6}\right)\right) \]
    8. Simplified45.5%

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

    if -0.5 < z < -1.59999999999999997e-148 or 3.3e-146 < z < 0.5

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval98.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified98.3%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around 0

      \[\leadsto \color{blue}{-3 \cdot x} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto x \cdot \color{blue}{-3} \]
      2. *-lowering-*.f6461.4%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-3}\right) \]
    8. Simplified61.4%

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

    if -1.59999999999999997e-148 < z < 3.3e-146

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval99.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

      \[\leadsto \color{blue}{4 \cdot y} \]
    7. Step-by-step derivation
      1. *-lowering-*.f6461.3%

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified61.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.5:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-148}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-146}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 50.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -0.5:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-151}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-155}:\\ \;\;\;\;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 -0.5)
     t_0
     (if (<= z -2.45e-151)
       (* x -3.0)
       (if (<= z 2.5e-155) (* 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 <= -0.5) {
		tmp = t_0;
	} else if (z <= -2.45e-151) {
		tmp = x * -3.0;
	} else if (z <= 2.5e-155) {
		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 <= (-0.5d0)) then
        tmp = t_0
    else if (z <= (-2.45d-151)) then
        tmp = x * (-3.0d0)
    else if (z <= 2.5d-155) 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 <= -0.5) {
		tmp = t_0;
	} else if (z <= -2.45e-151) {
		tmp = x * -3.0;
	} else if (z <= 2.5e-155) {
		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 <= -0.5:
		tmp = t_0
	elif z <= -2.45e-151:
		tmp = x * -3.0
	elif z <= 2.5e-155:
		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 <= -0.5)
		tmp = t_0;
	elseif (z <= -2.45e-151)
		tmp = Float64(x * -3.0);
	elseif (z <= 2.5e-155)
		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 <= -0.5)
		tmp = t_0;
	elseif (z <= -2.45e-151)
		tmp = x * -3.0;
	elseif (z <= 2.5e-155)
		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, -0.5], t$95$0, If[LessEqual[z, -2.45e-151], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.5e-155], 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 -0.5:\\
\;\;\;\;t\_0\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.5 or 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. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    4. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
      6. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
      12. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
      14. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
      17. --lowering--.f6495.9%

        \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    5. Simplified95.9%

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

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

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

      if -0.5 < z < -2.44999999999999983e-151 or 2.4999999999999999e-155 < z < 0.5

      1. Initial program 99.3%

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

        \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
        2. sub-negN/A

          \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
        3. neg-mul-1N/A

          \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
        4. distribute-lft-inN/A

          \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
        5. associate-+l+N/A

          \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
        6. metadata-evalN/A

          \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
        7. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
        8. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
        9. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
        10. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
        11. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
        12. *-commutativeN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
        13. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
        14. associate-*r*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
        19. associate-*l*N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
        20. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
        21. *-rgt-identityN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
        22. distribute-lft-outN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
        23. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
        24. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
        25. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
        26. metadata-eval98.3%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
      5. Simplified98.3%

        \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
      6. Taylor expanded in y around 0

        \[\leadsto \color{blue}{-3 \cdot x} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto x \cdot \color{blue}{-3} \]
        2. *-lowering-*.f6461.4%

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-3}\right) \]
      8. Simplified61.4%

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

      if -2.44999999999999983e-151 < z < 2.4999999999999999e-155

      1. Initial program 99.2%

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

        \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
        2. sub-negN/A

          \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
        3. neg-mul-1N/A

          \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
        4. distribute-lft-inN/A

          \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
        5. associate-+l+N/A

          \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
        6. metadata-evalN/A

          \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
        7. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
        8. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
        9. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
        10. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
        11. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
        12. *-commutativeN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
        13. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
        14. associate-*r*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
        19. associate-*l*N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
        20. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
        21. *-rgt-identityN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
        22. distribute-lft-outN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
        23. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
        24. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
        25. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
        26. metadata-eval99.9%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
      5. Simplified99.9%

        \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
      6. Taylor expanded in y around inf

        \[\leadsto \color{blue}{4 \cdot y} \]
      7. Step-by-step derivation
        1. *-lowering-*.f6461.3%

          \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
      8. Simplified61.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.5:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -2.45 \cdot 10^{-151}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-155}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
    10. Add Preprocessing

    Alternative 10: 97.7% accurate, 0.8× speedup?

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

      1. Initial program 99.6%

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

        \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
      4. Step-by-step derivation
        1. metadata-evalN/A

          \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
        2. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
        3. distribute-rgt-neg-inN/A

          \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
        5. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
        6. neg-mul-1N/A

          \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
        8. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
        9. neg-mul-1N/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
        10. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
        11. distribute-lft-inN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
        14. *-lft-identityN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
        16. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
        17. --lowering--.f6494.4%

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
      5. Simplified94.4%

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

      if -0.57999999999999996 < z < 0.650000000000000022

      1. Initial program 99.3%

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

        \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
        2. sub-negN/A

          \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
        3. neg-mul-1N/A

          \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
        4. distribute-lft-inN/A

          \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
        5. associate-+l+N/A

          \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
        6. metadata-evalN/A

          \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
        7. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
        8. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
        9. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
        10. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
        11. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
        12. *-commutativeN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
        13. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
        14. associate-*r*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
        19. associate-*l*N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
        20. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
        21. *-rgt-identityN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
        22. distribute-lft-outN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
        23. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
        24. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
        25. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
        26. metadata-eval99.1%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
      5. Simplified99.1%

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

      if 0.650000000000000022 < z

      1. Initial program 99.7%

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

        \[\leadsto \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
      4. Step-by-step derivation
        1. metadata-evalN/A

          \[\leadsto \left(\mathsf{neg}\left(6\right)\right) \cdot \left(\color{blue}{z} \cdot \left(y - x\right)\right) \]
        2. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{neg}\left(6 \cdot \left(z \cdot \left(y - x\right)\right)\right) \]
        3. distribute-rgt-neg-inN/A

          \[\leadsto 6 \cdot \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(6, \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(y - x\right)\right)\right)}\right) \]
        5. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - x\right)\right)\right)}\right)\right) \]
        6. neg-mul-1N/A

          \[\leadsto \mathsf{*.f64}\left(6, \left(z \cdot \left(-1 \cdot \color{blue}{\left(y - x\right)}\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \color{blue}{\left(-1 \cdot \left(y - x\right)\right)}\right)\right) \]
        8. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right)\right) \]
        9. neg-mul-1N/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(y + -1 \cdot \color{blue}{x}\right)\right)\right)\right) \]
        10. +-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x + \color{blue}{y}\right)\right)\right)\right) \]
        11. distribute-lft-inN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(-1 \cdot \left(-1 \cdot x\right) + \color{blue}{-1 \cdot y}\right)\right)\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(\left(-1 \cdot -1\right) \cdot x + \color{blue}{-1} \cdot y\right)\right)\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(1 \cdot x + -1 \cdot y\right)\right)\right) \]
        14. *-lft-identityN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \color{blue}{-1} \cdot y\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x + \left(\mathsf{neg}\left(y\right)\right)\right)\right)\right) \]
        16. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \left(x - \color{blue}{y}\right)\right)\right) \]
        17. --lowering--.f6497.2%

          \[\leadsto \mathsf{*.f64}\left(6, \mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
      5. Simplified97.2%

        \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(x - y\right)\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto 6 \cdot \left(\left(x - y\right) \cdot \color{blue}{z}\right) \]
        2. associate-*r*N/A

          \[\leadsto \left(6 \cdot \left(x - y\right)\right) \cdot \color{blue}{z} \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(6 \cdot \left(x - y\right)\right), \color{blue}{z}\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(6, \left(x - y\right)\right), z\right) \]
        5. --lowering--.f6497.3%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(6, \mathsf{\_.f64}\left(x, y\right)\right), z\right) \]
      7. Applied egg-rr97.3%

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

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

    Alternative 11: 74.8% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{if}\;x \leq -6.2 \cdot 10^{+41}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+84}:\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (* x (+ -3.0 (* z 6.0)))))
       (if (<= x -6.2e+41) t_0 (if (<= x 6.8e+84) (* y (+ 4.0 (* -6.0 z))) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = x * (-3.0 + (z * 6.0));
    	double tmp;
    	if (x <= -6.2e+41) {
    		tmp = t_0;
    	} else if (x <= 6.8e+84) {
    		tmp = y * (4.0 + (-6.0 * z));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x * ((-3.0d0) + (z * 6.0d0))
        if (x <= (-6.2d+41)) then
            tmp = t_0
        else if (x <= 6.8d+84) then
            tmp = y * (4.0d0 + ((-6.0d0) * z))
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = x * (-3.0 + (z * 6.0));
    	double tmp;
    	if (x <= -6.2e+41) {
    		tmp = t_0;
    	} else if (x <= 6.8e+84) {
    		tmp = y * (4.0 + (-6.0 * z));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = x * (-3.0 + (z * 6.0))
    	tmp = 0
    	if x <= -6.2e+41:
    		tmp = t_0
    	elif x <= 6.8e+84:
    		tmp = y * (4.0 + (-6.0 * z))
    	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 <= -6.2e+41)
    		tmp = t_0;
    	elseif (x <= 6.8e+84)
    		tmp = Float64(y * Float64(4.0 + Float64(-6.0 * z)));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = x * (-3.0 + (z * 6.0));
    	tmp = 0.0;
    	if (x <= -6.2e+41)
    		tmp = t_0;
    	elseif (x <= 6.8e+84)
    		tmp = y * (4.0 + (-6.0 * z));
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e+41], t$95$0, If[LessEqual[x, 6.8e+84], N[(y * N[(4.0 + N[(-6.0 * z), $MachinePrecision]), $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 -6.2 \cdot 10^{+41}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 6.8 \cdot 10^{+84}:\\
    \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -6.2e41 or 6.7999999999999996e84 < x

      1. Initial program 99.4%

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

        \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
      4. Step-by-step derivation
        1. remove-double-negN/A

          \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \left(\color{blue}{1} + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
        2. neg-mul-1N/A

          \[\leadsto \left(\mathsf{neg}\left(-1 \cdot x\right)\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
        3. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{neg}\left(\left(-1 \cdot x\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right) \]
        4. distribute-rgt-neg-inN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right)\right)} \]
        5. distribute-neg-inN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-6 \cdot \left(\frac{2}{3} - z\right)\right)\right)}\right) \]
        6. metadata-evalN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(\color{blue}{-6 \cdot \left(\frac{2}{3} - z\right)}\right)\right)\right) \]
        7. distribute-lft-neg-inN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(-6\right)\right) \cdot \color{blue}{\left(\frac{2}{3} - z\right)}\right) \]
        8. metadata-evalN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + 6 \cdot \left(\color{blue}{\frac{2}{3}} - z\right)\right) \]
        9. +-commutativeN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \color{blue}{-1}\right) \]
        10. metadata-evalN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right) \]
        11. sub-negN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - \color{blue}{1}\right) \]
        12. associate-*r*N/A

          \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)} \]
        13. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right) \]
        14. distribute-rgt-neg-inN/A

          \[\leadsto x \cdot \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)} \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)}\right) \]
        16. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right) \]
        17. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + -1\right)\right)\right)\right) \]
        18. distribute-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}\right)\right) \]
        19. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6\right)\right) \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(\color{blue}{-1}\right)\right)\right)\right) \]
        20. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(-1\right)\right)\right)\right) \]
        21. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + 1\right)\right) \]
      5. Simplified83.8%

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

      if -6.2e41 < x < 6.7999999999999996e84

      1. Initial program 99.5%

        \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + \color{blue}{x} \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)\right), \color{blue}{x}\right) \]
        3. associate-*l*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\left(y - x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right), x\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(y - x\right), \left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right), x\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right), x\right) \]
        6. sub-negN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(6 \cdot \left(\frac{2}{3} + \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
        7. distribute-lft-inN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(6 \cdot \frac{2}{3} + 6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right), x\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(\left(6 \cdot \frac{2}{3}\right), \left(6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
        9. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(\left(6 \cdot \frac{2}{3}\right), \left(6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
        10. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(6 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right)\right), x\right) \]
        11. neg-mul-1N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(6 \cdot \left(-1 \cdot z\right)\right)\right)\right), x\right) \]
        12. associate-*r*N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(\left(6 \cdot -1\right) \cdot z\right)\right)\right), x\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(-6 \cdot z\right)\right)\right), x\right) \]
        14. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \left(\left(\mathsf{neg}\left(6\right)\right) \cdot z\right)\right)\right), x\right) \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(\left(\mathsf{neg}\left(6\right)\right), z\right)\right)\right), x\right) \]
        16. metadata-eval99.8%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{+.f64}\left(4, \mathsf{*.f64}\left(-6, z\right)\right)\right), x\right) \]
      4. Applied egg-rr99.8%

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

        \[\leadsto \color{blue}{y \cdot \left(4 + -6 \cdot z\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \left(4 + -6 \cdot z\right) \cdot \color{blue}{y} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(4 + -6 \cdot z\right), \color{blue}{y}\right) \]
        3. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(4, \left(-6 \cdot z\right)\right), y\right) \]
        4. *-lowering-*.f6474.5%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(4, \mathsf{*.f64}\left(-6, z\right)\right), y\right) \]
      7. Simplified74.5%

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

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

    Alternative 12: 74.7% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{if}\;x \leq -8 \cdot 10^{+40}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+85}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\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 -8e+40)
         t_0
         (if (<= x 1.35e+85) (* 6.0 (* y (- 0.6666666666666666 z))) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = x * (-3.0 + (z * 6.0));
    	double tmp;
    	if (x <= -8e+40) {
    		tmp = t_0;
    	} else if (x <= 1.35e+85) {
    		tmp = 6.0 * (y * (0.6666666666666666 - z));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: t_0
        real(8) :: tmp
        t_0 = x * ((-3.0d0) + (z * 6.0d0))
        if (x <= (-8d+40)) then
            tmp = t_0
        else if (x <= 1.35d+85) then
            tmp = 6.0d0 * (y * (0.6666666666666666d0 - z))
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = x * (-3.0 + (z * 6.0));
    	double tmp;
    	if (x <= -8e+40) {
    		tmp = t_0;
    	} else if (x <= 1.35e+85) {
    		tmp = 6.0 * (y * (0.6666666666666666 - z));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = x * (-3.0 + (z * 6.0))
    	tmp = 0
    	if x <= -8e+40:
    		tmp = t_0
    	elif x <= 1.35e+85:
    		tmp = 6.0 * (y * (0.6666666666666666 - z))
    	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 <= -8e+40)
    		tmp = t_0;
    	elseif (x <= 1.35e+85)
    		tmp = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z)));
    	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 <= -8e+40)
    		tmp = t_0;
    	elseif (x <= 1.35e+85)
    		tmp = 6.0 * (y * (0.6666666666666666 - z));
    	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, -8e+40], t$95$0, If[LessEqual[x, 1.35e+85], N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $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 -8 \cdot 10^{+40}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 1.35 \cdot 10^{+85}:\\
    \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -8.00000000000000024e40 or 1.34999999999999992e85 < x

      1. Initial program 99.4%

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

        \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
      4. Step-by-step derivation
        1. remove-double-negN/A

          \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \left(\color{blue}{1} + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
        2. neg-mul-1N/A

          \[\leadsto \left(\mathsf{neg}\left(-1 \cdot x\right)\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right) \]
        3. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{neg}\left(\left(-1 \cdot x\right) \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right) \]
        4. distribute-rgt-neg-inN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)\right)\right)} \]
        5. distribute-neg-inN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(\left(\mathsf{neg}\left(1\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-6 \cdot \left(\frac{2}{3} - z\right)\right)\right)}\right) \]
        6. metadata-evalN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(\color{blue}{-6 \cdot \left(\frac{2}{3} - z\right)}\right)\right)\right) \]
        7. distribute-lft-neg-inN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + \left(\mathsf{neg}\left(-6\right)\right) \cdot \color{blue}{\left(\frac{2}{3} - z\right)}\right) \]
        8. metadata-evalN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(-1 + 6 \cdot \left(\color{blue}{\frac{2}{3}} - z\right)\right) \]
        9. +-commutativeN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \color{blue}{-1}\right) \]
        10. metadata-evalN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right) \]
        11. sub-negN/A

          \[\leadsto \left(-1 \cdot x\right) \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - \color{blue}{1}\right) \]
        12. associate-*r*N/A

          \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)} \]
        13. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(x \cdot \left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right) \]
        14. distribute-rgt-neg-inN/A

          \[\leadsto x \cdot \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)} \]
        15. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) - 1\right)\right)\right)}\right) \]
        16. sub-negN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right)\right) \]
        17. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right) + -1\right)\right)\right)\right) \]
        18. distribute-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6 \cdot \left(\frac{2}{3} - z\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}\right)\right) \]
        19. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\mathsf{neg}\left(6\right)\right) \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(\color{blue}{-1}\right)\right)\right)\right) \]
        20. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + \left(\mathsf{neg}\left(-1\right)\right)\right)\right) \]
        21. metadata-evalN/A

          \[\leadsto \mathsf{*.f64}\left(x, \left(-6 \cdot \left(\frac{2}{3} - z\right) + 1\right)\right) \]
      5. Simplified83.8%

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

      if -8.00000000000000024e40 < x < 1.34999999999999992e85

      1. Initial program 99.5%

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

        \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(\frac{2}{3} - z\right)\right)} \]
      4. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \left(6 \cdot y\right) \cdot \color{blue}{\left(\frac{2}{3} - z\right)} \]
        2. *-commutativeN/A

          \[\leadsto \left(\frac{2}{3} - z\right) \cdot \color{blue}{\left(6 \cdot y\right)} \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(\frac{2}{3} - z\right), \color{blue}{\left(6 \cdot y\right)}\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\frac{2}{3}, z\right), \left(\color{blue}{6} \cdot y\right)\right) \]
        5. *-lowering-*.f6474.3%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\frac{2}{3}, z\right), \mathsf{*.f64}\left(6, \color{blue}{y}\right)\right) \]
      5. Simplified74.3%

        \[\leadsto \color{blue}{\left(0.6666666666666666 - z\right) \cdot \left(6 \cdot y\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \left(\frac{2}{3} - z\right) \cdot \left(y \cdot \color{blue}{6}\right) \]
        2. associate-*r*N/A

          \[\leadsto \left(\left(\frac{2}{3} - z\right) \cdot y\right) \cdot \color{blue}{6} \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\left(\left(\frac{2}{3} - z\right) \cdot y\right), \color{blue}{6}\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\frac{2}{3} - z\right), y\right), 6\right) \]
        5. --lowering--.f6474.4%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\frac{2}{3}, z\right), y\right), 6\right) \]
      7. Applied egg-rr74.4%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+40}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+85}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 13: 37.9% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{-36}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{+52}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= x -1.3e-36) (* x -3.0) (if (<= x 1.85e+52) (* y 4.0) (* x -3.0))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (x <= -1.3e-36) {
    		tmp = x * -3.0;
    	} else if (x <= 1.85e+52) {
    		tmp = y * 4.0;
    	} else {
    		tmp = 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 (x <= (-1.3d-36)) then
            tmp = x * (-3.0d0)
        else if (x <= 1.85d+52) then
            tmp = y * 4.0d0
        else
            tmp = x * (-3.0d0)
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (x <= -1.3e-36) {
    		tmp = x * -3.0;
    	} else if (x <= 1.85e+52) {
    		tmp = y * 4.0;
    	} else {
    		tmp = x * -3.0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if x <= -1.3e-36:
    		tmp = x * -3.0
    	elif x <= 1.85e+52:
    		tmp = y * 4.0
    	else:
    		tmp = x * -3.0
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (x <= -1.3e-36)
    		tmp = Float64(x * -3.0);
    	elseif (x <= 1.85e+52)
    		tmp = Float64(y * 4.0);
    	else
    		tmp = Float64(x * -3.0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (x <= -1.3e-36)
    		tmp = x * -3.0;
    	elseif (x <= 1.85e+52)
    		tmp = y * 4.0;
    	else
    		tmp = x * -3.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[x, -1.3e-36], N[(x * -3.0), $MachinePrecision], If[LessEqual[x, 1.85e+52], N[(y * 4.0), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -1.3 \cdot 10^{-36}:\\
    \;\;\;\;x \cdot -3\\
    
    \mathbf{elif}\;x \leq 1.85 \cdot 10^{+52}:\\
    \;\;\;\;y \cdot 4\\
    
    \mathbf{else}:\\
    \;\;\;\;x \cdot -3\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -1.3e-36 or 1.85e52 < x

      1. Initial program 99.4%

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

        \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
        2. sub-negN/A

          \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
        3. neg-mul-1N/A

          \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
        4. distribute-lft-inN/A

          \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
        5. associate-+l+N/A

          \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
        6. metadata-evalN/A

          \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
        7. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
        8. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
        9. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
        10. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
        11. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
        12. *-commutativeN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
        13. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
        14. associate-*r*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
        19. associate-*l*N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
        20. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
        21. *-rgt-identityN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
        22. distribute-lft-outN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
        23. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
        24. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
        25. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
        26. metadata-eval54.6%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
      5. Simplified54.6%

        \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
      6. Taylor expanded in y around 0

        \[\leadsto \color{blue}{-3 \cdot x} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto x \cdot \color{blue}{-3} \]
        2. *-lowering-*.f6441.4%

          \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-3}\right) \]
      8. Simplified41.4%

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

      if -1.3e-36 < x < 1.85e52

      1. Initial program 99.6%

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

        \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
        2. sub-negN/A

          \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
        3. neg-mul-1N/A

          \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
        4. distribute-lft-inN/A

          \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
        5. associate-+l+N/A

          \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
        6. metadata-evalN/A

          \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
        7. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
        8. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
        9. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
        10. metadata-evalN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
        11. associate-*r*N/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
        12. *-commutativeN/A

          \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
        13. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
        14. associate-*r*N/A

          \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
        18. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
        19. associate-*l*N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
        20. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
        21. *-rgt-identityN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
        22. distribute-lft-outN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
        23. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
        24. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
        25. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
        26. metadata-eval40.2%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
      5. Simplified40.2%

        \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
      6. Taylor expanded in y around inf

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

          \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
      8. Simplified35.5%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{-36}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{+52}:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot -3\\ \end{array} \]
    5. Add Preprocessing

    Alternative 14: 99.5% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot 6 \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (+ x (* (* (- y x) (- 0.6666666666666666 z)) 6.0)))
    double code(double x, double y, double z) {
    	return x + (((y - x) * (0.6666666666666666 - z)) * 6.0);
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        code = x + (((y - x) * (0.6666666666666666d0 - z)) * 6.0d0)
    end function
    
    public static double code(double x, double y, double z) {
    	return x + (((y - x) * (0.6666666666666666 - z)) * 6.0);
    }
    
    def code(x, y, z):
    	return x + (((y - x) * (0.6666666666666666 - z)) * 6.0)
    
    function code(x, y, z)
    	return Float64(x + Float64(Float64(Float64(y - x) * Float64(0.6666666666666666 - z)) * 6.0))
    end
    
    function tmp = code(x, y, z)
    	tmp = x + (((y - x) * (0.6666666666666666 - z)) * 6.0);
    end
    
    code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    x + \left(\left(y - x\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot 6
    \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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\left(y - x\right) \cdot \color{blue}{\left(6 \cdot \left(\frac{2}{3} - z\right)\right)}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\left(y - x\right) \cdot \left(\left(\frac{2}{3} - z\right) \cdot \color{blue}{6}\right)\right)\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\left(\left(y - x\right) \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{6}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\left(\left(y - x\right) \cdot \left(\frac{2}{3} - z\right)\right), \color{blue}{6}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(y - x\right), \left(\frac{2}{3} - z\right)\right), 6\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(\frac{2}{3} - z\right)\right), 6\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{\_.f64}\left(\left(\frac{2}{3}\right), z\right)\right), 6\right)\right) \]
      8. metadata-eval99.5%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{\_.f64}\left(\frac{2}{3}, z\right)\right), 6\right)\right) \]
    4. Applied egg-rr99.5%

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

    Alternative 15: 26.6% accurate, 4.3× speedup?

    \[\begin{array}{l} \\ y \cdot 4 \end{array} \]
    (FPCore (x y z) :precision binary64 (* y 4.0))
    double code(double x, double y, double z) {
    	return y * 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 = y * 4.0d0
    end function
    
    public static double code(double x, double y, double z) {
    	return y * 4.0;
    }
    
    def code(x, y, z):
    	return y * 4.0
    
    function code(x, y, z)
    	return Float64(y * 4.0)
    end
    
    function tmp = code(x, y, z)
    	tmp = y * 4.0;
    end
    
    code[x_, y_, z_] := N[(y * 4.0), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    y \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. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 4 \cdot \left(y - x\right) + \color{blue}{x} \]
      2. sub-negN/A

        \[\leadsto 4 \cdot \left(y + \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      3. neg-mul-1N/A

        \[\leadsto 4 \cdot \left(y + -1 \cdot x\right) + x \]
      4. distribute-lft-inN/A

        \[\leadsto \left(4 \cdot y + 4 \cdot \left(-1 \cdot x\right)\right) + x \]
      5. associate-+l+N/A

        \[\leadsto 4 \cdot y + \color{blue}{\left(4 \cdot \left(-1 \cdot x\right) + x\right)} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{2}{3} \cdot 6\right) \cdot y + \left(\color{blue}{4} \cdot \left(-1 \cdot x\right) + x\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\color{blue}{4 \cdot \left(-1 \cdot x\right)} + x\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(4 \cdot -1\right) \cdot x + x\right) \]
      9. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(-4 \cdot x + x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(\frac{2}{3} \cdot -6\right) \cdot x + x\right) \]
      11. associate-*r*N/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\frac{2}{3} \cdot \left(-6 \cdot x\right) + x\right) \]
      12. *-commutativeN/A

        \[\leadsto \frac{2}{3} \cdot \left(6 \cdot y\right) + \left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right) \]
      13. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{2}{3} \cdot \left(6 \cdot y\right)\right), \color{blue}{\left(\left(-6 \cdot x\right) \cdot \frac{2}{3} + x\right)}\right) \]
      14. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{2}{3} \cdot 6\right) \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\left(4 \cdot y\right), \left(\color{blue}{\left(-6 \cdot x\right)} \cdot \frac{2}{3} + x\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(y \cdot 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\color{blue}{\left(-6 \cdot x\right) \cdot \frac{2}{3}} + x\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\left(x \cdot -6\right) \cdot \frac{2}{3} + x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(-6 \cdot \frac{2}{3}\right) + x\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x\right)\right) \]
      21. *-rgt-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -4 + x \cdot \color{blue}{1}\right)\right) \]
      22. distribute-lft-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \color{blue}{\left(-4 + 1\right)}\right)\right) \]
      23. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot -3\right)\right) \]
      24. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(x \cdot \left(1 + \color{blue}{-4}\right)\right)\right) \]
      25. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -4\right)}\right)\right) \]
      26. metadata-eval47.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(x, -3\right)\right) \]
    5. Simplified47.6%

      \[\leadsto \color{blue}{y \cdot 4 + x \cdot -3} \]
    6. Taylor expanded in y around inf

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

        \[\leadsto \mathsf{*.f64}\left(4, \color{blue}{y}\right) \]
    8. Simplified24.4%

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

      \[\leadsto y \cdot 4 \]
    10. Add Preprocessing

    Reproduce

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