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

Percentage Accurate: 99.8% → 99.8%
Time: 10.1s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\left(\left(-y\right) + \left(-\left(-x\right)\right)\right)} \cdot \left(-6\right), x\right) \]
    9. remove-double-neg99.8%

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

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

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

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

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

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

Alternative 2: 60.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot x\right)\\ t_1 := 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -1.2 \cdot 10^{+214}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{+108}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+44}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+58} \lor \neg \left(z \leq 8.2 \cdot 10^{+148}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z x))) (t_1 (* 6.0 (* z y))))
   (if (<= z -1.2e+214)
     t_0
     (if (<= z -3.8e+108)
       t_1
       (if (<= z -5.5e+44)
         t_0
         (if (<= z -1.235e-89)
           t_1
           (if (<= z 0.17)
             x
             (if (or (<= z 6e+58) (not (<= z 8.2e+148))) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -1.2e+214) {
		tmp = t_0;
	} else if (z <= -3.8e+108) {
		tmp = t_1;
	} else if (z <= -5.5e+44) {
		tmp = t_0;
	} else if (z <= -1.235e-89) {
		tmp = t_1;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 6e+58) || !(z <= 8.2e+148)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (z * x)
    t_1 = 6.0d0 * (z * y)
    if (z <= (-1.2d+214)) then
        tmp = t_0
    else if (z <= (-3.8d+108)) then
        tmp = t_1
    else if (z <= (-5.5d+44)) then
        tmp = t_0
    else if (z <= (-1.235d-89)) then
        tmp = t_1
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 6d+58) .or. (.not. (z <= 8.2d+148))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -1.2e+214) {
		tmp = t_0;
	} else if (z <= -3.8e+108) {
		tmp = t_1;
	} else if (z <= -5.5e+44) {
		tmp = t_0;
	} else if (z <= -1.235e-89) {
		tmp = t_1;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 6e+58) || !(z <= 8.2e+148)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * x)
	t_1 = 6.0 * (z * y)
	tmp = 0
	if z <= -1.2e+214:
		tmp = t_0
	elif z <= -3.8e+108:
		tmp = t_1
	elif z <= -5.5e+44:
		tmp = t_0
	elif z <= -1.235e-89:
		tmp = t_1
	elif z <= 0.17:
		tmp = x
	elif (z <= 6e+58) or not (z <= 8.2e+148):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * x))
	t_1 = Float64(6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -1.2e+214)
		tmp = t_0;
	elseif (z <= -3.8e+108)
		tmp = t_1;
	elseif (z <= -5.5e+44)
		tmp = t_0;
	elseif (z <= -1.235e-89)
		tmp = t_1;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 6e+58) || !(z <= 8.2e+148))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * x);
	t_1 = 6.0 * (z * y);
	tmp = 0.0;
	if (z <= -1.2e+214)
		tmp = t_0;
	elseif (z <= -3.8e+108)
		tmp = t_1;
	elseif (z <= -5.5e+44)
		tmp = t_0;
	elseif (z <= -1.235e-89)
		tmp = t_1;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 6e+58) || ~((z <= 8.2e+148)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e+214], t$95$0, If[LessEqual[z, -3.8e+108], t$95$1, If[LessEqual[z, -5.5e+44], t$95$0, If[LessEqual[z, -1.235e-89], t$95$1, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 6e+58], N[Not[LessEqual[z, 8.2e+148]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 6 \cdot 10^{+58} \lor \neg \left(z \leq 8.2 \cdot 10^{+148}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.2e214 or -3.80000000000000008e108 < z < -5.5000000000000001e44 or 0.170000000000000012 < z < 6.0000000000000005e58 or 8.1999999999999996e148 < z

    1. Initial program 99.7%

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

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

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

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

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

    if -1.2e214 < z < -3.80000000000000008e108 or -5.5000000000000001e44 < z < -1.235e-89 or 6.0000000000000005e58 < z < 8.1999999999999996e148

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    7. Simplified65.1%

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

    if -1.235e-89 < z < 0.170000000000000012

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+214}:\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{+108}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+44}:\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+58} \lor \neg \left(z \leq 8.2 \cdot 10^{+148}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot x\right)\\ t_1 := 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -6.5 \cdot 10^{+213}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+142}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{+44}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+56} \lor \neg \left(z \leq 8.4 \cdot 10^{+148}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z x))) (t_1 (* 6.0 (* z y))))
   (if (<= z -6.5e+213)
     t_0
     (if (<= z -5.5e+142)
       t_1
       (if (<= z -4.6e+44)
         (* x (* z -6.0))
         (if (<= z -1.235e-89)
           t_1
           (if (<= z 0.17)
             x
             (if (or (<= z 3.2e+56) (not (<= z 8.4e+148))) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -6.5e+213) {
		tmp = t_0;
	} else if (z <= -5.5e+142) {
		tmp = t_1;
	} else if (z <= -4.6e+44) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = t_1;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 3.2e+56) || !(z <= 8.4e+148)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (z * x)
    t_1 = 6.0d0 * (z * y)
    if (z <= (-6.5d+213)) then
        tmp = t_0
    else if (z <= (-5.5d+142)) then
        tmp = t_1
    else if (z <= (-4.6d+44)) then
        tmp = x * (z * (-6.0d0))
    else if (z <= (-1.235d-89)) then
        tmp = t_1
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 3.2d+56) .or. (.not. (z <= 8.4d+148))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -6.5e+213) {
		tmp = t_0;
	} else if (z <= -5.5e+142) {
		tmp = t_1;
	} else if (z <= -4.6e+44) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = t_1;
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 3.2e+56) || !(z <= 8.4e+148)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * x)
	t_1 = 6.0 * (z * y)
	tmp = 0
	if z <= -6.5e+213:
		tmp = t_0
	elif z <= -5.5e+142:
		tmp = t_1
	elif z <= -4.6e+44:
		tmp = x * (z * -6.0)
	elif z <= -1.235e-89:
		tmp = t_1
	elif z <= 0.17:
		tmp = x
	elif (z <= 3.2e+56) or not (z <= 8.4e+148):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * x))
	t_1 = Float64(6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -6.5e+213)
		tmp = t_0;
	elseif (z <= -5.5e+142)
		tmp = t_1;
	elseif (z <= -4.6e+44)
		tmp = Float64(x * Float64(z * -6.0));
	elseif (z <= -1.235e-89)
		tmp = t_1;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 3.2e+56) || !(z <= 8.4e+148))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * x);
	t_1 = 6.0 * (z * y);
	tmp = 0.0;
	if (z <= -6.5e+213)
		tmp = t_0;
	elseif (z <= -5.5e+142)
		tmp = t_1;
	elseif (z <= -4.6e+44)
		tmp = x * (z * -6.0);
	elseif (z <= -1.235e-89)
		tmp = t_1;
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 3.2e+56) || ~((z <= 8.4e+148)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e+213], t$95$0, If[LessEqual[z, -5.5e+142], t$95$1, If[LessEqual[z, -4.6e+44], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.235e-89], t$95$1, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 3.2e+56], N[Not[LessEqual[z, 8.4e+148]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{+56} \lor \neg \left(z \leq 8.4 \cdot 10^{+148}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -6.49999999999999982e213 or 0.170000000000000012 < z < 3.20000000000000003e56 or 8.39999999999999996e148 < z

    1. Initial program 99.7%

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

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

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

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

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

    if -6.49999999999999982e213 < z < -5.50000000000000035e142 or -4.60000000000000009e44 < z < -1.235e-89 or 3.20000000000000003e56 < z < 8.39999999999999996e148

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    7. Simplified65.9%

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

    if -5.50000000000000035e142 < z < -4.60000000000000009e44

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

    if -1.235e-89 < z < 0.170000000000000012

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification69.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+213}:\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+142}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{+44}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+56} \lor \neg \left(z \leq 8.4 \cdot 10^{+148}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 60.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot x\right)\\ t_1 := 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -3.4 \cdot 10^{+214}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{+142}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{+45}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;y \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+57} \lor \neg \left(z \leq 2.9 \cdot 10^{+149}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z x))) (t_1 (* 6.0 (* z y))))
   (if (<= z -3.4e+214)
     t_0
     (if (<= z -9.4e+142)
       t_1
       (if (<= z -1.2e+45)
         (* x (* z -6.0))
         (if (<= z -1.235e-89)
           (* y (* z 6.0))
           (if (<= z 0.17)
             x
             (if (or (<= z 8.5e+57) (not (<= z 2.9e+149))) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -3.4e+214) {
		tmp = t_0;
	} else if (z <= -9.4e+142) {
		tmp = t_1;
	} else if (z <= -1.2e+45) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = y * (z * 6.0);
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 8.5e+57) || !(z <= 2.9e+149)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (z * x)
    t_1 = 6.0d0 * (z * y)
    if (z <= (-3.4d+214)) then
        tmp = t_0
    else if (z <= (-9.4d+142)) then
        tmp = t_1
    else if (z <= (-1.2d+45)) then
        tmp = x * (z * (-6.0d0))
    else if (z <= (-1.235d-89)) then
        tmp = y * (z * 6.0d0)
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 8.5d+57) .or. (.not. (z <= 2.9d+149))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -3.4e+214) {
		tmp = t_0;
	} else if (z <= -9.4e+142) {
		tmp = t_1;
	} else if (z <= -1.2e+45) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = y * (z * 6.0);
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 8.5e+57) || !(z <= 2.9e+149)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * x)
	t_1 = 6.0 * (z * y)
	tmp = 0
	if z <= -3.4e+214:
		tmp = t_0
	elif z <= -9.4e+142:
		tmp = t_1
	elif z <= -1.2e+45:
		tmp = x * (z * -6.0)
	elif z <= -1.235e-89:
		tmp = y * (z * 6.0)
	elif z <= 0.17:
		tmp = x
	elif (z <= 8.5e+57) or not (z <= 2.9e+149):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * x))
	t_1 = Float64(6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -3.4e+214)
		tmp = t_0;
	elseif (z <= -9.4e+142)
		tmp = t_1;
	elseif (z <= -1.2e+45)
		tmp = Float64(x * Float64(z * -6.0));
	elseif (z <= -1.235e-89)
		tmp = Float64(y * Float64(z * 6.0));
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 8.5e+57) || !(z <= 2.9e+149))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * x);
	t_1 = 6.0 * (z * y);
	tmp = 0.0;
	if (z <= -3.4e+214)
		tmp = t_0;
	elseif (z <= -9.4e+142)
		tmp = t_1;
	elseif (z <= -1.2e+45)
		tmp = x * (z * -6.0);
	elseif (z <= -1.235e-89)
		tmp = y * (z * 6.0);
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 8.5e+57) || ~((z <= 2.9e+149)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+214], t$95$0, If[LessEqual[z, -9.4e+142], t$95$1, If[LessEqual[z, -1.2e+45], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.235e-89], N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 8.5e+57], N[Not[LessEqual[z, 2.9e+149]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{+57} \lor \neg \left(z \leq 2.9 \cdot 10^{+149}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -3.3999999999999998e214 or 0.170000000000000012 < z < 8.5000000000000001e57 or 2.9000000000000002e149 < z

    1. Initial program 99.7%

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

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

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

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

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

    if -3.3999999999999998e214 < z < -9.4e142 or 8.5000000000000001e57 < z < 2.9000000000000002e149

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    7. Simplified69.1%

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

    if -9.4e142 < z < -1.19999999999999995e45

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

    if -1.19999999999999995e45 < z < -1.235e-89

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(6 \cdot z\right)} \]
    10. Simplified61.0%

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

    if -1.235e-89 < z < 0.170000000000000012

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification69.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{+214}:\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{+142}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{+45}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;y \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+57} \lor \neg \left(z \leq 2.9 \cdot 10^{+149}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 60.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -6 \cdot \left(z \cdot x\right)\\ t_1 := 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+216}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+143}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+44}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+55} \lor \neg \left(z \leq 7 \cdot 10^{+149}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* -6.0 (* z x))) (t_1 (* 6.0 (* z y))))
   (if (<= z -1.75e+216)
     t_0
     (if (<= z -5.2e+143)
       t_1
       (if (<= z -5.5e+44)
         (* x (* z -6.0))
         (if (<= z -1.235e-89)
           (* z (* y 6.0))
           (if (<= z 0.17)
             x
             (if (or (<= z 2.15e+55) (not (<= z 7e+149))) t_0 t_1))))))))
double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -1.75e+216) {
		tmp = t_0;
	} else if (z <= -5.2e+143) {
		tmp = t_1;
	} else if (z <= -5.5e+44) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = z * (y * 6.0);
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 2.15e+55) || !(z <= 7e+149)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-6.0d0) * (z * x)
    t_1 = 6.0d0 * (z * y)
    if (z <= (-1.75d+216)) then
        tmp = t_0
    else if (z <= (-5.2d+143)) then
        tmp = t_1
    else if (z <= (-5.5d+44)) then
        tmp = x * (z * (-6.0d0))
    else if (z <= (-1.235d-89)) then
        tmp = z * (y * 6.0d0)
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 2.15d+55) .or. (.not. (z <= 7d+149))) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -6.0 * (z * x);
	double t_1 = 6.0 * (z * y);
	double tmp;
	if (z <= -1.75e+216) {
		tmp = t_0;
	} else if (z <= -5.2e+143) {
		tmp = t_1;
	} else if (z <= -5.5e+44) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = z * (y * 6.0);
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 2.15e+55) || !(z <= 7e+149)) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -6.0 * (z * x)
	t_1 = 6.0 * (z * y)
	tmp = 0
	if z <= -1.75e+216:
		tmp = t_0
	elif z <= -5.2e+143:
		tmp = t_1
	elif z <= -5.5e+44:
		tmp = x * (z * -6.0)
	elif z <= -1.235e-89:
		tmp = z * (y * 6.0)
	elif z <= 0.17:
		tmp = x
	elif (z <= 2.15e+55) or not (z <= 7e+149):
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(-6.0 * Float64(z * x))
	t_1 = Float64(6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -1.75e+216)
		tmp = t_0;
	elseif (z <= -5.2e+143)
		tmp = t_1;
	elseif (z <= -5.5e+44)
		tmp = Float64(x * Float64(z * -6.0));
	elseif (z <= -1.235e-89)
		tmp = Float64(z * Float64(y * 6.0));
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 2.15e+55) || !(z <= 7e+149))
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -6.0 * (z * x);
	t_1 = 6.0 * (z * y);
	tmp = 0.0;
	if (z <= -1.75e+216)
		tmp = t_0;
	elseif (z <= -5.2e+143)
		tmp = t_1;
	elseif (z <= -5.5e+44)
		tmp = x * (z * -6.0);
	elseif (z <= -1.235e-89)
		tmp = z * (y * 6.0);
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 2.15e+55) || ~((z <= 7e+149)))
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e+216], t$95$0, If[LessEqual[z, -5.2e+143], t$95$1, If[LessEqual[z, -5.5e+44], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.235e-89], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 2.15e+55], N[Not[LessEqual[z, 7e+149]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{+55} \lor \neg \left(z \leq 7 \cdot 10^{+149}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -1.74999999999999996e216 or 0.170000000000000012 < z < 2.1499999999999999e55 or 7.00000000000000023e149 < z

    1. Initial program 99.7%

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

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

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

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

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

    if -1.74999999999999996e216 < z < -5.1999999999999998e143 or 2.1499999999999999e55 < z < 7.00000000000000023e149

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    7. Simplified69.1%

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

    if -5.1999999999999998e143 < z < -5.5000000000000001e44

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

    if -5.5000000000000001e44 < z < -1.235e-89

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(6 \cdot y\right)} \]
    7. Simplified61.1%

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

    if -1.235e-89 < z < 0.170000000000000012

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification69.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+216}:\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+143}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+44}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+55} \lor \neg \left(z \leq 7 \cdot 10^{+149}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 60.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 6 \cdot \left(z \cdot y\right)\\ \mathbf{if}\;z \leq -5 \cdot 10^{+214}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+141}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1 \cdot 10^{+45}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+59} \lor \neg \left(z \leq 1.1 \cdot 10^{+150}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* 6.0 (* z y))))
   (if (<= z -5e+214)
     (* z (* x -6.0))
     (if (<= z -3.6e+141)
       t_0
       (if (<= z -1e+45)
         (* x (* z -6.0))
         (if (<= z -1.235e-89)
           (* z (* y 6.0))
           (if (<= z 0.17)
             x
             (if (or (<= z 1.8e+59) (not (<= z 1.1e+150)))
               (* -6.0 (* z x))
               t_0))))))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (z * y);
	double tmp;
	if (z <= -5e+214) {
		tmp = z * (x * -6.0);
	} else if (z <= -3.6e+141) {
		tmp = t_0;
	} else if (z <= -1e+45) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = z * (y * 6.0);
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 1.8e+59) || !(z <= 1.1e+150)) {
		tmp = -6.0 * (z * x);
	} 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 <= (-5d+214)) then
        tmp = z * (x * (-6.0d0))
    else if (z <= (-3.6d+141)) then
        tmp = t_0
    else if (z <= (-1d+45)) then
        tmp = x * (z * (-6.0d0))
    else if (z <= (-1.235d-89)) then
        tmp = z * (y * 6.0d0)
    else if (z <= 0.17d0) then
        tmp = x
    else if ((z <= 1.8d+59) .or. (.not. (z <= 1.1d+150))) then
        tmp = (-6.0d0) * (z * x)
    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 <= -5e+214) {
		tmp = z * (x * -6.0);
	} else if (z <= -3.6e+141) {
		tmp = t_0;
	} else if (z <= -1e+45) {
		tmp = x * (z * -6.0);
	} else if (z <= -1.235e-89) {
		tmp = z * (y * 6.0);
	} else if (z <= 0.17) {
		tmp = x;
	} else if ((z <= 1.8e+59) || !(z <= 1.1e+150)) {
		tmp = -6.0 * (z * x);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (z * y)
	tmp = 0
	if z <= -5e+214:
		tmp = z * (x * -6.0)
	elif z <= -3.6e+141:
		tmp = t_0
	elif z <= -1e+45:
		tmp = x * (z * -6.0)
	elif z <= -1.235e-89:
		tmp = z * (y * 6.0)
	elif z <= 0.17:
		tmp = x
	elif (z <= 1.8e+59) or not (z <= 1.1e+150):
		tmp = -6.0 * (z * x)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(6.0 * Float64(z * y))
	tmp = 0.0
	if (z <= -5e+214)
		tmp = Float64(z * Float64(x * -6.0));
	elseif (z <= -3.6e+141)
		tmp = t_0;
	elseif (z <= -1e+45)
		tmp = Float64(x * Float64(z * -6.0));
	elseif (z <= -1.235e-89)
		tmp = Float64(z * Float64(y * 6.0));
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 1.8e+59) || !(z <= 1.1e+150))
		tmp = Float64(-6.0 * Float64(z * x));
	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 <= -5e+214)
		tmp = z * (x * -6.0);
	elseif (z <= -3.6e+141)
		tmp = t_0;
	elseif (z <= -1e+45)
		tmp = x * (z * -6.0);
	elseif (z <= -1.235e-89)
		tmp = z * (y * 6.0);
	elseif (z <= 0.17)
		tmp = x;
	elseif ((z <= 1.8e+59) || ~((z <= 1.1e+150)))
		tmp = -6.0 * (z * x);
	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, -5e+214], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.6e+141], t$95$0, If[LessEqual[z, -1e+45], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.235e-89], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 1.8e+59], N[Not[LessEqual[z, 1.1e+150]], $MachinePrecision]], N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

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

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

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

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

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+59} \lor \neg \left(z \leq 1.1 \cdot 10^{+150}\right):\\
\;\;\;\;-6 \cdot \left(z \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if z < -4.99999999999999953e214

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -4.99999999999999953e214 < z < -3.6000000000000001e141 or 1.7999999999999999e59 < z < 1.1e150

    1. Initial program 99.6%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

        \[\leadsto 6 \cdot \color{blue}{\left(z \cdot y\right)} \]
    7. Simplified69.1%

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

    if -3.6000000000000001e141 < z < -9.9999999999999993e44

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

    if -9.9999999999999993e44 < z < -1.235e-89

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(6 \cdot y\right)} \]
    7. Simplified61.1%

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

    if -1.235e-89 < z < 0.170000000000000012

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} \]

    if 0.170000000000000012 < z < 1.7999999999999999e59 or 1.1e150 < z

    1. Initial program 99.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+214}:\\ \;\;\;\;z \cdot \left(x \cdot -6\right)\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+141}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \mathbf{elif}\;z \leq -1 \cdot 10^{+45}:\\ \;\;\;\;x \cdot \left(z \cdot -6\right)\\ \mathbf{elif}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+59} \lor \neg \left(z \leq 1.1 \cdot 10^{+150}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(z \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 60.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{z \cdot x}{z}\\ \mathbf{if}\;x \leq -1.2 \cdot 10^{+176}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{+111}:\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{-14} \lor \neg \left(x \leq 3.25 \cdot 10^{-18}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (* z x) z)))
   (if (<= x -1.2e+176)
     t_0
     (if (<= x -4.1e+111)
       (* -6.0 (* z x))
       (if (or (<= x -1.05e-14) (not (<= x 3.25e-18))) t_0 (* z (* y 6.0)))))))
double code(double x, double y, double z) {
	double t_0 = (z * x) / z;
	double tmp;
	if (x <= -1.2e+176) {
		tmp = t_0;
	} else if (x <= -4.1e+111) {
		tmp = -6.0 * (z * x);
	} else if ((x <= -1.05e-14) || !(x <= 3.25e-18)) {
		tmp = t_0;
	} else {
		tmp = z * (y * 6.0);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (z * x) / z
    if (x <= (-1.2d+176)) then
        tmp = t_0
    else if (x <= (-4.1d+111)) then
        tmp = (-6.0d0) * (z * x)
    else if ((x <= (-1.05d-14)) .or. (.not. (x <= 3.25d-18))) then
        tmp = t_0
    else
        tmp = z * (y * 6.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (z * x) / z;
	double tmp;
	if (x <= -1.2e+176) {
		tmp = t_0;
	} else if (x <= -4.1e+111) {
		tmp = -6.0 * (z * x);
	} else if ((x <= -1.05e-14) || !(x <= 3.25e-18)) {
		tmp = t_0;
	} else {
		tmp = z * (y * 6.0);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (z * x) / z
	tmp = 0
	if x <= -1.2e+176:
		tmp = t_0
	elif x <= -4.1e+111:
		tmp = -6.0 * (z * x)
	elif (x <= -1.05e-14) or not (x <= 3.25e-18):
		tmp = t_0
	else:
		tmp = z * (y * 6.0)
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(z * x) / z)
	tmp = 0.0
	if (x <= -1.2e+176)
		tmp = t_0;
	elseif (x <= -4.1e+111)
		tmp = Float64(-6.0 * Float64(z * x));
	elseif ((x <= -1.05e-14) || !(x <= 3.25e-18))
		tmp = t_0;
	else
		tmp = Float64(z * Float64(y * 6.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (z * x) / z;
	tmp = 0.0;
	if (x <= -1.2e+176)
		tmp = t_0;
	elseif (x <= -4.1e+111)
		tmp = -6.0 * (z * x);
	elseif ((x <= -1.05e-14) || ~((x <= 3.25e-18)))
		tmp = t_0;
	else
		tmp = z * (y * 6.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[x, -1.2e+176], t$95$0, If[LessEqual[x, -4.1e+111], N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.05e-14], N[Not[LessEqual[x, 3.25e-18]], $MachinePrecision]], t$95$0, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{z \cdot x}{z}\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+176}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -1.05 \cdot 10^{-14} \lor \neg \left(x \leq 3.25 \cdot 10^{-18}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.2000000000000001e176 or -4.09999999999999986e111 < x < -1.0499999999999999e-14 or 3.25000000000000004e-18 < x

    1. Initial program 99.8%

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

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

      \[\leadsto z \cdot \color{blue}{\frac{x}{z}} \]
    5. Step-by-step derivation
      1. associate-*r/64.2%

        \[\leadsto \color{blue}{\frac{z \cdot x}{z}} \]
    6. Applied egg-rr64.2%

      \[\leadsto \color{blue}{\frac{z \cdot x}{z}} \]

    if -1.2000000000000001e176 < x < -4.09999999999999986e111

    1. Initial program 99.8%

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

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

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

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

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

    if -1.0499999999999999e-14 < x < 3.25000000000000004e-18

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.7%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{+176}:\\ \;\;\;\;\frac{z \cdot x}{z}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{+111}:\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{-14} \lor \neg \left(x \leq 3.25 \cdot 10^{-18}\right):\\ \;\;\;\;\frac{z \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 83.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.235 \cdot 10^{-89} \lor \neg \left(z \leq 6.4 \cdot 10^{-6}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.235e-89) (not (<= z 6.4e-6))) (* -6.0 (* z (- x y))) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.235e-89) || !(z <= 6.4e-6)) {
		tmp = -6.0 * (z * (x - y));
	} else {
		tmp = x;
	}
	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 <= (-1.235d-89)) .or. (.not. (z <= 6.4d-6))) then
        tmp = (-6.0d0) * (z * (x - y))
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.235e-89) || !(z <= 6.4e-6)) {
		tmp = -6.0 * (z * (x - y));
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.235e-89) or not (z <= 6.4e-6):
		tmp = -6.0 * (z * (x - y))
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.235e-89) || !(z <= 6.4e-6))
		tmp = Float64(-6.0 * Float64(z * Float64(x - y)));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.235e-89) || ~((z <= 6.4e-6)))
		tmp = -6.0 * (z * (x - y));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.235e-89], N[Not[LessEqual[z, 6.4e-6]], $MachinePrecision]], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.235 \cdot 10^{-89} \lor \neg \left(z \leq 6.4 \cdot 10^{-6}\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.235e-89 or 6.3999999999999997e-6 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.235e-89 < z < 6.3999999999999997e-6

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.235 \cdot 10^{-89} \lor \neg \left(z \leq 6.4 \cdot 10^{-6}\right):\\ \;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 83.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.235 \cdot 10^{-89} \lor \neg \left(z \leq 12000000000000\right):\\ \;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.235e-89) (not (<= z 12000000000000.0)))
   (* -6.0 (* z (- x y)))
   (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.235e-89) || !(z <= 12000000000000.0)) {
		tmp = -6.0 * (z * (x - y));
	} else {
		tmp = x * ((z * -6.0) + 1.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 <= (-1.235d-89)) .or. (.not. (z <= 12000000000000.0d0))) then
        tmp = (-6.0d0) * (z * (x - y))
    else
        tmp = x * ((z * (-6.0d0)) + 1.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.235e-89) || !(z <= 12000000000000.0)) {
		tmp = -6.0 * (z * (x - y));
	} else {
		tmp = x * ((z * -6.0) + 1.0);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.235e-89) or not (z <= 12000000000000.0):
		tmp = -6.0 * (z * (x - y))
	else:
		tmp = x * ((z * -6.0) + 1.0)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.235e-89) || !(z <= 12000000000000.0))
		tmp = Float64(-6.0 * Float64(z * Float64(x - y)));
	else
		tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.235e-89) || ~((z <= 12000000000000.0)))
		tmp = -6.0 * (z * (x - y));
	else
		tmp = x * ((z * -6.0) + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.235e-89], N[Not[LessEqual[z, 12000000000000.0]], $MachinePrecision]], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.235 \cdot 10^{-89} \lor \neg \left(z \leq 12000000000000\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.235e-89 or 1.2e13 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.235e-89 < z < 1.2e13

    1. Initial program 99.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.235 \cdot 10^{-89} \lor \neg \left(z \leq 12000000000000\right):\\ \;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 83.7% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq 12000000000000:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\

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


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

    1. Initial program 99.8%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.235e-89 < z < 1.2e13

    1. Initial program 99.9%

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

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

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

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

    if 1.2e13 < z

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.235 \cdot 10^{-89}:\\ \;\;\;\;\left(y - x\right) \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 12000000000000:\\ \;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.165:\\ \;\;\;\;\left(y - x\right) \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x + y \cdot \left(z \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -0.165)
   (* (- y x) (* z 6.0))
   (if (<= z 0.17) (+ x (* y (* z 6.0))) (* -6.0 (* z (- x y))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.165) {
		tmp = (y - x) * (z * 6.0);
	} else if (z <= 0.17) {
		tmp = x + (y * (z * 6.0));
	} else {
		tmp = -6.0 * (z * (x - y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-0.165d0)) then
        tmp = (y - x) * (z * 6.0d0)
    else if (z <= 0.17d0) then
        tmp = x + (y * (z * 6.0d0))
    else
        tmp = (-6.0d0) * (z * (x - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.165) {
		tmp = (y - x) * (z * 6.0);
	} else if (z <= 0.17) {
		tmp = x + (y * (z * 6.0));
	} else {
		tmp = -6.0 * (z * (x - y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.165:
		tmp = (y - x) * (z * 6.0)
	elif z <= 0.17:
		tmp = x + (y * (z * 6.0))
	else:
		tmp = -6.0 * (z * (x - y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.165)
		tmp = Float64(Float64(y - x) * Float64(z * 6.0));
	elseif (z <= 0.17)
		tmp = Float64(x + Float64(y * Float64(z * 6.0)));
	else
		tmp = Float64(-6.0 * Float64(z * Float64(x - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.165)
		tmp = (y - x) * (z * 6.0);
	elseif (z <= 0.17)
		tmp = x + (y * (z * 6.0));
	else
		tmp = -6.0 * (z * (x - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -0.165], N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], N[(x + N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x + y \cdot \left(z \cdot 6\right)\\

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


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

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -0.165000000000000008 < z < 0.170000000000000012

    1. Initial program 99.9%

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

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

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

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

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

    if 0.170000000000000012 < z

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.14:\\ \;\;\;\;\left(y - x\right) \cdot \left(z \cdot 6\right)\\ \mathbf{elif}\;z \leq 0.17:\\ \;\;\;\;x + z \cdot \left(y \cdot 6\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -0.14)
   (* (- y x) (* z 6.0))
   (if (<= z 0.17) (+ x (* z (* y 6.0))) (* -6.0 (* z (- x y))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.14) {
		tmp = (y - x) * (z * 6.0);
	} else if (z <= 0.17) {
		tmp = x + (z * (y * 6.0));
	} else {
		tmp = -6.0 * (z * (x - y));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-0.14d0)) then
        tmp = (y - x) * (z * 6.0d0)
    else if (z <= 0.17d0) then
        tmp = x + (z * (y * 6.0d0))
    else
        tmp = (-6.0d0) * (z * (x - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.14) {
		tmp = (y - x) * (z * 6.0);
	} else if (z <= 0.17) {
		tmp = x + (z * (y * 6.0));
	} else {
		tmp = -6.0 * (z * (x - y));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.14:
		tmp = (y - x) * (z * 6.0)
	elif z <= 0.17:
		tmp = x + (z * (y * 6.0))
	else:
		tmp = -6.0 * (z * (x - y))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.14)
		tmp = Float64(Float64(y - x) * Float64(z * 6.0));
	elseif (z <= 0.17)
		tmp = Float64(x + Float64(z * Float64(y * 6.0)));
	else
		tmp = Float64(-6.0 * Float64(z * Float64(x - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.14)
		tmp = (y - x) * (z * 6.0);
	elseif (z <= 0.17)
		tmp = x + (z * (y * 6.0));
	else
		tmp = -6.0 * (z * (x - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -0.14], N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\

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


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

    1. Initial program 99.7%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r*99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -0.14000000000000001 < z < 0.170000000000000012

    1. Initial program 99.9%

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

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

    if 0.170000000000000012 < z

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 61.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.0025 \lor \neg \left(z \leq 0.17\right):\\ \;\;\;\;-6 \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -0.0025) (not (<= z 0.17))) (* -6.0 (* z x)) x))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.0025) || !(z <= 0.17)) {
		tmp = -6.0 * (z * x);
	} else {
		tmp = x;
	}
	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.0025d0)) .or. (.not. (z <= 0.17d0))) then
        tmp = (-6.0d0) * (z * x)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -0.0025) || !(z <= 0.17)) {
		tmp = -6.0 * (z * x);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -0.0025) or not (z <= 0.17):
		tmp = -6.0 * (z * x)
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -0.0025) || !(z <= 0.17))
		tmp = Float64(-6.0 * Float64(z * x));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -0.0025) || ~((z <= 0.17)))
		tmp = -6.0 * (z * x);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.0025], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;x\\


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

    1. Initial program 99.7%

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

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

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

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

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

    if -0.00250000000000000005 < z < 0.170000000000000012

    1. Initial program 99.9%

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

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

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

Alternative 14: 99.8% accurate, 1.0× speedup?

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

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

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Add Preprocessing
  3. Final simplification99.8%

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

Alternative 15: 36.4% accurate, 9.0× speedup?

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

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

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification36.1%

    \[\leadsto x \]
  5. Add Preprocessing

Developer target: 99.8% accurate, 1.0× speedup?

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

\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}

Reproduce

?
herbie shell --seed 2024059 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
  :precision binary64

  :alt
  (- x (* (* 6.0 z) (- x y)))

  (+ x (* (* (- y x) 6.0) z)))