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

Percentage Accurate: 99.5% → 99.8%
Time: 11.8s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.1× speedup?

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

\\
\mathsf{fma}\left(y - x, 4 + z \cdot -6, x\right)
\end{array}
Derivation
  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.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. Final simplification99.8%

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

Alternative 2: 50.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -0.09:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-83}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-185}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-225}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-303}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-259}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-73}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;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 -0.09)
     t_0
     (if (<= z -5e-83)
       (* y 4.0)
       (if (<= z -3e-185)
         (* x -3.0)
         (if (<= z -1.7e-225)
           (* y 4.0)
           (if (<= z 1.1e-303)
             (* x -3.0)
             (if (<= z 1.9e-259)
               (* y 4.0)
               (if (<= z 5.8e-73)
                 (* x -3.0)
                 (if (<= z 0.5) (* y 4.0) t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -0.09) {
		tmp = t_0;
	} else if (z <= -5e-83) {
		tmp = y * 4.0;
	} else if (z <= -3e-185) {
		tmp = x * -3.0;
	} else if (z <= -1.7e-225) {
		tmp = y * 4.0;
	} else if (z <= 1.1e-303) {
		tmp = x * -3.0;
	} else if (z <= 1.9e-259) {
		tmp = y * 4.0;
	} else if (z <= 5.8e-73) {
		tmp = x * -3.0;
	} else if (z <= 0.5) {
		tmp = y * 4.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    if (z <= (-0.09d0)) then
        tmp = t_0
    else if (z <= (-5d-83)) then
        tmp = y * 4.0d0
    else if (z <= (-3d-185)) then
        tmp = x * (-3.0d0)
    else if (z <= (-1.7d-225)) then
        tmp = y * 4.0d0
    else if (z <= 1.1d-303) then
        tmp = x * (-3.0d0)
    else if (z <= 1.9d-259) then
        tmp = y * 4.0d0
    else if (z <= 5.8d-73) then
        tmp = x * (-3.0d0)
    else if (z <= 0.5d0) then
        tmp = y * 4.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double tmp;
	if (z <= -0.09) {
		tmp = t_0;
	} else if (z <= -5e-83) {
		tmp = y * 4.0;
	} else if (z <= -3e-185) {
		tmp = x * -3.0;
	} else if (z <= -1.7e-225) {
		tmp = y * 4.0;
	} else if (z <= 1.1e-303) {
		tmp = x * -3.0;
	} else if (z <= 1.9e-259) {
		tmp = y * 4.0;
	} else if (z <= 5.8e-73) {
		tmp = x * -3.0;
	} else if (z <= 0.5) {
		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 <= -0.09:
		tmp = t_0
	elif z <= -5e-83:
		tmp = y * 4.0
	elif z <= -3e-185:
		tmp = x * -3.0
	elif z <= -1.7e-225:
		tmp = y * 4.0
	elif z <= 1.1e-303:
		tmp = x * -3.0
	elif z <= 1.9e-259:
		tmp = y * 4.0
	elif z <= 5.8e-73:
		tmp = x * -3.0
	elif z <= 0.5:
		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 <= -0.09)
		tmp = t_0;
	elseif (z <= -5e-83)
		tmp = Float64(y * 4.0);
	elseif (z <= -3e-185)
		tmp = Float64(x * -3.0);
	elseif (z <= -1.7e-225)
		tmp = Float64(y * 4.0);
	elseif (z <= 1.1e-303)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.9e-259)
		tmp = Float64(y * 4.0);
	elseif (z <= 5.8e-73)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.5)
		tmp = Float64(y * 4.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	tmp = 0.0;
	if (z <= -0.09)
		tmp = t_0;
	elseif (z <= -5e-83)
		tmp = y * 4.0;
	elseif (z <= -3e-185)
		tmp = x * -3.0;
	elseif (z <= -1.7e-225)
		tmp = y * 4.0;
	elseif (z <= 1.1e-303)
		tmp = x * -3.0;
	elseif (z <= 1.9e-259)
		tmp = y * 4.0;
	elseif (z <= 5.8e-73)
		tmp = x * -3.0;
	elseif (z <= 0.5)
		tmp = y * 4.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.09], t$95$0, If[LessEqual[z, -5e-83], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -3e-185], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -1.7e-225], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.1e-303], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.9e-259], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 5.8e-73], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.5], 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 -0.09:\\
\;\;\;\;t\_0\\

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

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

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

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

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\mathsf{fma}\left(z, -6, 4\right)}\right) \]
      12. unsub-neg47.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.089999999999999997 < z < -5e-83 or -3.0000000000000003e-185 < z < -1.7e-225 or 1.10000000000000007e-303 < z < 1.9e-259 or 5.8e-73 < z < 0.5

    1. Initial program 98.2%

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

        \[\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-in99.9%

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

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

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

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

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

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

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

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

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

    if -5e-83 < z < -3.0000000000000003e-185 or -1.7e-225 < z < 1.10000000000000007e-303 or 1.9e-259 < z < 5.8e-73

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\mathsf{fma}\left(z, -6, 4\right)}\right) \]
      12. unsub-neg66.6%

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

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      17. distribute-rgt-in66.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.09:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-83}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-185}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-225}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-303}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-259}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-73}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 50.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.0066:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-82}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-186}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-225}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-303}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-263}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -0.0066)
   (* x (* z 6.0))
   (if (<= z -1.4e-82)
     (* y 4.0)
     (if (<= z -9.5e-186)
       (* x -3.0)
       (if (<= z -2.8e-225)
         (* y 4.0)
         (if (<= z 8e-303)
           (* x -3.0)
           (if (<= z 6.2e-263)
             (* y 4.0)
             (if (<= z 2.55e-71)
               (* x -3.0)
               (if (<= z 0.6) (* y 4.0) (* 6.0 (* x z)))))))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.0066) {
		tmp = x * (z * 6.0);
	} else if (z <= -1.4e-82) {
		tmp = y * 4.0;
	} else if (z <= -9.5e-186) {
		tmp = x * -3.0;
	} else if (z <= -2.8e-225) {
		tmp = y * 4.0;
	} else if (z <= 8e-303) {
		tmp = x * -3.0;
	} else if (z <= 6.2e-263) {
		tmp = y * 4.0;
	} else if (z <= 2.55e-71) {
		tmp = x * -3.0;
	} else if (z <= 0.6) {
		tmp = y * 4.0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-0.0066d0)) then
        tmp = x * (z * 6.0d0)
    else if (z <= (-1.4d-82)) then
        tmp = y * 4.0d0
    else if (z <= (-9.5d-186)) then
        tmp = x * (-3.0d0)
    else if (z <= (-2.8d-225)) then
        tmp = y * 4.0d0
    else if (z <= 8d-303) then
        tmp = x * (-3.0d0)
    else if (z <= 6.2d-263) then
        tmp = y * 4.0d0
    else if (z <= 2.55d-71) then
        tmp = x * (-3.0d0)
    else if (z <= 0.6d0) then
        tmp = y * 4.0d0
    else
        tmp = 6.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.0066) {
		tmp = x * (z * 6.0);
	} else if (z <= -1.4e-82) {
		tmp = y * 4.0;
	} else if (z <= -9.5e-186) {
		tmp = x * -3.0;
	} else if (z <= -2.8e-225) {
		tmp = y * 4.0;
	} else if (z <= 8e-303) {
		tmp = x * -3.0;
	} else if (z <= 6.2e-263) {
		tmp = y * 4.0;
	} else if (z <= 2.55e-71) {
		tmp = x * -3.0;
	} else if (z <= 0.6) {
		tmp = y * 4.0;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.0066:
		tmp = x * (z * 6.0)
	elif z <= -1.4e-82:
		tmp = y * 4.0
	elif z <= -9.5e-186:
		tmp = x * -3.0
	elif z <= -2.8e-225:
		tmp = y * 4.0
	elif z <= 8e-303:
		tmp = x * -3.0
	elif z <= 6.2e-263:
		tmp = y * 4.0
	elif z <= 2.55e-71:
		tmp = x * -3.0
	elif z <= 0.6:
		tmp = y * 4.0
	else:
		tmp = 6.0 * (x * z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.0066)
		tmp = Float64(x * Float64(z * 6.0));
	elseif (z <= -1.4e-82)
		tmp = Float64(y * 4.0);
	elseif (z <= -9.5e-186)
		tmp = Float64(x * -3.0);
	elseif (z <= -2.8e-225)
		tmp = Float64(y * 4.0);
	elseif (z <= 8e-303)
		tmp = Float64(x * -3.0);
	elseif (z <= 6.2e-263)
		tmp = Float64(y * 4.0);
	elseif (z <= 2.55e-71)
		tmp = Float64(x * -3.0);
	elseif (z <= 0.6)
		tmp = Float64(y * 4.0);
	else
		tmp = Float64(6.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.0066)
		tmp = x * (z * 6.0);
	elseif (z <= -1.4e-82)
		tmp = y * 4.0;
	elseif (z <= -9.5e-186)
		tmp = x * -3.0;
	elseif (z <= -2.8e-225)
		tmp = y * 4.0;
	elseif (z <= 8e-303)
		tmp = x * -3.0;
	elseif (z <= 6.2e-263)
		tmp = y * 4.0;
	elseif (z <= 2.55e-71)
		tmp = x * -3.0;
	elseif (z <= 0.6)
		tmp = y * 4.0;
	else
		tmp = 6.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -0.0066], N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.4e-82], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -9.5e-186], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -2.8e-225], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 8e-303], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 6.2e-263], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 2.55e-71], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.6], N[(y * 4.0), $MachinePrecision], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

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

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

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

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

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

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

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

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


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

    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 x around inf 46.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\mathsf{fma}\left(z, -6, 4\right)}\right) \]
      12. unsub-neg46.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z \cdot 6\right)} \]
    10. Simplified44.3%

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

    if -0.0066 < z < -1.40000000000000012e-82 or -9.4999999999999998e-186 < z < -2.8e-225 or 7.99999999999999944e-303 < z < 6.20000000000000008e-263 or 2.5500000000000001e-71 < z < 0.599999999999999978

    1. Initial program 98.2%

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

        \[\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-in99.9%

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

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

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

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

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

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

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

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

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

    if -1.40000000000000012e-82 < z < -9.4999999999999998e-186 or -2.8e-225 < z < 7.99999999999999944e-303 or 6.20000000000000008e-263 < z < 2.5500000000000001e-71

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\mathsf{fma}\left(z, -6, 4\right)}\right) \]
      12. unsub-neg66.6%

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

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
      17. distribute-rgt-in66.6%

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

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

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

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

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

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

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

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

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

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

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

    if 0.599999999999999978 < 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 x around inf 48.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.0066:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-82}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-186}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-225}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-303}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-263}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-71}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;y \cdot 4\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 37.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+79} \lor \neg \left(x \leq -2.15 \cdot 10^{-51} \lor \neg \left(x \leq -2.5 \cdot 10^{-156}\right) \land x \leq 9 \cdot 10^{-37}\right):\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.99999999999999948e79 or -2.1499999999999999e-51 < x < -2.50000000000000004e-156 or 9.00000000000000081e-37 < x

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\mathsf{fma}\left(z, -6, 4\right)}\right) \]
      12. unsub-neg72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.99999999999999948e79 < x < -2.1499999999999999e-51 or -2.50000000000000004e-156 < x < 9.00000000000000081e-37

    1. Initial program 99.0%

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

        \[\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 74.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{+79} \lor \neg \left(x \leq -2.15 \cdot 10^{-51} \lor \neg \left(x \leq -2.5 \cdot 10^{-156}\right) \land x \leq 9 \cdot 10^{-37}\right):\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;y \cdot 4\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 58.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.0499999999999999e90 or 1.4000000000000001e-16 < x

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 - \color{blue}{\mathsf{fma}\left(z, -6, 4\right)}\right) \]
      12. unsub-neg76.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.0499999999999999e90 < x < 1.4000000000000001e-16

    1. Initial program 99.1%

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}} \]
      2. clear-num61.8%

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

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}}{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
      4. pow261.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{\color{blue}{{x}^{2}} - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
      5. pow261.8%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - \color{blue}{{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}^{2}}}} \]
      6. associate-*l*62.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\color{blue}{\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}}^{2}}} \]
    6. Applied egg-rr62.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}} \]
    7. Step-by-step derivation
      1. frac-2neg62.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{-\left(x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      2. distribute-frac-neg62.0%

        \[\leadsto \frac{1}{\color{blue}{-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      3. distribute-neg-frac262.0%

        \[\leadsto \frac{1}{-\color{blue}{\left(-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}\right)}} \]
      4. /-rgt-identity62.0%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}{1}}\right)} \]
      5. clear-num62.0%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}\right)} \]
      6. distribute-neg-frac62.0%

        \[\leadsto \frac{1}{-\color{blue}{\frac{-1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}} \]
      7. metadata-eval62.0%

        \[\leadsto \frac{1}{-\frac{\color{blue}{-1}}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}} \]
      8. clear-num62.0%

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

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

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

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

Alternative 6: 74.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-118} \lor \neg \left(x \leq 3.5 \cdot 10^{-38}\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.6e-118 or 3.5000000000000001e-38 < x

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.6e-118 < x < 3.5000000000000001e-38

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

        \[\leadsto \color{blue}{\frac{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}} \]
      2. clear-num63.2%

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

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}}{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
      4. pow263.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{\color{blue}{{x}^{2}} - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
      5. pow263.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - \color{blue}{{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}^{2}}}} \]
      6. associate-*l*63.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\color{blue}{\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}}^{2}}} \]
    6. Applied egg-rr63.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}} \]
    7. Step-by-step derivation
      1. frac-2neg63.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{-\left(x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      2. distribute-frac-neg63.3%

        \[\leadsto \frac{1}{\color{blue}{-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      3. distribute-neg-frac263.3%

        \[\leadsto \frac{1}{-\color{blue}{\left(-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}\right)}} \]
      4. /-rgt-identity63.3%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}{1}}\right)} \]
      5. clear-num63.3%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}\right)} \]
      6. distribute-neg-frac63.3%

        \[\leadsto \frac{1}{-\color{blue}{\frac{-1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}} \]
      7. metadata-eval63.3%

        \[\leadsto \frac{1}{-\frac{\color{blue}{-1}}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}} \]
      8. clear-num63.3%

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

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

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

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

Alternative 7: 74.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.6e-118 or 3e-37 < x

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.6e-118 < x < 3e-37

    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 82.0%

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

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

Alternative 8: 97.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.56 \lor \neg \left(z \leq 0.66\right):\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -0.56) (not (<= z 0.66)))
   (* z (* (- y x) -6.0))
   (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.56) || !(z <= 0.66)) {
		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.56d0)) .or. (.not. (z <= 0.66d0))) 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.56) || !(z <= 0.66)) {
		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.56) or not (z <= 0.66):
		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.56) || !(z <= 0.66))
		tmp = Float64(z * Float64(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.56) || ~((z <= 0.66)))
		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.56], N[Not[LessEqual[z, 0.66]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.56000000000000005 or 0.660000000000000031 < 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. Step-by-step derivation
      1. flip-+33.5%

        \[\leadsto \color{blue}{\frac{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}} \]
      2. clear-num33.5%

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

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

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{\color{blue}{{x}^{2}} - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
      5. pow233.3%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - \color{blue}{{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}^{2}}}} \]
      6. associate-*l*33.4%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\color{blue}{\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}}^{2}}} \]
    6. Applied egg-rr33.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}} \]
    7. Step-by-step derivation
      1. frac-2neg33.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{-\left(x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      2. distribute-frac-neg33.4%

        \[\leadsto \frac{1}{\color{blue}{-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      3. distribute-neg-frac233.4%

        \[\leadsto \frac{1}{-\color{blue}{\left(-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}\right)}} \]
      4. /-rgt-identity33.4%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}{1}}\right)} \]
      5. clear-num33.4%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}\right)} \]
      6. distribute-neg-frac33.4%

        \[\leadsto \frac{1}{-\color{blue}{\frac{-1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}} \]
      7. metadata-eval33.4%

        \[\leadsto \frac{1}{-\frac{\color{blue}{-1}}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}} \]
      8. clear-num33.4%

        \[\leadsto \frac{1}{-\frac{-1}{\color{blue}{\frac{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}}}} \]
    8. Applied egg-rr99.7%

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

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

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

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

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

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

    if -0.56000000000000005 < z < 0.660000000000000031

    1. Initial program 98.9%

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

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified98.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 z around 0 98.5%

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

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

Alternative 9: 97.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;x - -6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{elif}\;z \leq 0.6:\\ \;\;\;\;x + \left(y - x\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -0.66)
   (- x (* -6.0 (* z (- x y))))
   (if (<= z 0.6) (+ 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 - (-6.0 * (z * (x - y)));
	} else if (z <= 0.6) {
		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 - ((-6.0d0) * (z * (x - y)))
    else if (z <= 0.6d0) 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 - (-6.0 * (z * (x - y)));
	} else if (z <= 0.6) {
		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 - (-6.0 * (z * (x - y)))
	elif z <= 0.6:
		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(-6.0 * Float64(z * Float64(x - y))));
	elseif (z <= 0.6)
		tmp = Float64(x + Float64(Float64(y - x) * 4.0));
	else
		tmp = Float64(z * Float64(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 - (-6.0 * (z * (x - y)));
	elseif (z <= 0.6)
		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[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.6], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    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 97.7%

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

    if -0.660000000000000031 < z < 0.599999999999999978

    1. Initial program 98.9%

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

        \[\leadsto x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\color{blue}{0.6666666666666666} - z\right) \]
    3. Simplified98.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 z around 0 98.5%

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

    if 0.599999999999999978 < 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. Step-by-step derivation
      1. flip-+32.2%

        \[\leadsto \color{blue}{\frac{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}} \]
      2. clear-num32.2%

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

        \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}}{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
      4. pow232.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{\color{blue}{{x}^{2}} - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
      5. pow232.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - \color{blue}{{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}^{2}}}} \]
      6. associate-*l*32.0%

        \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\color{blue}{\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}}^{2}}} \]
    6. Applied egg-rr32.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}} \]
    7. Step-by-step derivation
      1. frac-2neg32.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{-\left(x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      2. distribute-frac-neg32.0%

        \[\leadsto \frac{1}{\color{blue}{-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
      3. distribute-neg-frac232.0%

        \[\leadsto \frac{1}{-\color{blue}{\left(-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}\right)}} \]
      4. /-rgt-identity32.0%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}{1}}\right)} \]
      5. clear-num32.0%

        \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}\right)} \]
      6. distribute-neg-frac32.0%

        \[\leadsto \frac{1}{-\color{blue}{\frac{-1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}} \]
      7. metadata-eval32.0%

        \[\leadsto \frac{1}{-\frac{\color{blue}{-1}}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}} \]
      8. clear-num32.0%

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

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

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

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

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

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

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

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

Alternative 10: 99.6% accurate, 0.9× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}{x - \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)}} \]
    2. clear-num47.6%

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

      \[\leadsto \frac{1}{\frac{x - \color{blue}{\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}}{x \cdot x - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
    4. pow247.5%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{\color{blue}{{x}^{2}} - \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right) \cdot \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}} \]
    5. pow247.5%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - \color{blue}{{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)\right)}^{2}}}} \]
    6. associate-*l*47.7%

      \[\leadsto \frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\color{blue}{\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}}^{2}}} \]
  6. Applied egg-rr47.7%

    \[\leadsto \color{blue}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}} \]
  7. Step-by-step derivation
    1. frac-2neg47.7%

      \[\leadsto \frac{1}{\color{blue}{\frac{-\left(x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
    2. distribute-frac-neg47.7%

      \[\leadsto \frac{1}{\color{blue}{-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{-\left({x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}\right)}}} \]
    3. distribute-neg-frac247.7%

      \[\leadsto \frac{1}{-\color{blue}{\left(-\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}\right)}} \]
    4. /-rgt-identity47.7%

      \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}{1}}\right)} \]
    5. clear-num47.7%

      \[\leadsto \frac{1}{-\left(-\color{blue}{\frac{1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}\right)} \]
    6. distribute-neg-frac47.7%

      \[\leadsto \frac{1}{-\color{blue}{\frac{-1}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}}} \]
    7. metadata-eval47.7%

      \[\leadsto \frac{1}{-\frac{\color{blue}{-1}}{\frac{1}{\frac{x - \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)}{{x}^{2} - {\left(\left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)\right)}^{2}}}}} \]
    8. clear-num47.7%

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

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

    \[\leadsto \frac{1}{\frac{-1}{\left(y - x\right) \cdot \left(6 \cdot \left(z - 0.6666666666666666\right)\right) - x}} \]
  10. Add Preprocessing

Alternative 11: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 12: 26.4% 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.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \left(1 - \color{blue}{\mathsf{fma}\left(z, -6, 4\right)}\right) \]
    12. unsub-neg50.1%

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

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

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

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

      \[\leadsto x \cdot \left(1 + \color{blue}{-1 \cdot \left(4 + -6 \cdot z\right)}\right) \]
    17. distribute-rgt-in50.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 2.6% accurate, 13.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto x \]
  8. Add Preprocessing

Reproduce

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