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

Percentage Accurate: 99.6% → 99.7%
Time: 12.1s
Alternatives: 14
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 14 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.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

Alternative 2: 50.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(x \cdot z\right)\\ t_1 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -5 \cdot 10^{+203}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{+170}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{+66}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-84}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-213}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+52}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* x z))) (t_1 (* -6.0 (* z y))))
   (if (<= z -5e+203)
     t_0
     (if (<= z -2.15e+170)
       t_1
       (if (<= z -2.3e+66)
         t_0
         (if (<= z -3.8e-14)
           t_1
           (if (<= z -9e-84)
             (* x -3.0)
             (if (<= z 4.4e-213)
               (* y 4.0)
               (if (<= z 0.5) (* x -3.0) (if (<= z 3.4e+52) t_1 t_0))))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (z * y);
	double tmp;
	if (z <= -5e+203) {
		tmp = t_0;
	} else if (z <= -2.15e+170) {
		tmp = t_1;
	} else if (z <= -2.3e+66) {
		tmp = t_0;
	} else if (z <= -3.8e-14) {
		tmp = t_1;
	} else if (z <= -9e-84) {
		tmp = x * -3.0;
	} else if (z <= 4.4e-213) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 3.4e+52) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = 6.0d0 * (x * z)
    t_1 = (-6.0d0) * (z * y)
    if (z <= (-5d+203)) then
        tmp = t_0
    else if (z <= (-2.15d+170)) then
        tmp = t_1
    else if (z <= (-2.3d+66)) then
        tmp = t_0
    else if (z <= (-3.8d-14)) then
        tmp = t_1
    else if (z <= (-9d-84)) then
        tmp = x * (-3.0d0)
    else if (z <= 4.4d-213) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 3.4d+52) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (x * z);
	double t_1 = -6.0 * (z * y);
	double tmp;
	if (z <= -5e+203) {
		tmp = t_0;
	} else if (z <= -2.15e+170) {
		tmp = t_1;
	} else if (z <= -2.3e+66) {
		tmp = t_0;
	} else if (z <= -3.8e-14) {
		tmp = t_1;
	} else if (z <= -9e-84) {
		tmp = x * -3.0;
	} else if (z <= 4.4e-213) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 3.4e+52) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (x * z)
	t_1 = -6.0 * (z * y)
	tmp = 0
	if z <= -5e+203:
		tmp = t_0
	elif z <= -2.15e+170:
		tmp = t_1
	elif z <= -2.3e+66:
		tmp = t_0
	elif z <= -3.8e-14:
		tmp = t_1
	elif z <= -9e-84:
		tmp = x * -3.0
	elif z <= 4.4e-213:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 3.4e+52:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(x * z))
	t_1 = Float64(-6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -5e+203)
		tmp = t_0;
	elseif (z <= -2.15e+170)
		tmp = t_1;
	elseif (z <= -2.3e+66)
		tmp = t_0;
	elseif (z <= -3.8e-14)
		tmp = t_1;
	elseif (z <= -9e-84)
		tmp = Float64(x * -3.0);
	elseif (z <= 4.4e-213)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.4e+52)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (x * z);
	t_1 = -6.0 * (z * y);
	tmp = 0.0;
	if (z <= -5e+203)
		tmp = t_0;
	elseif (z <= -2.15e+170)
		tmp = t_1;
	elseif (z <= -2.3e+66)
		tmp = t_0;
	elseif (z <= -3.8e-14)
		tmp = t_1;
	elseif (z <= -9e-84)
		tmp = x * -3.0;
	elseif (z <= 4.4e-213)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 3.4e+52)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+203], t$95$0, If[LessEqual[z, -2.15e+170], t$95$1, If[LessEqual[z, -2.3e+66], t$95$0, If[LessEqual[z, -3.8e-14], t$95$1, If[LessEqual[z, -9e-84], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4.4e-213], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.4e+52], t$95$1, t$95$0]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.15 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2.3 \cdot 10^{+66}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 4.4 \cdot 10^{-213}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 3.4 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.99999999999999994e203 or -2.1499999999999999e170 < z < -2.3e66 or 3.4e52 < z

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999994e203 < z < -2.1499999999999999e170 or -2.3e66 < z < -3.8000000000000002e-14 or 0.5 < z < 3.4e52

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e-14 < z < -9.00000000000000031e-84 or 4.40000000000000019e-213 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.00000000000000031e-84 < z < 4.40000000000000019e-213

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+203}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{+170}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{+66}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-84}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-213}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+52}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 50.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ t_1 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+203}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.66 \cdot 10^{+170}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4.3 \cdot 10^{+64}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-79}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-212}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+52}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))) (t_1 (* -6.0 (* z y))))
   (if (<= z -5.5e+203)
     t_0
     (if (<= z -1.66e+170)
       t_1
       (if (<= z -4.3e+64)
         t_0
         (if (<= z -3.8e-14)
           t_1
           (if (<= z -7.8e-79)
             (* x -3.0)
             (if (<= z 1.02e-212)
               (* y 4.0)
               (if (<= z 0.5)
                 (* x -3.0)
                 (if (<= z 5.8e+52) t_1 (* 6.0 (* x z))))))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (z * y);
	double tmp;
	if (z <= -5.5e+203) {
		tmp = t_0;
	} else if (z <= -1.66e+170) {
		tmp = t_1;
	} else if (z <= -4.3e+64) {
		tmp = t_0;
	} else if (z <= -3.8e-14) {
		tmp = t_1;
	} else if (z <= -7.8e-79) {
		tmp = x * -3.0;
	} else if (z <= 1.02e-212) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 5.8e+52) {
		tmp = t_1;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (z * 6.0d0)
    t_1 = (-6.0d0) * (z * y)
    if (z <= (-5.5d+203)) then
        tmp = t_0
    else if (z <= (-1.66d+170)) then
        tmp = t_1
    else if (z <= (-4.3d+64)) then
        tmp = t_0
    else if (z <= (-3.8d-14)) then
        tmp = t_1
    else if (z <= (-7.8d-79)) then
        tmp = x * (-3.0d0)
    else if (z <= 1.02d-212) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 5.8d+52) then
        tmp = t_1
    else
        tmp = 6.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (z * y);
	double tmp;
	if (z <= -5.5e+203) {
		tmp = t_0;
	} else if (z <= -1.66e+170) {
		tmp = t_1;
	} else if (z <= -4.3e+64) {
		tmp = t_0;
	} else if (z <= -3.8e-14) {
		tmp = t_1;
	} else if (z <= -7.8e-79) {
		tmp = x * -3.0;
	} else if (z <= 1.02e-212) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 5.8e+52) {
		tmp = t_1;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	t_1 = -6.0 * (z * y)
	tmp = 0
	if z <= -5.5e+203:
		tmp = t_0
	elif z <= -1.66e+170:
		tmp = t_1
	elif z <= -4.3e+64:
		tmp = t_0
	elif z <= -3.8e-14:
		tmp = t_1
	elif z <= -7.8e-79:
		tmp = x * -3.0
	elif z <= 1.02e-212:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 5.8e+52:
		tmp = t_1
	else:
		tmp = 6.0 * (x * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	t_1 = Float64(-6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -5.5e+203)
		tmp = t_0;
	elseif (z <= -1.66e+170)
		tmp = t_1;
	elseif (z <= -4.3e+64)
		tmp = t_0;
	elseif (z <= -3.8e-14)
		tmp = t_1;
	elseif (z <= -7.8e-79)
		tmp = Float64(x * -3.0);
	elseif (z <= 1.02e-212)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 5.8e+52)
		tmp = t_1;
	else
		tmp = Float64(6.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	t_1 = -6.0 * (z * y);
	tmp = 0.0;
	if (z <= -5.5e+203)
		tmp = t_0;
	elseif (z <= -1.66e+170)
		tmp = t_1;
	elseif (z <= -4.3e+64)
		tmp = t_0;
	elseif (z <= -3.8e-14)
		tmp = t_1;
	elseif (z <= -7.8e-79)
		tmp = x * -3.0;
	elseif (z <= 1.02e-212)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 5.8e+52)
		tmp = t_1;
	else
		tmp = 6.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+203], t$95$0, If[LessEqual[z, -1.66e+170], t$95$1, If[LessEqual[z, -4.3e+64], t$95$0, If[LessEqual[z, -3.8e-14], t$95$1, If[LessEqual[z, -7.8e-79], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.02e-212], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 5.8e+52], t$95$1, N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.66 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -4.3 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\

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

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

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

\mathbf{elif}\;z \leq 5.8 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -5.50000000000000029e203 or -1.6600000000000001e170 < z < -4.2999999999999998e64

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.50000000000000029e203 < z < -1.6600000000000001e170 or -4.2999999999999998e64 < z < -3.8000000000000002e-14 or 0.5 < z < 5.8e52

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e-14 < z < -7.80000000000000011e-79 or 1.0199999999999999e-212 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.80000000000000011e-79 < z < 1.0199999999999999e-212

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

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

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

    if 5.8e52 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+203}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.66 \cdot 10^{+170}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -4.3 \cdot 10^{+64}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -7.8 \cdot 10^{-79}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-212}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+52}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 50.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(z \cdot 6\right)\\ t_1 := -6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+200}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{+170}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -6.3 \cdot 10^{+63}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{-83}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-212}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+52}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (* z 6.0))) (t_1 (* -6.0 (* z y))))
   (if (<= z -1.75e+200)
     t_0
     (if (<= z -1.2e+170)
       (* y (* -6.0 z))
       (if (<= z -6.3e+63)
         t_0
         (if (<= z -3.8e-14)
           t_1
           (if (<= z -2.15e-83)
             (* x -3.0)
             (if (<= z 3.2e-212)
               (* y 4.0)
               (if (<= z 0.5)
                 (* x -3.0)
                 (if (<= z 5e+52) t_1 (* 6.0 (* x z))))))))))))
double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (z * y);
	double tmp;
	if (z <= -1.75e+200) {
		tmp = t_0;
	} else if (z <= -1.2e+170) {
		tmp = y * (-6.0 * z);
	} else if (z <= -6.3e+63) {
		tmp = t_0;
	} else if (z <= -3.8e-14) {
		tmp = t_1;
	} else if (z <= -2.15e-83) {
		tmp = x * -3.0;
	} else if (z <= 3.2e-212) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 5e+52) {
		tmp = t_1;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (z * 6.0d0)
    t_1 = (-6.0d0) * (z * y)
    if (z <= (-1.75d+200)) then
        tmp = t_0
    else if (z <= (-1.2d+170)) then
        tmp = y * ((-6.0d0) * z)
    else if (z <= (-6.3d+63)) then
        tmp = t_0
    else if (z <= (-3.8d-14)) then
        tmp = t_1
    else if (z <= (-2.15d-83)) then
        tmp = x * (-3.0d0)
    else if (z <= 3.2d-212) then
        tmp = y * 4.0d0
    else if (z <= 0.5d0) then
        tmp = x * (-3.0d0)
    else if (z <= 5d+52) then
        tmp = t_1
    else
        tmp = 6.0d0 * (x * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (z * 6.0);
	double t_1 = -6.0 * (z * y);
	double tmp;
	if (z <= -1.75e+200) {
		tmp = t_0;
	} else if (z <= -1.2e+170) {
		tmp = y * (-6.0 * z);
	} else if (z <= -6.3e+63) {
		tmp = t_0;
	} else if (z <= -3.8e-14) {
		tmp = t_1;
	} else if (z <= -2.15e-83) {
		tmp = x * -3.0;
	} else if (z <= 3.2e-212) {
		tmp = y * 4.0;
	} else if (z <= 0.5) {
		tmp = x * -3.0;
	} else if (z <= 5e+52) {
		tmp = t_1;
	} else {
		tmp = 6.0 * (x * z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (z * 6.0)
	t_1 = -6.0 * (z * y)
	tmp = 0
	if z <= -1.75e+200:
		tmp = t_0
	elif z <= -1.2e+170:
		tmp = y * (-6.0 * z)
	elif z <= -6.3e+63:
		tmp = t_0
	elif z <= -3.8e-14:
		tmp = t_1
	elif z <= -2.15e-83:
		tmp = x * -3.0
	elif z <= 3.2e-212:
		tmp = y * 4.0
	elif z <= 0.5:
		tmp = x * -3.0
	elif z <= 5e+52:
		tmp = t_1
	else:
		tmp = 6.0 * (x * z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(z * 6.0))
	t_1 = Float64(-6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -1.75e+200)
		tmp = t_0;
	elseif (z <= -1.2e+170)
		tmp = Float64(y * Float64(-6.0 * z));
	elseif (z <= -6.3e+63)
		tmp = t_0;
	elseif (z <= -3.8e-14)
		tmp = t_1;
	elseif (z <= -2.15e-83)
		tmp = Float64(x * -3.0);
	elseif (z <= 3.2e-212)
		tmp = Float64(y * 4.0);
	elseif (z <= 0.5)
		tmp = Float64(x * -3.0);
	elseif (z <= 5e+52)
		tmp = t_1;
	else
		tmp = Float64(6.0 * Float64(x * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (z * 6.0);
	t_1 = -6.0 * (z * y);
	tmp = 0.0;
	if (z <= -1.75e+200)
		tmp = t_0;
	elseif (z <= -1.2e+170)
		tmp = y * (-6.0 * z);
	elseif (z <= -6.3e+63)
		tmp = t_0;
	elseif (z <= -3.8e-14)
		tmp = t_1;
	elseif (z <= -2.15e-83)
		tmp = x * -3.0;
	elseif (z <= 3.2e-212)
		tmp = y * 4.0;
	elseif (z <= 0.5)
		tmp = x * -3.0;
	elseif (z <= 5e+52)
		tmp = t_1;
	else
		tmp = 6.0 * (x * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e+200], t$95$0, If[LessEqual[z, -1.2e+170], N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -6.3e+63], t$95$0, If[LessEqual[z, -3.8e-14], t$95$1, If[LessEqual[z, -2.15e-83], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.2e-212], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 5e+52], t$95$1, N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -6.3 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 3.2 \cdot 10^{-212}:\\
\;\;\;\;y \cdot 4\\

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

\mathbf{elif}\;z \leq 5 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -1.75000000000000003e200 or -1.2e170 < z < -6.2999999999999998e63

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.75000000000000003e200 < z < -1.2e170

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    if -6.2999999999999998e63 < z < -3.8000000000000002e-14 or 0.5 < z < 5e52

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e-14 < z < -2.15000000000000017e-83 or 3.1999999999999999e-212 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.15000000000000017e-83 < z < 3.1999999999999999e-212

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

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

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

    if 5e52 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+200}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{+170}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -6.3 \cdot 10^{+63}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{-83}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-212}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+52}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 50.3% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;z \leq -1.05 \cdot 10^{+62}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\
\;\;\;\;z \cdot \left(-6 \cdot y\right)\\

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

\mathbf{elif}\;z \leq 1.05 \cdot 10^{-213}:\\
\;\;\;\;y \cdot 4\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 7 regimes
  2. if z < -4.6000000000000002e201 or -3e169 < z < -1.05e62

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.6000000000000002e201 < z < -3e169

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    if -1.05e62 < z < -3.8000000000000002e-14

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e-14 < z < -5.9999999999999998e-82 or 1.0499999999999999e-213 < z < 0.680000000000000049

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.9999999999999998e-82 < z < 1.0499999999999999e-213

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

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

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

    if 0.680000000000000049 < z < 7.79999999999999968e51

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.79999999999999968e51 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.6 \cdot 10^{+201}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{+169}:\\ \;\;\;\;y \cdot \left(-6 \cdot z\right)\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-14}:\\ \;\;\;\;z \cdot \left(-6 \cdot y\right)\\ \mathbf{elif}\;z \leq -6 \cdot 10^{-82}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-213}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.68:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+51}:\\ \;\;\;\;-6 \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.5% accurate, 0.4× speedup?

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

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

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

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

\mathbf{elif}\;z \leq 3.7 \cdot 10^{-213}:\\
\;\;\;\;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 4 regimes
  2. if z < -4e6 or 0.5 < z

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in 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 98.0%

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

    if -4e6 < z < -2.0000000000000002e-15

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

    if -2.0000000000000002e-15 < z < -1.74999999999999993e-81 or 3.70000000000000003e-213 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.74999999999999993e-81 < z < 3.70000000000000003e-213

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4000000:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-15}:\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-81}:\\ \;\;\;\;x \cdot -3\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{-213}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 0.5:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 75.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+14} \lor \neg \left(y \leq 0.0096 \lor \neg \left(y \leq 1.4 \cdot 10^{+26}\right) \land y \leq 1.7 \cdot 10^{+58}\right):\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9e14 or 0.00959999999999999916 < y < 1.4e26 or 1.7e58 < y

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

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

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

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

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

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

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

    if -9e14 < y < 0.00959999999999999916 or 1.4e26 < y < 1.7e58

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+14} \lor \neg \left(y \leq 0.0096 \lor \neg \left(y \leq 1.4 \cdot 10^{+26}\right) \land y \leq 1.7 \cdot 10^{+58}\right):\\ \;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 75.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7200000000000 \lor \neg \left(y \leq 0.014 \lor \neg \left(y \leq 1.3 \cdot 10^{+26}\right) \land y \leq 4.2 \cdot 10^{+58}\right):\\
\;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.2e12 or 0.0140000000000000003 < y < 1.30000000000000001e26 or 4.20000000000000024e58 < y

    1. Initial program 99.7%

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

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

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

    if -7.2e12 < y < 0.0140000000000000003 or 1.30000000000000001e26 < y < 4.20000000000000024e58

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7200000000000 \lor \neg \left(y \leq 0.014 \lor \neg \left(y \leq 1.3 \cdot 10^{+26}\right) \land y \leq 4.2 \cdot 10^{+58}\right):\\ \;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 73.9% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 1.65 \cdot 10^{-212}:\\
\;\;\;\;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 < -3.8000000000000002e-14 or 0.5 < z

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. 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 94.2%

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

    if -3.8000000000000002e-14 < z < -1.24999999999999991e-77 or 1.6500000000000001e-212 < z < 0.5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.24999999999999991e-77 < z < 1.6500000000000001e-212

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

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

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

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

Alternative 10: 51.4% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-213}:\\
\;\;\;\;y \cdot 4\\

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

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


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

    1. Initial program 99.7%

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

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

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

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

    if -3.8000000000000002e-14 < z < -2.3500000000000002e-83 or 7.2000000000000002e-213 < z < 0.650000000000000022

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3500000000000002e-83 < z < 7.2000000000000002e-213

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

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

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

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

Alternative 11: 97.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in 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*97.0%

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

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

    if -0.599999999999999978 < z < 0.5

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Step-by-step derivation
      1. 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 98.5%

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

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

Alternative 12: 36.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+45} \lor \neg \left(x \leq 6.5 \cdot 10^{-126}\right):\\
\;\;\;\;x \cdot -3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.60000000000000025e45 or 6.50000000000000014e-126 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.60000000000000025e45 < x < 6.50000000000000014e-126

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 99.6% accurate, 1.2× speedup?

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

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

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

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

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

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

Alternative 14: 26.3% accurate, 4.3× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
  2. Step-by-step derivation
    1. 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 x around inf 52.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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