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

Percentage Accurate: 99.5% → 99.7%
Time: 17.2s
Alternatives: 16
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ x + \mathsf{fma}\left(z \cdot \left(y - x\right), -6, \left(y - x\right) \cdot 4\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (fma (* z (- y x)) -6.0 (* (- y x) 4.0))))
double code(double x, double y, double z) {
	return x + fma((z * (y - x)), -6.0, ((y - x) * 4.0));
}
function code(x, y, z)
	return Float64(x + fma(Float64(z * Float64(y - x)), -6.0, Float64(Float64(y - x) * 4.0)))
end
code[x_, y_, z_] := N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] * -6.0 + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

Alternative 2: 49.6% accurate, 0.5× speedup?

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

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

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

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

    if -3.8999999999999999e149 < z < -0.00880000000000000053

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.00880000000000000053 < z < -2.24999999999999986e-136

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.24999999999999986e-136 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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. Step-by-step derivation
      1. metadata-eval99.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.9 \cdot 10^{+149}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -0.0088:\\ \;\;\;\;y \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 49.7% accurate, 0.5× speedup?

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

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

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

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

    if -2.2e149 < z < -1.5

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5 < z < -1.6e-131

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6e-131 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*57.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 49.8% accurate, 0.5× speedup?

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

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

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

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

    if -4.4000000000000002e154 < z < -0.062

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.062 < z < -5.79999999999999986e-134

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999986e-134 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*57.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.4 \cdot 10^{+154}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -0.062:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-134}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 49.9% accurate, 0.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.1999999999999999e157 or 0.650000000000000022 < z

    1. Initial program 99.8%

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

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

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

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

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

    if -3.1999999999999999e157 < z < -0.107999999999999999

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.107999999999999999 < z < -3.39999999999999983e-132

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.39999999999999983e-132 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{+157}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -0.108:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-132}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 73.9% accurate, 0.6× speedup?

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

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

    if -3.9e5 < z < -8.5999999999999994e-132

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.5999999999999994e-132 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 73.4% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.1000000000000001e-7 or 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. Step-by-step derivation
      1. metadata-eval99.7%

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

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

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

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

    if -1.1000000000000001e-7 < z < -7.5000000000000003e-136

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.5000000000000003e-136 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{-7}:\\ \;\;\;\;\left(z \cdot \left(y - x\right)\right) \cdot -6\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-136}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \left(y - x\right)\right) \cdot -6\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 50.7% accurate, 0.6× speedup?

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

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.880000000000000004 < z < -5.3000000000000003e-132

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.3000000000000003e-132 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.88:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -5.3 \cdot 10^{-132}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 97.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

    if -0.599999999999999978 < z < 0.55000000000000004

    1. Initial program 99.4%

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

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

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

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

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

Alternative 10: 74.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-23} \lor \neg \left(y \leq 1.65 \cdot 10^{-83}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.19999999999999976e-23 or 1.65e-83 < y

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.19999999999999976e-23 < y < 1.65e-83

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 97.7% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(y \cdot -6\right) \cdot z + \color{blue}{\left(-\left(-6 \cdot z\right) \cdot x\right)}\right) \]
      12. distribute-rgt-neg-out97.5%

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

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

        \[\leadsto x + \left(\left(y \cdot -6\right) \cdot z + \color{blue}{\left(\left(-x\right) \cdot -6\right) \cdot z}\right) \]
      15. distribute-rgt-out99.2%

        \[\leadsto x + \color{blue}{z \cdot \left(y \cdot -6 + \left(-x\right) \cdot -6\right)} \]
      16. distribute-rgt-in99.2%

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

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

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

    if -0.660000000000000031 < z < 0.5

    1. Initial program 99.4%

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

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

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

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

    if 0.5 < z

    1. Initial program 99.7%

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

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

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

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

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

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

Alternative 12: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

Alternative 13: 38.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-23} \lor \neg \left(y \leq 4.1 \cdot 10^{-83}\right):\\
\;\;\;\;y \cdot 4\\

\mathbf{else}:\\
\;\;\;\;x \cdot -3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.3000000000000001e-23 or 4.1e-83 < y

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3000000000000001e-23 < y < 4.1e-83

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
      6. associate-*r*80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{-23} \lor \neg \left(y \leq 4.1 \cdot 10^{-83}\right):\\ \;\;\;\;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 6\right) \cdot \left(0.6666666666666666 - z\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- 0.6666666666666666 z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * (0.6666666666666666d0 - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * (0.6666666666666666 - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(0.6666666666666666 - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * (0.6666666666666666 - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

Alternative 15: 27.0% accurate, 4.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 \cdot x + -1 \cdot \left(\color{blue}{\mathsf{fma}\left(z, -6, 4\right)} \cdot x\right) \]
    6. associate-*r*48.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot -3} \]
  11. Add Preprocessing

Alternative 16: 2.5% accurate, 13.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 99.6%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. metadata-eval99.6%

      \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in z around inf 47.2%

    \[\leadsto x + \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
  6. Taylor expanded in z around 0 2.8%

    \[\leadsto \color{blue}{x} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024172 
(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))))