Data.Colour.Matrix:inverse from colour-2.3.3, B

Percentage Accurate: 91.0% → 95.6%
Time: 11.0s
Alternatives: 11
Speedup: 0.6×

Specification

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

\\
\frac{x \cdot y - z \cdot t}{a}
\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 11 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: 91.0% accurate, 1.0× speedup?

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

\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}

Alternative 1: 95.6% accurate, 0.0× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 1.2 \cdot 10^{+14}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{\sqrt{a\_m}}, \frac{x}{\sqrt{a\_m}}, \left(-t\right) \cdot \frac{z}{a\_m}\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= a_m 1.2e+14)
    (/ (fma x y (* z (- t))) a_m)
    (fma (/ y (sqrt a_m)) (/ x (sqrt a_m)) (* (- t) (/ z a_m))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 1.2e+14) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = fma((y / sqrt(a_m)), (x / sqrt(a_m)), (-t * (z / a_m)));
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (a_m <= 1.2e+14)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = fma(Float64(y / sqrt(a_m)), Float64(x / sqrt(a_m)), Float64(Float64(-t) * Float64(z / a_m)));
	end
	return Float64(a_s * tmp)
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 1.2e+14], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(y / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] * N[(x / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] + N[((-t) * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 1.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{\sqrt{a\_m}}, \frac{x}{\sqrt{a\_m}}, \left(-t\right) \cdot \frac{z}{a\_m}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 1.2e14

    1. Initial program 92.0%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. fma-neg92.5%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}}{a} \]
      2. distribute-rgt-neg-out92.5%

        \[\leadsto \frac{\mathsf{fma}\left(x, y, \color{blue}{z \cdot \left(-t\right)}\right)}{a} \]
    3. Simplified92.5%

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

    if 1.2e14 < a

    1. Initial program 88.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub88.6%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-commutative88.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt88.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} - \frac{z \cdot t}{a} \]
      4. times-frac91.4%

        \[\leadsto \color{blue}{\frac{y}{\sqrt{a}} \cdot \frac{x}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg91.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{\sqrt{a}}, \frac{x}{\sqrt{a}}, -\frac{z \cdot t}{a}\right)} \]
      6. *-commutative91.4%

        \[\leadsto \mathsf{fma}\left(\frac{y}{\sqrt{a}}, \frac{x}{\sqrt{a}}, -\frac{\color{blue}{t \cdot z}}{a}\right) \]
      7. associate-/l*95.0%

        \[\leadsto \mathsf{fma}\left(\frac{y}{\sqrt{a}}, \frac{x}{\sqrt{a}}, -\color{blue}{t \cdot \frac{z}{a}}\right) \]
    4. Applied egg-rr95.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{\sqrt{a}}, \frac{x}{\sqrt{a}}, -t \cdot \frac{z}{a}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.2 \cdot 10^{+14}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{\sqrt{a}}, \frac{x}{\sqrt{a}}, \left(-t\right) \cdot \frac{z}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 95.0% accurate, 0.1× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 9.2 \cdot 10^{-35}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{a\_m}, \left(-t\right) \cdot \frac{z}{a\_m}\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= a_m 9.2e-35)
    (/ (fma x y (* z (- t))) a_m)
    (fma y (/ x a_m) (* (- t) (/ z a_m))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 9.2e-35) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = fma(y, (x / a_m), (-t * (z / a_m)));
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (a_m <= 9.2e-35)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = fma(y, Float64(x / a_m), Float64(Float64(-t) * Float64(z / a_m)));
	end
	return Float64(a_s * tmp)
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 9.2e-35], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision] + N[((-t) * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 9.2 \cdot 10^{-35}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{a\_m}, \left(-t\right) \cdot \frac{z}{a\_m}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 9.1999999999999996e-35

    1. Initial program 91.7%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. fma-neg92.2%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}}{a} \]
      2. distribute-rgt-neg-out92.2%

        \[\leadsto \frac{\mathsf{fma}\left(x, y, \color{blue}{z \cdot \left(-t\right)}\right)}{a} \]
    3. Simplified92.2%

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

    if 9.1999999999999996e-35 < a

    1. Initial program 89.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub89.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-commutative89.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} - \frac{z \cdot t}{a} \]
      3. associate-/l*89.6%

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} - \frac{z \cdot t}{a} \]
      4. fma-neg89.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{x}{a}, -\frac{z \cdot t}{a}\right)} \]
      5. *-commutative89.6%

        \[\leadsto \mathsf{fma}\left(y, \frac{x}{a}, -\frac{\color{blue}{t \cdot z}}{a}\right) \]
      6. associate-/l*92.9%

        \[\leadsto \mathsf{fma}\left(y, \frac{x}{a}, -\color{blue}{t \cdot \frac{z}{a}}\right) \]
    4. Applied egg-rr92.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{x}{a}, -t \cdot \frac{z}{a}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 9.2 \cdot 10^{-35}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{a}, \left(-t\right) \cdot \frac{z}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 94.8% accurate, 0.1× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 5 \cdot 10^{-35}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{a\_m}, \frac{t}{\frac{a\_m}{-z}}\right)\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= a_m 5e-35)
    (/ (fma x y (* z (- t))) a_m)
    (fma y (/ x a_m) (/ t (/ a_m (- z)))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 5e-35) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = fma(y, (x / a_m), (t / (a_m / -z)));
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (a_m <= 5e-35)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = fma(y, Float64(x / a_m), Float64(t / Float64(a_m / Float64(-z))));
	end
	return Float64(a_s * tmp)
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 5e-35], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision] + N[(t / N[(a$95$m / (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{a\_m}, \frac{t}{\frac{a\_m}{-z}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 4.99999999999999964e-35

    1. Initial program 91.7%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. fma-neg92.2%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}}{a} \]
      2. distribute-rgt-neg-out92.2%

        \[\leadsto \frac{\mathsf{fma}\left(x, y, \color{blue}{z \cdot \left(-t\right)}\right)}{a} \]
    3. Simplified92.2%

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

    if 4.99999999999999964e-35 < a

    1. Initial program 89.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub89.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-commutative89.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} - \frac{z \cdot t}{a} \]
      3. associate-/l*89.6%

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} - \frac{z \cdot t}{a} \]
      4. fma-neg89.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{x}{a}, -\frac{z \cdot t}{a}\right)} \]
      5. *-commutative89.6%

        \[\leadsto \mathsf{fma}\left(y, \frac{x}{a}, -\frac{\color{blue}{t \cdot z}}{a}\right) \]
      6. associate-/l*92.9%

        \[\leadsto \mathsf{fma}\left(y, \frac{x}{a}, -\color{blue}{t \cdot \frac{z}{a}}\right) \]
    4. Applied egg-rr92.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{x}{a}, -t \cdot \frac{z}{a}\right)} \]
    5. Step-by-step derivation
      1. clear-num92.5%

        \[\leadsto \mathsf{fma}\left(y, \frac{x}{a}, -t \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) \]
      2. un-div-inv92.5%

        \[\leadsto \mathsf{fma}\left(y, \frac{x}{a}, -\color{blue}{\frac{t}{\frac{a}{z}}}\right) \]
    6. Applied egg-rr92.5%

      \[\leadsto \mathsf{fma}\left(y, \frac{x}{a}, -\color{blue}{\frac{t}{\frac{a}{z}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 5 \cdot 10^{-35}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{a}, \frac{t}{\frac{a}{-z}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 95.1% accurate, 0.1× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 4.6 \cdot 10^{-23}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a\_m} - t \cdot \frac{z}{a\_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= a_m 4.6e-23)
    (/ (fma x y (* z (- t))) a_m)
    (- (* x (/ y a_m)) (* t (/ z a_m))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 4.6e-23) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = (x * (y / a_m)) - (t * (z / a_m));
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (a_m <= 4.6e-23)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(t * Float64(z / a_m)));
	end
	return Float64(a_s * tmp)
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 4.6e-23], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 4.6 \cdot 10^{-23}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - t \cdot \frac{z}{a\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 4.6000000000000002e-23

    1. Initial program 91.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. fma-neg92.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}}{a} \]
      2. distribute-rgt-neg-out92.3%

        \[\leadsto \frac{\mathsf{fma}\left(x, y, \color{blue}{z \cdot \left(-t\right)}\right)}{a} \]
    3. Simplified92.3%

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

    if 4.6000000000000002e-23 < a

    1. Initial program 89.4%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub89.4%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. associate-/l*90.8%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} - \frac{z \cdot t}{a} \]
      3. *-commutative90.8%

        \[\leadsto x \cdot \frac{y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      4. associate-/l*94.1%

        \[\leadsto x \cdot \frac{y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
    4. Applied egg-rr94.1%

      \[\leadsto \color{blue}{x \cdot \frac{y}{a} - t \cdot \frac{z}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 4.6 \cdot 10^{-23}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.7% accurate, 0.4× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+28}:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\ \;\;\;\;t \cdot \frac{z}{-a\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= (* x y) -1e+28)
    (/ x (/ a_m y))
    (if (<= (* x y) 5e-52) (* t (/ z (- a_m))) (* y (/ x a_m))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+28) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 5e-52) {
		tmp = t * (z / -a_m);
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a_m
    real(8) :: tmp
    if ((x * y) <= (-1d+28)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 5d-52) then
        tmp = t * (z / -a_m)
    else
        tmp = y * (x / a_m)
    end if
    code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+28) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 5e-52) {
		tmp = t * (z / -a_m);
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a_m = math.fabs(a)
a_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if (x * y) <= -1e+28:
		tmp = x / (a_m / y)
	elif (x * y) <= 5e-52:
		tmp = t * (z / -a_m)
	else:
		tmp = y * (x / a_m)
	return a_s * tmp
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (Float64(x * y) <= -1e+28)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 5e-52)
		tmp = Float64(t * Float64(z / Float64(-a_m)));
	else
		tmp = Float64(y * Float64(x / a_m));
	end
	return Float64(a_s * tmp)
end
a_m = abs(a);
a_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if ((x * y) <= -1e+28)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 5e-52)
		tmp = t * (z / -a_m);
	else
		tmp = y * (x / a_m);
	end
	tmp_2 = a_s * tmp;
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+28], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-52], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -9.99999999999999958e27

    1. Initial program 86.3%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 71.3%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. associate-*r/75.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    5. Simplified75.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    6. Step-by-step derivation
      1. clear-num75.8%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{a}{y}}} \]
      2. un-div-inv76.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    7. Applied egg-rr76.4%

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]

    if -9.99999999999999958e27 < (*.f64 x y) < 5e-52

    1. Initial program 95.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 77.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg77.6%

        \[\leadsto \color{blue}{-\frac{t \cdot z}{a}} \]
      2. associate-*r/77.0%

        \[\leadsto -\color{blue}{t \cdot \frac{z}{a}} \]
      3. distribute-lft-neg-in77.0%

        \[\leadsto \color{blue}{\left(-t\right) \cdot \frac{z}{a}} \]
    5. Simplified77.0%

      \[\leadsto \color{blue}{\left(-t\right) \cdot \frac{z}{a}} \]

    if 5e-52 < (*.f64 x y)

    1. Initial program 87.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub83.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. add-cube-cbrt83.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
      3. times-frac79.4%

        \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
      4. fma-neg80.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right)} \]
      5. pow280.8%

        \[\leadsto \mathsf{fma}\left(\frac{x}{\color{blue}{{\left(\sqrt[3]{a}\right)}^{2}}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right) \]
      6. *-commutative80.8%

        \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\frac{\color{blue}{t \cdot z}}{a}\right) \]
      7. associate-/l*80.6%

        \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\color{blue}{t \cdot \frac{z}{a}}\right) \]
    4. Applied egg-rr80.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -t \cdot \frac{z}{a}\right)} \]
    5. Taylor expanded in x around inf 65.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. associate-*l/63.7%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
      2. *-commutative63.7%

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
    7. Simplified63.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+28}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-52}:\\ \;\;\;\;t \cdot \frac{z}{-a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.2% accurate, 0.4× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+28}:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 0.5:\\ \;\;\;\;\frac{z \cdot t}{-a\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= (* x y) -1e+28)
    (/ x (/ a_m y))
    (if (<= (* x y) 0.5) (/ (* z t) (- a_m)) (* y (/ x a_m))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+28) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 0.5) {
		tmp = (z * t) / -a_m;
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a_m
    real(8) :: tmp
    if ((x * y) <= (-1d+28)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 0.5d0) then
        tmp = (z * t) / -a_m
    else
        tmp = y * (x / a_m)
    end if
    code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+28) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 0.5) {
		tmp = (z * t) / -a_m;
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a_m = math.fabs(a)
a_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if (x * y) <= -1e+28:
		tmp = x / (a_m / y)
	elif (x * y) <= 0.5:
		tmp = (z * t) / -a_m
	else:
		tmp = y * (x / a_m)
	return a_s * tmp
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (Float64(x * y) <= -1e+28)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 0.5)
		tmp = Float64(Float64(z * t) / Float64(-a_m));
	else
		tmp = Float64(y * Float64(x / a_m));
	end
	return Float64(a_s * tmp)
end
a_m = abs(a);
a_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if ((x * y) <= -1e+28)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 0.5)
		tmp = (z * t) / -a_m;
	else
		tmp = y * (x / a_m);
	end
	tmp_2 = a_s * tmp;
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+28], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 0.5], N[(N[(z * t), $MachinePrecision] / (-a$95$m)), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

\mathbf{elif}\;x \cdot y \leq 0.5:\\
\;\;\;\;\frac{z \cdot t}{-a\_m}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -9.99999999999999958e27

    1. Initial program 86.3%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 71.3%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. associate-*r/75.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    5. Simplified75.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    6. Step-by-step derivation
      1. clear-num75.8%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{a}{y}}} \]
      2. un-div-inv76.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    7. Applied egg-rr76.4%

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]

    if -9.99999999999999958e27 < (*.f64 x y) < 0.5

    1. Initial program 96.1%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 76.6%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(t \cdot z\right)}}{a} \]
    4. Step-by-step derivation
      1. mul-1-neg76.6%

        \[\leadsto \frac{\color{blue}{-t \cdot z}}{a} \]
      2. distribute-rgt-neg-in76.6%

        \[\leadsto \frac{\color{blue}{t \cdot \left(-z\right)}}{a} \]
    5. Simplified76.6%

      \[\leadsto \frac{\color{blue}{t \cdot \left(-z\right)}}{a} \]

    if 0.5 < (*.f64 x y)

    1. Initial program 86.5%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub81.9%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. add-cube-cbrt81.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
      3. times-frac78.7%

        \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
      4. fma-neg80.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right)} \]
      5. pow280.2%

        \[\leadsto \mathsf{fma}\left(\frac{x}{\color{blue}{{\left(\sqrt[3]{a}\right)}^{2}}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right) \]
      6. *-commutative80.2%

        \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\frac{\color{blue}{t \cdot z}}{a}\right) \]
      7. associate-/l*81.5%

        \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\color{blue}{t \cdot \frac{z}{a}}\right) \]
    4. Applied egg-rr81.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -t \cdot \frac{z}{a}\right)} \]
    5. Taylor expanded in x around inf 67.1%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. associate-*l/65.6%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
      2. *-commutative65.6%

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
    7. Simplified65.6%

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification73.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+28}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \mathbf{elif}\;x \cdot y \leq 0.5:\\ \;\;\;\;\frac{z \cdot t}{-a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 92.8% accurate, 0.6× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;\frac{y}{\frac{a\_m}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= (* x y) (- INFINITY)) (/ y (/ a_m x)) (/ (- (* x y) (* z t)) a_m))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -((double) INFINITY)) {
		tmp = y / (a_m / x);
	} else {
		tmp = ((x * y) - (z * t)) / a_m;
	}
	return a_s * tmp;
}
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -Double.POSITIVE_INFINITY) {
		tmp = y / (a_m / x);
	} else {
		tmp = ((x * y) - (z * t)) / a_m;
	}
	return a_s * tmp;
}
a_m = math.fabs(a)
a_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if (x * y) <= -math.inf:
		tmp = y / (a_m / x)
	else:
		tmp = ((x * y) - (z * t)) / a_m
	return a_s * tmp
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (Float64(x * y) <= Float64(-Inf))
		tmp = Float64(y / Float64(a_m / x));
	else
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	end
	return Float64(a_s * tmp)
end
a_m = abs(a);
a_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if ((x * y) <= -Inf)
		tmp = y / (a_m / x);
	else
		tmp = ((x * y) - (z * t)) / a_m;
	end
	tmp_2 = a_s * tmp;
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -inf.0

    1. Initial program 54.9%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 54.9%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. associate-*r/93.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    5. Simplified93.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    6. Step-by-step derivation
      1. *-commutative93.9%

        \[\leadsto \color{blue}{\frac{y}{a} \cdot x} \]
      2. associate-*l/54.9%

        \[\leadsto \color{blue}{\frac{y \cdot x}{a}} \]
      3. associate-*r/94.0%

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
      4. clear-num94.1%

        \[\leadsto y \cdot \color{blue}{\frac{1}{\frac{a}{x}}} \]
      5. un-div-inv94.2%

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    7. Applied egg-rr94.2%

      \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]

    if -inf.0 < (*.f64 x y)

    1. Initial program 93.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification93.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 94.7% accurate, 0.6× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 8 \cdot 10^{-40}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a\_m} - t \cdot \frac{z}{a\_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= a_m 8e-40)
    (/ (- (* x y) (* z t)) a_m)
    (- (* x (/ y a_m)) (* t (/ z a_m))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 8e-40) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = (x * (y / a_m)) - (t * (z / a_m));
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a_m
    real(8) :: tmp
    if (a_m <= 8d-40) then
        tmp = ((x * y) - (z * t)) / a_m
    else
        tmp = (x * (y / a_m)) - (t * (z / a_m))
    end if
    code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 8e-40) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = (x * (y / a_m)) - (t * (z / a_m));
	}
	return a_s * tmp;
}
a_m = math.fabs(a)
a_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if a_m <= 8e-40:
		tmp = ((x * y) - (z * t)) / a_m
	else:
		tmp = (x * (y / a_m)) - (t * (z / a_m))
	return a_s * tmp
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (a_m <= 8e-40)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(t * Float64(z / a_m)));
	end
	return Float64(a_s * tmp)
end
a_m = abs(a);
a_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if (a_m <= 8e-40)
		tmp = ((x * y) - (z * t)) / a_m;
	else
		tmp = (x * (y / a_m)) - (t * (z / a_m));
	end
	tmp_2 = a_s * tmp;
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 8e-40], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 8 \cdot 10^{-40}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - t \cdot \frac{z}{a\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 7.9999999999999994e-40

    1. Initial program 91.7%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing

    if 7.9999999999999994e-40 < a

    1. Initial program 89.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub89.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. associate-/l*91.1%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} - \frac{z \cdot t}{a} \]
      3. *-commutative91.1%

        \[\leadsto x \cdot \frac{y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      4. associate-/l*94.3%

        \[\leadsto x \cdot \frac{y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
    4. Applied egg-rr94.3%

      \[\leadsto \color{blue}{x \cdot \frac{y}{a} - t \cdot \frac{z}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 8 \cdot 10^{-40}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 51.0% accurate, 0.9× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq 1.55 \cdot 10^{-248}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (* a_s (if (<= t 1.55e-248) (/ (* x y) a_m) (* y (/ x a_m)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (t <= 1.55e-248) {
		tmp = (x * y) / a_m;
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a_m
    real(8) :: tmp
    if (t <= 1.55d-248) then
        tmp = (x * y) / a_m
    else
        tmp = y * (x / a_m)
    end if
    code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (t <= 1.55e-248) {
		tmp = (x * y) / a_m;
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a_m = math.fabs(a)
a_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if t <= 1.55e-248:
		tmp = (x * y) / a_m
	else:
		tmp = y * (x / a_m)
	return a_s * tmp
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (t <= 1.55e-248)
		tmp = Float64(Float64(x * y) / a_m);
	else
		tmp = Float64(y * Float64(x / a_m));
	end
	return Float64(a_s * tmp)
end
a_m = abs(a);
a_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if (t <= 1.55e-248)
		tmp = (x * y) / a_m;
	else
		tmp = y * (x / a_m);
	end
	tmp_2 = a_s * tmp;
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[t, 1.55e-248], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 1.55 \cdot 10^{-248}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.5500000000000001e-248

    1. Initial program 94.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 55.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]

    if 1.5500000000000001e-248 < t

    1. Initial program 87.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub86.0%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. add-cube-cbrt85.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
      3. times-frac88.9%

        \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
      4. fma-neg88.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right)} \]
      5. pow288.9%

        \[\leadsto \mathsf{fma}\left(\frac{x}{\color{blue}{{\left(\sqrt[3]{a}\right)}^{2}}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right) \]
      6. *-commutative88.9%

        \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\frac{\color{blue}{t \cdot z}}{a}\right) \]
      7. associate-/l*91.7%

        \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\color{blue}{t \cdot \frac{z}{a}}\right) \]
    4. Applied egg-rr91.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -t \cdot \frac{z}{a}\right)} \]
    5. Taylor expanded in x around inf 45.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. associate-*l/48.7%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
      2. *-commutative48.7%

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
    7. Simplified48.7%

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.55 \cdot 10^{-248}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 51.6% accurate, 1.8× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right) \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* x (/ y a_m))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (x * (y / a_m));
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a_m
    code = a_s * (x * (y / a_m))
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (x * (y / a_m));
}
a_m = math.fabs(a)
a_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	return a_s * (x * (y / a_m))
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	return Float64(a_s * Float64(x * Float64(y / a_m)))
end
a_m = abs(a);
a_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp = code(a_s, x, y, z, t, a_m)
	tmp = a_s * (x * (y / a_m));
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right)
\end{array}
Derivation
  1. Initial program 91.2%

    \[\frac{x \cdot y - z \cdot t}{a} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 50.1%

    \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
  4. Step-by-step derivation
    1. associate-*r/52.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
  5. Simplified52.9%

    \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
  6. Final simplification52.9%

    \[\leadsto x \cdot \frac{y}{a} \]
  7. Add Preprocessing

Alternative 11: 51.0% accurate, 1.8× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ a_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \left(y \cdot \frac{x}{a\_m}\right) \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* y (/ x a_m))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (y * (x / a_m));
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a_m
    code = a_s * (y * (x / a_m))
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (y * (x / a_m));
}
a_m = math.fabs(a)
a_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	return a_s * (y * (x / a_m))
a_m = abs(a)
a_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	return Float64(a_s * Float64(y * Float64(x / a_m)))
end
a_m = abs(a);
a_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp = code(a_s, x, y, z, t, a_m)
	tmp = a_s * (y * (x / a_m));
end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(y \cdot \frac{x}{a\_m}\right)
\end{array}
Derivation
  1. Initial program 91.2%

    \[\frac{x \cdot y - z \cdot t}{a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub88.4%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
    2. add-cube-cbrt87.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
    3. times-frac87.3%

      \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}} - \frac{z \cdot t}{a} \]
    4. fma-neg88.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right)} \]
    5. pow288.1%

      \[\leadsto \mathsf{fma}\left(\frac{x}{\color{blue}{{\left(\sqrt[3]{a}\right)}^{2}}}, \frac{y}{\sqrt[3]{a}}, -\frac{z \cdot t}{a}\right) \]
    6. *-commutative88.1%

      \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\frac{\color{blue}{t \cdot z}}{a}\right) \]
    7. associate-/l*88.1%

      \[\leadsto \mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -\color{blue}{t \cdot \frac{z}{a}}\right) \]
  4. Applied egg-rr88.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{{\left(\sqrt[3]{a}\right)}^{2}}, \frac{y}{\sqrt[3]{a}}, -t \cdot \frac{z}{a}\right)} \]
  5. Taylor expanded in x around inf 50.1%

    \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
  6. Step-by-step derivation
    1. associate-*l/50.9%

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    2. *-commutative50.9%

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
  7. Simplified50.9%

    \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
  8. Final simplification50.9%

    \[\leadsto y \cdot \frac{x}{a} \]
  9. Add Preprocessing

Developer target: 91.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
   (if (< z -2.468684968699548e+170)
     t_1
     (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = ((y / a) * x) - ((t / a) * z);
	double tmp;
	if (z < -2.468684968699548e+170) {
		tmp = t_1;
	} else if (z < 6.309831121978371e-71) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = ((y / a) * x) - ((t / a) * z)
    if (z < (-2.468684968699548d+170)) then
        tmp = t_1
    else if (z < 6.309831121978371d-71) then
        tmp = ((x * y) - (z * t)) / a
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = ((y / a) * x) - ((t / a) * z);
	double tmp;
	if (z < -2.468684968699548e+170) {
		tmp = t_1;
	} else if (z < 6.309831121978371e-71) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = ((y / a) * x) - ((t / a) * z)
	tmp = 0
	if z < -2.468684968699548e+170:
		tmp = t_1
	elif z < 6.309831121978371e-71:
		tmp = ((x * y) - (z * t)) / a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z))
	tmp = 0.0
	if (z < -2.468684968699548e+170)
		tmp = t_1;
	elseif (z < 6.309831121978371e-71)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = ((y / a) * x) - ((t / a) * z);
	tmp = 0.0;
	if (z < -2.468684968699548e+170)
		tmp = t_1;
	elseif (z < 6.309831121978371e-71)
		tmp = ((x * y) - (z * t)) / a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024046 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :alt
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

  (/ (- (* x y) (* z t)) a))