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

Percentage Accurate: 91.7% → 93.8%
Time: 11.5s
Alternatives: 10
Speedup: 1.0×

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 10 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.7% 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: 93.8% accurate, 0.5× 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])\\\\ [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.6 \cdot 10^{+101}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a\_m}, x, \frac{z}{\frac{a\_m}{-t}}\right)\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
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.6e+101)
    (/ (- (* x y) (* z t)) a_m)
    (fma (/ y a_m) x (/ z (/ a_m (- t)))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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.6e+101) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = fma((y / a_m), x, (z / (a_m / -t)));
	}
	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])
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.6e+101)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = fma(Float64(y / a_m), x, Float64(z / Float64(a_m / Float64(-t))));
	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.
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.6e+101], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(y / a$95$m), $MachinePrecision] * x + N[(z / N[(a$95$m / (-t)), $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])\\\\
[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.6 \cdot 10^{+101}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\

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


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

    1. Initial program 95.3%

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

    if 1.60000000000000003e101 < a

    1. Initial program 80.3%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
      3. div-subN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      4. sub-negN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} + \left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} + \left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right) \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} + \left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y}{a} \cdot x} + \left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right) \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, x, \mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right)} \]
      9. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{a}}, x, \mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right) \]
      10. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \color{blue}{\mathsf{neg}\left(\frac{z \cdot t}{a}\right)}\right) \]
      11. lower-/.f6477.5

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, x, -\frac{z \cdot t}{a}\right)} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \color{blue}{\mathsf{neg}\left(\frac{z \cdot t}{a}\right)}\right) \]
      2. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \mathsf{neg}\left(\color{blue}{\frac{z \cdot t}{a}}\right)\right) \]
      3. lift-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \mathsf{neg}\left(\color{blue}{z \cdot \frac{t}{a}}\right)\right) \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \frac{t}{a}}\right) \]
      6. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \frac{t}{a}\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \left(\mathsf{neg}\left(z\right)\right) \cdot \color{blue}{\frac{1}{\frac{a}{t}}}\right) \]
      8. un-div-invN/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \color{blue}{\frac{\mathsf{neg}\left(z\right)}{\frac{a}{t}}}\right) \]
      9. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, x, \color{blue}{\frac{\mathsf{neg}\left(z\right)}{\frac{a}{t}}}\right) \]
      10. lower-/.f6488.5

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

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

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

Alternative 2: 93.7% accurate, 0.5× 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])\\\\ [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.8 \cdot 10^{+120}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a\_m}, \frac{x}{\frac{a\_m}{y}}\right)\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
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.8e+120)
    (/ (- (* x y) (* z t)) a_m)
    (fma (- t) (/ z a_m) (/ x (/ a_m y))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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.8e+120) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = fma(-t, (z / a_m), (x / (a_m / y)));
	}
	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])
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.8e+120)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = fma(Float64(-t), Float64(z / a_m), Float64(x / Float64(a_m / y)));
	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.
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.8e+120], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[((-t) * N[(z / a$95$m), $MachinePrecision] + N[(x / N[(a$95$m / y), $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])\\\\
[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.8 \cdot 10^{+120}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\

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


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

    1. Initial program 95.4%

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

    if 9.80000000000000021e120 < a

    1. Initial program 78.4%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
      3. div-subN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      4. sub-negN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} + \left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right)} \]
      5. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right) + \frac{x \cdot y}{a}} \]
      6. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{z \cdot t}}{a}\right)\right) + \frac{x \cdot y}{a} \]
      7. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{t \cdot z}}{a}\right)\right) + \frac{x \cdot y}{a} \]
      8. associate-/l*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{t \cdot \frac{z}{a}}\right)\right) + \frac{x \cdot y}{a} \]
      9. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(t\right)\right) \cdot \frac{z}{a}} + \frac{x \cdot y}{a} \]
      10. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \frac{x \cdot y}{a}\right)} \]
      11. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(t\right)}, \frac{z}{a}, \frac{x \cdot y}{a}\right) \]
      12. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \color{blue}{\frac{z}{a}}, \frac{x \cdot y}{a}\right) \]
      13. lower-/.f6488.2

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \color{blue}{\frac{x \cdot y}{a}}\right) \]
      2. lift-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \color{blue}{x \cdot \frac{y}{a}}\right) \]
      4. clear-numN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \color{blue}{\frac{x}{\frac{a}{y}}}\right) \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \color{blue}{\frac{x}{\frac{a}{y}}}\right) \]
      7. lower-/.f6488.1

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

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

Alternative 3: 71.0% accurate, 0.5× 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ \begin{array}{l} t_1 := -z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+31}:\\ \;\;\;\;\frac{t\_1}{a\_m}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-122}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \frac{1}{a\_m}\\ \end{array} \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
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
 (let* ((t_1 (- (* z t))))
   (*
    a_s
    (if (<= (* z t) -4e+31)
      (/ t_1 a_m)
      (if (<= (* z t) 5e-122) (/ (* x y) a_m) (* t_1 (/ 1.0 a_m)))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 t_1 = -(z * t);
	double tmp;
	if ((z * t) <= -4e+31) {
		tmp = t_1 / a_m;
	} else if ((z * t) <= 5e-122) {
		tmp = (x * y) / a_m;
	} else {
		tmp = t_1 * (1.0 / 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.
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) :: t_1
    real(8) :: tmp
    t_1 = -(z * t)
    if ((z * t) <= (-4d+31)) then
        tmp = t_1 / a_m
    else if ((z * t) <= 5d-122) then
        tmp = (x * y) / a_m
    else
        tmp = t_1 * (1.0d0 / 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;
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 t_1 = -(z * t);
	double tmp;
	if ((z * t) <= -4e+31) {
		tmp = t_1 / a_m;
	} else if ((z * t) <= 5e-122) {
		tmp = (x * y) / a_m;
	} else {
		tmp = t_1 * (1.0 / 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])
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	t_1 = -(z * t)
	tmp = 0
	if (z * t) <= -4e+31:
		tmp = t_1 / a_m
	elif (z * t) <= 5e-122:
		tmp = (x * y) / a_m
	else:
		tmp = t_1 * (1.0 / 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])
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	t_1 = Float64(-Float64(z * t))
	tmp = 0.0
	if (Float64(z * t) <= -4e+31)
		tmp = Float64(t_1 / a_m);
	elseif (Float64(z * t) <= 5e-122)
		tmp = Float64(Float64(x * y) / a_m);
	else
		tmp = Float64(t_1 * Float64(1.0 / 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])){:}
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)
	t_1 = -(z * t);
	tmp = 0.0;
	if ((z * t) <= -4e+31)
		tmp = t_1 / a_m;
	elseif ((z * t) <= 5e-122)
		tmp = (x * y) / a_m;
	else
		tmp = t_1 * (1.0 / 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.
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_] := Block[{t$95$1 = (-N[(z * t), $MachinePrecision])}, N[(a$95$s * If[LessEqual[N[(z * t), $MachinePrecision], -4e+31], N[(t$95$1 / a$95$m), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-122], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], N[(t$95$1 * N[(1.0 / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := -z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+31}:\\
\;\;\;\;\frac{t\_1}{a\_m}\\

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

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{1}{a\_m}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -3.9999999999999999e31

    1. Initial program 92.9%

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(t \cdot z\right)}}{a} \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(\mathsf{neg}\left(z\right)\right)}}{a} \]
      3. mul-1-negN/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(-1 \cdot z\right)}}{a} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{t \cdot \left(-1 \cdot z\right)}}{a} \]
      5. mul-1-negN/A

        \[\leadsto \frac{t \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}}{a} \]
      6. lower-neg.f6476.8

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

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

    if -3.9999999999999999e31 < (*.f64 z t) < 4.9999999999999999e-122

    1. Initial program 94.7%

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    4. Step-by-step derivation
      1. lower-*.f6482.0

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    5. Applied rewrites82.0%

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

    if 4.9999999999999999e-122 < (*.f64 z t)

    1. Initial program 89.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
      2. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{x \cdot y - z \cdot t}}} \]
      3. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(x \cdot y - z \cdot t\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(x \cdot y - z \cdot t\right)} \]
      5. lower-/.f6489.9

        \[\leadsto \color{blue}{\frac{1}{a}} \cdot \left(x \cdot y - z \cdot t\right) \]
    4. Applied rewrites89.9%

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(x \cdot y - z \cdot t\right)} \]
    5. Taylor expanded in x around 0

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

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(\mathsf{neg}\left(t \cdot z\right)\right)} \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(t \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} \]
      3. mul-1-negN/A

        \[\leadsto \frac{1}{a} \cdot \left(t \cdot \color{blue}{\left(-1 \cdot z\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(t \cdot \left(-1 \cdot z\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto \frac{1}{a} \cdot \left(t \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}\right) \]
      6. lower-neg.f6466.1

        \[\leadsto \frac{1}{a} \cdot \left(t \cdot \color{blue}{\left(-z\right)}\right) \]
    7. Applied rewrites66.1%

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(t \cdot \left(-z\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+31}:\\ \;\;\;\;\frac{-z \cdot t}{a}\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-122}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-z \cdot t\right) \cdot \frac{1}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 93.3% 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq 2 \cdot 10^{+296}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{\frac{a\_m}{t}}{z}}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
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 (<= (* z t) 2e+296)
    (/ (fma (- z) t (* x y)) a_m)
    (/ -1.0 (/ (/ a_m t) z)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 ((z * t) <= 2e+296) {
		tmp = fma(-z, t, (x * y)) / a_m;
	} else {
		tmp = -1.0 / ((a_m / t) / 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])
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(z * t) <= 2e+296)
		tmp = Float64(fma(Float64(-z), t, Float64(x * y)) / a_m);
	else
		tmp = Float64(-1.0 / Float64(Float64(a_m / t) / 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.
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[(z * t), $MachinePrecision], 2e+296], N[(N[((-z) * t + N[(x * y), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(-1.0 / N[(N[(a$95$m / t), $MachinePrecision] / z), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq 2 \cdot 10^{+296}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{\frac{a\_m}{t}}{z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < 1.99999999999999996e296

    1. Initial program 94.3%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}}{a} \]
      3. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + x \cdot y}}{a} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + x \cdot y}{a} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + x \cdot y}{a} \]
      6. lower-fma.f64N/A

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

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

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

    if 1.99999999999999996e296 < (*.f64 z t)

    1. Initial program 63.4%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
      2. div-invN/A

        \[\leadsto \color{blue}{\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}} \]
      3. lift--.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot y - z \cdot t\right)} \cdot \frac{1}{a} \]
      4. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}{x \cdot y + z \cdot t}} \cdot \frac{1}{a} \]
      5. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot y + z \cdot t}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}}} \cdot \frac{1}{a} \]
      6. frac-2negN/A

        \[\leadsto \frac{1}{\frac{x \cdot y + z \cdot t}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}} \cdot \color{blue}{\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(a\right)}} \]
      7. metadata-evalN/A

        \[\leadsto \frac{1}{\frac{x \cdot y + z \cdot t}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)}} \cdot \frac{\color{blue}{-1}}{\mathsf{neg}\left(a\right)} \]
      8. frac-timesN/A

        \[\leadsto \color{blue}{\frac{1 \cdot -1}{\frac{x \cdot y + z \cdot t}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot \left(\mathsf{neg}\left(a\right)\right)}} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{-1}}{\frac{x \cdot y + z \cdot t}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot \left(\mathsf{neg}\left(a\right)\right)} \]
      10. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1}{\frac{x \cdot y + z \cdot t}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot \left(\mathsf{neg}\left(a\right)\right)}} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\frac{x \cdot y + z \cdot t}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - \left(z \cdot t\right) \cdot \left(z \cdot t\right)} \cdot \left(\mathsf{neg}\left(a\right)\right)}} \]
    4. Applied rewrites63.4%

      \[\leadsto \color{blue}{\frac{-1}{\frac{1}{x \cdot y - z \cdot t} \cdot \left(-a\right)}} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{\color{blue}{\frac{a}{t \cdot z}}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\frac{a}{t \cdot z}}} \]
      2. lower-*.f6463.3

        \[\leadsto \frac{-1}{\frac{a}{\color{blue}{t \cdot z}}} \]
    7. Applied rewrites63.3%

      \[\leadsto \frac{-1}{\color{blue}{\frac{a}{t \cdot z}}} \]
    8. Step-by-step derivation
      1. Applied rewrites99.9%

        \[\leadsto \frac{-1}{\frac{\frac{a}{t}}{\color{blue}{z}}} \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 5: 93.9% 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])\\\\ [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 3.8 \cdot 10^{+121}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a\_m}, y \cdot \frac{x}{a\_m}\right)\\ \end{array} \end{array} \]
    a\_m = (fabs.f64 a)
    a\_s = (copysign.f64 #s(literal 1 binary64) a)
    NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
    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 3.8e+121)
        (/ (- (* x y) (* z t)) a_m)
        (fma (- 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);
    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 <= 3.8e+121) {
    		tmp = ((x * y) - (z * t)) / a_m;
    	} else {
    		tmp = fma(-t, (z / a_m), (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])
    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 <= 3.8e+121)
    		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
    	else
    		tmp = fma(Float64(-t), Float64(z / a_m), Float64(y * Float64(x / 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.
    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, 3.8e+121], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[((-t) * N[(z / a$95$m), $MachinePrecision] + N[(y * N[(x / 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])\\\\
    [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 3.8 \cdot 10^{+121}:\\
    \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(-t, \frac{z}{a\_m}, y \cdot \frac{x}{a\_m}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < 3.8e121

      1. Initial program 95.4%

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

      if 3.8e121 < a

      1. Initial program 78.4%

        \[\frac{x \cdot y - z \cdot t}{a} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
        3. div-subN/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
        4. sub-negN/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{a} + \left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right)} \]
        5. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{z \cdot t}{a}\right)\right) + \frac{x \cdot y}{a}} \]
        6. lift-*.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{z \cdot t}}{a}\right)\right) + \frac{x \cdot y}{a} \]
        7. *-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{t \cdot z}}{a}\right)\right) + \frac{x \cdot y}{a} \]
        8. associate-/l*N/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{t \cdot \frac{z}{a}}\right)\right) + \frac{x \cdot y}{a} \]
        9. distribute-lft-neg-inN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(t\right)\right) \cdot \frac{z}{a}} + \frac{x \cdot y}{a} \]
        10. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \frac{x \cdot y}{a}\right)} \]
        11. lower-neg.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(t\right)}, \frac{z}{a}, \frac{x \cdot y}{a}\right) \]
        12. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \color{blue}{\frac{z}{a}}, \frac{x \cdot y}{a}\right) \]
        13. lower-/.f6488.2

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

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

          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \color{blue}{\frac{x \cdot y}{a}}\right) \]
        2. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \frac{\color{blue}{x \cdot y}}{a}\right) \]
        3. *-commutativeN/A

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

          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \color{blue}{y \cdot \frac{x}{a}}\right) \]
        5. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), \frac{z}{a}, \color{blue}{y \cdot \frac{x}{a}}\right) \]
        6. lower-/.f6492.0

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

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

    Alternative 6: 71.0% 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ \begin{array}{l} t_1 := \frac{-z \cdot t}{a\_m}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+31}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-122}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
    a\_m = (fabs.f64 a)
    a\_s = (copysign.f64 #s(literal 1 binary64) a)
    NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
    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
     (let* ((t_1 (/ (- (* z t)) a_m)))
       (*
        a_s
        (if (<= (* z t) -4e+31)
          t_1
          (if (<= (* z t) 5e-122) (/ (* x y) a_m) t_1)))))
    a\_m = fabs(a);
    a\_s = copysign(1.0, a);
    assert(x < y && y < z && z < t && t < a_m);
    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 t_1 = -(z * t) / a_m;
    	double tmp;
    	if ((z * t) <= -4e+31) {
    		tmp = t_1;
    	} else if ((z * t) <= 5e-122) {
    		tmp = (x * y) / a_m;
    	} else {
    		tmp = t_1;
    	}
    	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.
    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) :: t_1
        real(8) :: tmp
        t_1 = -(z * t) / a_m
        if ((z * t) <= (-4d+31)) then
            tmp = t_1
        else if ((z * t) <= 5d-122) then
            tmp = (x * y) / a_m
        else
            tmp = t_1
        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;
    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 t_1 = -(z * t) / a_m;
    	double tmp;
    	if ((z * t) <= -4e+31) {
    		tmp = t_1;
    	} else if ((z * t) <= 5e-122) {
    		tmp = (x * y) / a_m;
    	} else {
    		tmp = t_1;
    	}
    	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])
    [x, y, z, t, a_m] = sort([x, y, z, t, a_m])
    def code(a_s, x, y, z, t, a_m):
    	t_1 = -(z * t) / a_m
    	tmp = 0
    	if (z * t) <= -4e+31:
    		tmp = t_1
    	elif (z * t) <= 5e-122:
    		tmp = (x * y) / a_m
    	else:
    		tmp = t_1
    	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])
    x, y, z, t, a_m = sort([x, y, z, t, a_m])
    function code(a_s, x, y, z, t, a_m)
    	t_1 = Float64(Float64(-Float64(z * t)) / a_m)
    	tmp = 0.0
    	if (Float64(z * t) <= -4e+31)
    		tmp = t_1;
    	elseif (Float64(z * t) <= 5e-122)
    		tmp = Float64(Float64(x * y) / a_m);
    	else
    		tmp = t_1;
    	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])){:}
    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)
    	t_1 = -(z * t) / a_m;
    	tmp = 0.0;
    	if ((z * t) <= -4e+31)
    		tmp = t_1;
    	elseif ((z * t) <= 5e-122)
    		tmp = (x * y) / a_m;
    	else
    		tmp = t_1;
    	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.
    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_] := Block[{t$95$1 = N[((-N[(z * t), $MachinePrecision]) / a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(z * t), $MachinePrecision], -4e+31], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-122], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], t$95$1]]), $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])\\\\
    [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
    \\
    \begin{array}{l}
    t_1 := \frac{-z \cdot t}{a\_m}\\
    a\_s \cdot \begin{array}{l}
    \mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+31}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-122}:\\
    \;\;\;\;\frac{x \cdot y}{a\_m}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 z t) < -3.9999999999999999e31 or 4.9999999999999999e-122 < (*.f64 z t)

      1. Initial program 91.3%

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

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

          \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(t \cdot z\right)}}{a} \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto \frac{\color{blue}{t \cdot \left(\mathsf{neg}\left(z\right)\right)}}{a} \]
        3. mul-1-negN/A

          \[\leadsto \frac{t \cdot \color{blue}{\left(-1 \cdot z\right)}}{a} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\color{blue}{t \cdot \left(-1 \cdot z\right)}}{a} \]
        5. mul-1-negN/A

          \[\leadsto \frac{t \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}}{a} \]
        6. lower-neg.f6471.1

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

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

      if -3.9999999999999999e31 < (*.f64 z t) < 4.9999999999999999e-122

      1. Initial program 94.7%

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

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      4. Step-by-step derivation
        1. lower-*.f6482.0

          \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      5. Applied rewrites82.0%

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

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

    Alternative 7: 92.1% accurate, 1.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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a\_m} \end{array} \]
    a\_m = (fabs.f64 a)
    a\_s = (copysign.f64 #s(literal 1 binary64) a)
    NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
    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 (/ (fma (- z) t (* x y)) a_m)))
    a\_m = fabs(a);
    a\_s = copysign(1.0, a);
    assert(x < y && y < z && z < t && t < a_m);
    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 * (fma(-z, t, (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])
    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(fma(Float64(-z), t, Float64(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.
    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[(N[((-z) * t + N[(x * y), $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])\\\\
    [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
    \\
    a\_s \cdot \frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a\_m}
    \end{array}
    
    Derivation
    1. Initial program 92.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}}{a} \]
      3. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + x \cdot y}}{a} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + x \cdot y}{a} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + x \cdot y}{a} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), t, x \cdot y\right)}}{a} \]
      7. lower-neg.f6492.8

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

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

    Alternative 8: 91.7% accurate, 1.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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \frac{x \cdot y - z \cdot t}{a\_m} \end{array} \]
    a\_m = (fabs.f64 a)
    a\_s = (copysign.f64 #s(literal 1 binary64) a)
    NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
    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) (* z t)) a_m)))
    a\_m = fabs(a);
    a\_s = copysign(1.0, a);
    assert(x < y && y < z && z < t && t < a_m);
    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) - (z * t)) / 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.
    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) - (z * t)) / 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;
    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) - (z * t)) / 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])
    [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) - (z * t)) / 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])
    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(Float64(Float64(x * y) - Float64(z * t)) / 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])){:}
    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) - (z * t)) / 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.
    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[(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])\\\\
    [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
    \\
    a\_s \cdot \frac{x \cdot y - z \cdot t}{a\_m}
    \end{array}
    
    Derivation
    1. Initial program 92.8%

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

    Alternative 9: 51.1% accurate, 1.5× 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \frac{x \cdot y}{a\_m} \end{array} \]
    a\_m = (fabs.f64 a)
    a\_s = (copysign.f64 #s(literal 1 binary64) a)
    NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
    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);
    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.
    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;
    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])
    [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])
    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(Float64(x * 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])){:}
    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.
    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[(N[(x * y), $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])\\\\
    [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
    \\
    a\_s \cdot \frac{x \cdot y}{a\_m}
    \end{array}
    
    Derivation
    1. Initial program 92.8%

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    4. Step-by-step derivation
      1. lower-*.f6451.9

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    6. Add Preprocessing

    Alternative 10: 8.9% accurate, 1.5× 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \left(z \cdot \frac{t}{a\_m}\right) \end{array} \]
    a\_m = (fabs.f64 a)
    a\_s = (copysign.f64 #s(literal 1 binary64) a)
    NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
    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 (* z (/ t a_m))))
    a\_m = fabs(a);
    a\_s = copysign(1.0, a);
    assert(x < y && y < z && z < t && t < a_m);
    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 * (z * (t / 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.
    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 * (z * (t / 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;
    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 * (z * (t / 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])
    [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 * (z * (t / 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])
    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(z * Float64(t / 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])){:}
    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 * (z * (t / 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.
    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[(z * N[(t / 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])\\\\
    [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
    \\
    a\_s \cdot \left(z \cdot \frac{t}{a\_m}\right)
    \end{array}
    
    Derivation
    1. Initial program 92.8%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(z \cdot t\right)\right)}}{a} \]
      3. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) + x \cdot y}}{a} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{z \cdot t}\right)\right) + x \cdot y}{a} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot t} + x \cdot y}{a} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(z\right), t, x \cdot y\right)}}{a} \]
      7. lower-neg.f6492.8

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{x}{a}, \frac{z \cdot t}{a}\right)} \]
    6. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{t \cdot z}{a}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-*.f6410.0

        \[\leadsto \frac{\color{blue}{t \cdot z}}{a} \]
    8. Applied rewrites10.0%

      \[\leadsto \color{blue}{\frac{t \cdot z}{a}} \]
    9. Step-by-step derivation
      1. Applied rewrites10.8%

        \[\leadsto \frac{t}{a} \cdot \color{blue}{z} \]
      2. Final simplification10.8%

        \[\leadsto z \cdot \frac{t}{a} \]
      3. Add Preprocessing

      Developer Target 1: 91.7% accurate, 0.5× 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 2024232 
      (FPCore (x y z t a)
        :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
        :precision binary64
      
        :alt
        (! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
      
        (/ (- (* x y) (* z t)) a))