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

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

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

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

      \[\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. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Add Preprocessing

Alternative 3: 75.0% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.4e53 or 6.50000000000000005e25 < x

    1. Initial program 99.4%

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

        \[\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 0 90.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.4e53 < x < -1.69999999999999991e-114

    1. Initial program 99.4%

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

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

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

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

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

    if -1.69999999999999991e-114 < x < 6.50000000000000005e25

    1. Initial program 99.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+53}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-114}:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+25}:\\ \;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 72.8% accurate, 0.6× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.00530000000000000002 or 8.5e18 < z

    1. Initial program 99.7%

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

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

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

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

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

    if -0.00530000000000000002 < z < 3.10000000000000015e-242

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

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

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

    if 3.10000000000000015e-242 < z < 8.5e18

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 72.7% accurate, 0.6× speedup?

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

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

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

    if -0.0025999999999999999 < z < 3.30000000000000026e-244

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

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

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

    if 3.30000000000000026e-244 < z < 0.5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 49.5% accurate, 0.6× speedup?

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

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

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

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

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


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

    1. Initial program 99.5%

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.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 53.6%

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

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

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

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

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

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

    if -0.660000000000000031 < z < 2.5e-248

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

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

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

    if 2.5e-248 < z < 3350

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3350 < z

    1. Initial program 99.8%

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.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 0 62.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 49.5% accurate, 0.6× speedup?

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

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

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

    if -0.660000000000000031 < z < 7.09999999999999962e-242

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

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

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

    if 7.09999999999999962e-242 < z < 3350

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3350 < z

    1. Initial program 99.8%

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

        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) + x} \]
      2. associate-*l*99.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 0 62.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 49.7% accurate, 0.6× speedup?

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

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

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

    if -0.660000000000000031 < z < 6.3999999999999997e-234

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

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

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

    if 6.3999999999999997e-234 < z < 0.599999999999999978

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot -3} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 97.5% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

    if -0.660000000000000031 < z < 0.599999999999999978

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

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

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

    if 0.599999999999999978 < z

    1. Initial program 99.7%

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

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

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

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

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

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

Alternative 10: 97.5% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 99.5%

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

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

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

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

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

    if -0.599999999999999978 < z < 0.52000000000000002

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

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

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

    if 0.52000000000000002 < z

    1. Initial program 99.7%

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

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

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

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

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

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

Alternative 11: 97.5% accurate, 0.8× speedup?

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

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

\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.599999999999999978

    1. Initial program 99.5%

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

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

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

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

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

    if -0.599999999999999978 < z < 0.5

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

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

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

    if 0.5 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 97.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.58:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 0.54:\\ \;\;\;\;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.58)
   (* -6.0 (* (- y x) z))
   (if (<= z 0.54) (+ x (* (- y x) 4.0)) (* z (* (- y x) -6.0)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.58) {
		tmp = -6.0 * ((y - x) * z);
	} else if (z <= 0.54) {
		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.58d0)) then
        tmp = (-6.0d0) * ((y - x) * z)
    else if (z <= 0.54d0) 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.58) {
		tmp = -6.0 * ((y - x) * z);
	} else if (z <= 0.54) {
		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.58:
		tmp = -6.0 * ((y - x) * z)
	elif z <= 0.54:
		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.58)
		tmp = Float64(-6.0 * Float64(Float64(y - x) * z));
	elseif (z <= 0.54)
		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.58)
		tmp = -6.0 * ((y - x) * z);
	elseif (z <= 0.54)
		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.58], N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.54], 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.58:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\

\mathbf{elif}\;z \leq 0.54:\\
\;\;\;\;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.57999999999999996

    1. Initial program 99.5%

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

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

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

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

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

    if -0.57999999999999996 < z < 0.54000000000000004

    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. Taylor expanded in z around 0 97.8%

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

    if 0.54000000000000004 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.58:\\ \;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\ \mathbf{elif}\;z \leq 0.54:\\ \;\;\;\;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 13: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

Alternative 14: 38.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+90} \lor \neg \left(y \leq 9.4 \cdot 10^{+52}\right):\\
\;\;\;\;y \cdot 4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.8e90 or 9.3999999999999999e52 < y

    1. Initial program 99.5%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\left(\frac{2}{3} + \left(-z\right)\right)}, x\right) \]
      5. distribute-rgt-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 82.7%

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

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

    if -2.8e90 < y < 9.3999999999999999e52

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

Alternative 16: 99.5% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 17: 26.9% 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.4%

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

      \[\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 0 53.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot -3} \]
  11. Add Preprocessing

Reproduce

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