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

Percentage Accurate: 91.3% → 94.8%
Time: 8.0s
Alternatives: 7
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 7 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.3% 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: 94.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}\;a\_m \leq 3.9 \cdot 10^{+42}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a\_m}, x, \left(-t\right) \cdot \frac{z}{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.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= a_m 3.9e+42)
    (/ (- (* x y) (* z t)) a_m)
    (fma (/ y a_m) x (* (- 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 <= 3.9e+42) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = fma((y / a_m), x, (-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 <= 3.9e+42)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = fma(Float64(y / a_m), x, 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, 3.9e+42], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(y / a$95$m), $MachinePrecision] * x + 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 3.9 \cdot 10^{+42}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\

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


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

    1. Initial program 90.9%

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

    if 3.8999999999999997e42 < a

    1. Initial program 73.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. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
      5. *-commutativeN/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      6. associate-/l*N/A

        \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
      7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

Alternative 2: 96.1% accurate, 0.3× 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])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+268}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(y, \frac{x}{t}, -z\right)}{a\_m} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_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.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (*
    a_s
    (if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+268)))
      (* (/ (fma y (/ x t) (- z)) a_m) t)
      (/ t_1 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 t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+268)) {
		tmp = (fma(y, (x / t), -z) / a_m) * t;
	} else {
		tmp = t_1 / 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)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+268))
		tmp = Float64(Float64(fma(y, Float64(x / t), Float64(-z)) / a_m) * t);
	else
		tmp = Float64(t_1 / 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+268]], $MachinePrecision]], N[(N[(N[(y * N[(x / t), $MachinePrecision] + (-z)), $MachinePrecision] / a$95$m), $MachinePrecision] * t), $MachinePrecision], N[(t$95$1 / 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])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+268}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \frac{x}{t}, -z\right)}{a\_m} \cdot t\\

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


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

    1. Initial program 57.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. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
      5. *-commutativeN/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      6. associate-/l*N/A

        \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
      7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \frac{z}{a} + \frac{x \cdot y}{a \cdot t}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999999e268

      1. Initial program 99.3%

        \[\frac{x \cdot y - z \cdot t}{a} \]
      2. Add Preprocessing
    9. Recombined 2 regimes into one program.
    10. Final simplification94.7%

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

    Alternative 3: 54.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])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+304}:\\ \;\;\;\;\frac{x}{a\_m} \cdot y\\ \mathbf{elif}\;t\_1 \leq 10^{+223}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a\_m} \cdot x\\ \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.
    (FPCore (a_s x y z t a_m)
     :precision binary64
     (let* ((t_1 (- (* x y) (* z t))))
       (*
        a_s
        (if (<= t_1 -1e+304)
          (* (/ x a_m) y)
          (if (<= t_1 1e+223) (/ (* x y) a_m) (* (/ y a_m) x))))))
    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 t_1 = (x * y) - (z * t);
    	double tmp;
    	if (t_1 <= -1e+304) {
    		tmp = (x / a_m) * y;
    	} else if (t_1 <= 1e+223) {
    		tmp = (x * y) / a_m;
    	} else {
    		tmp = (y / a_m) * x;
    	}
    	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) :: t_1
        real(8) :: tmp
        t_1 = (x * y) - (z * t)
        if (t_1 <= (-1d+304)) then
            tmp = (x / a_m) * y
        else if (t_1 <= 1d+223) then
            tmp = (x * y) / a_m
        else
            tmp = (y / a_m) * x
        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 t_1 = (x * y) - (z * t);
    	double tmp;
    	if (t_1 <= -1e+304) {
    		tmp = (x / a_m) * y;
    	} else if (t_1 <= 1e+223) {
    		tmp = (x * y) / a_m;
    	} else {
    		tmp = (y / a_m) * x;
    	}
    	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):
    	t_1 = (x * y) - (z * t)
    	tmp = 0
    	if t_1 <= -1e+304:
    		tmp = (x / a_m) * y
    	elif t_1 <= 1e+223:
    		tmp = (x * y) / a_m
    	else:
    		tmp = (y / a_m) * x
    	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)
    	t_1 = Float64(Float64(x * y) - Float64(z * t))
    	tmp = 0.0
    	if (t_1 <= -1e+304)
    		tmp = Float64(Float64(x / a_m) * y);
    	elseif (t_1 <= 1e+223)
    		tmp = Float64(Float64(x * y) / a_m);
    	else
    		tmp = Float64(Float64(y / a_m) * x);
    	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)
    	t_1 = (x * y) - (z * t);
    	tmp = 0.0;
    	if (t_1 <= -1e+304)
    		tmp = (x / a_m) * y;
    	elseif (t_1 <= 1e+223)
    		tmp = (x * y) / a_m;
    	else
    		tmp = (y / a_m) * x;
    	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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, -1e+304], N[(N[(x / a$95$m), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 1e+223], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(y / a$95$m), $MachinePrecision] * x), $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])\\
    \\
    \begin{array}{l}
    t_1 := x \cdot y - z \cdot t\\
    a\_s \cdot \begin{array}{l}
    \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+304}:\\
    \;\;\;\;\frac{x}{a\_m} \cdot y\\
    
    \mathbf{elif}\;t\_1 \leq 10^{+223}:\\
    \;\;\;\;\frac{x \cdot y}{a\_m}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{y}{a\_m} \cdot x\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999994e303

      1. Initial program 66.6%

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

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

          \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
        3. lower-/.f6455.8

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

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

      if -9.9999999999999994e303 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000005e223

      1. Initial program 99.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. *-commutativeN/A

          \[\leadsto \frac{-1 \cdot \color{blue}{\left(z \cdot t\right)}}{a} \]
        2. associate-*r*N/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      7. Step-by-step derivation
        1. lower-*.f6453.6

          \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      8. Applied rewrites53.6%

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

      if 1.00000000000000005e223 < (-.f64 (*.f64 x y) (*.f64 z t))

      1. Initial program 61.3%

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

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

          \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
        3. lower-/.f6463.1

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

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

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

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

      Alternative 4: 95.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])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+266} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+273}\right):\\ \;\;\;\;\frac{y}{a\_m} \cdot 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 #s(literal 1 binary64) 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 (or (<= (* x y) -1e+266) (not (<= (* x y) 2e+273)))
          (* (/ 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) <= -1e+266) || !((x * y) <= 2e+273)) {
      		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.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+266)) .or. (.not. ((x * y) <= 2d+273))) then
              tmp = (y / a_m) * x
          else
              tmp = ((x * y) - (z * t)) / 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+266) || !((x * y) <= 2e+273)) {
      		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) <= -1e+266) or not ((x * y) <= 2e+273):
      		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) <= -1e+266) || !(Float64(x * y) <= 2e+273))
      		tmp = Float64(Float64(y / 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) <= -1e+266) || ~(((x * y) <= 2e+273)))
      		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[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+266], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+273]], $MachinePrecision]], N[(N[(y / a$95$m), $MachinePrecision] * x), $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 -1 \cdot 10^{+266} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+273}\right):\\
      \;\;\;\;\frac{y}{a\_m} \cdot 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) < -1e266 or 1.99999999999999989e273 < (*.f64 x y)

        1. Initial program 61.5%

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

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

            \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
          3. lower-/.f6495.7

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

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

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

          if -1e266 < (*.f64 x y) < 1.99999999999999989e273

          1. Initial program 93.1%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+266} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+273}\right):\\ \;\;\;\;\frac{y}{a} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 5: 73.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])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-37}:\\ \;\;\;\;\frac{y}{a\_m} \cdot x\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a\_m} \cdot y\\ \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.
        (FPCore (a_s x y z t a_m)
         :precision binary64
         (*
          a_s
          (if (<= (* x y) -1e-37)
            (* (/ y a_m) x)
            (if (<= (* x y) 2e-6) (* (- 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);
        double code(double a_s, double x, double y, double z, double t, double a_m) {
        	double tmp;
        	if ((x * y) <= -1e-37) {
        		tmp = (y / a_m) * x;
        	} else if ((x * y) <= 2e-6) {
        		tmp = -t * (z / a_m);
        	} else {
        		tmp = (x / a_m) * y;
        	}
        	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-37)) then
                tmp = (y / a_m) * x
            else if ((x * y) <= 2d-6) then
                tmp = -t * (z / a_m)
            else
                tmp = (x / a_m) * y
            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-37) {
        		tmp = (y / a_m) * x;
        	} else if ((x * y) <= 2e-6) {
        		tmp = -t * (z / a_m);
        	} else {
        		tmp = (x / a_m) * y;
        	}
        	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-37:
        		tmp = (y / a_m) * x
        	elif (x * y) <= 2e-6:
        		tmp = -t * (z / a_m)
        	else:
        		tmp = (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])
        function code(a_s, x, y, z, t, a_m)
        	tmp = 0.0
        	if (Float64(x * y) <= -1e-37)
        		tmp = Float64(Float64(y / a_m) * x);
        	elseif (Float64(x * y) <= 2e-6)
        		tmp = Float64(Float64(-t) * Float64(z / a_m));
        	else
        		tmp = Float64(Float64(x / a_m) * y);
        	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-37)
        		tmp = (y / a_m) * x;
        	elseif ((x * y) <= 2e-6)
        		tmp = -t * (z / a_m);
        	else
        		tmp = (x / a_m) * y;
        	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-37], N[(N[(y / a$95$m), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-6], N[((-t) * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x / a$95$m), $MachinePrecision] * y), $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^{-37}:\\
        \;\;\;\;\frac{y}{a\_m} \cdot x\\
        
        \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-6}:\\
        \;\;\;\;\left(-t\right) \cdot \frac{z}{a\_m}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{a\_m} \cdot y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (*.f64 x y) < -1.00000000000000007e-37

          1. Initial program 86.3%

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

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

              \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
            3. lower-/.f6470.4

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

            \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
          6. Step-by-step derivation
            1. Applied rewrites75.0%

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

            if -1.00000000000000007e-37 < (*.f64 x y) < 1.99999999999999991e-6

            1. Initial program 92.5%

              \[\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. lift-*.f64N/A

                \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
              5. *-commutativeN/A

                \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
              6. associate-/l*N/A

                \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
              7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 1.99999999999999991e-6 < (*.f64 x y)

            1. Initial program 76.8%

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

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

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              3. lower-/.f6485.0

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-37}:\\ \;\;\;\;\frac{y}{a} \cdot x\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \end{array} \]
          9. Add Preprocessing

          Alternative 6: 51.6% accurate, 1.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}\;z \leq -4 \cdot 10^{-112}:\\ \;\;\;\;\frac{x}{a\_m} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a\_m} \cdot x\\ \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.
          (FPCore (a_s x y z t a_m)
           :precision binary64
           (* a_s (if (<= z -4e-112) (* (/ x a_m) y) (* (/ y a_m) x))))
          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 (z <= -4e-112) {
          		tmp = (x / a_m) * y;
          	} else {
          		tmp = (y / a_m) * x;
          	}
          	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 (z <= (-4d-112)) then
                  tmp = (x / a_m) * y
              else
                  tmp = (y / a_m) * x
              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 (z <= -4e-112) {
          		tmp = (x / a_m) * y;
          	} else {
          		tmp = (y / a_m) * x;
          	}
          	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 z <= -4e-112:
          		tmp = (x / a_m) * y
          	else:
          		tmp = (y / a_m) * x
          	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 (z <= -4e-112)
          		tmp = Float64(Float64(x / a_m) * y);
          	else
          		tmp = Float64(Float64(y / a_m) * x);
          	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 (z <= -4e-112)
          		tmp = (x / a_m) * y;
          	else
          		tmp = (y / a_m) * x;
          	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[z, -4e-112], N[(N[(x / a$95$m), $MachinePrecision] * y), $MachinePrecision], N[(N[(y / a$95$m), $MachinePrecision] * x), $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}\;z \leq -4 \cdot 10^{-112}:\\
          \;\;\;\;\frac{x}{a\_m} \cdot y\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{y}{a\_m} \cdot x\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -3.9999999999999998e-112

            1. Initial program 89.1%

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

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

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              3. lower-/.f6446.6

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

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

            if -3.9999999999999998e-112 < z

            1. Initial program 85.9%

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

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

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              3. lower-/.f6454.1

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

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

                \[\leadsto \frac{y}{a} \cdot \color{blue}{x} \]
            7. Recombined 2 regimes into one program.
            8. Final simplification53.2%

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

            Alternative 7: 51.7% 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])\\ \\ a\_s \cdot \left(\frac{x}{a\_m} \cdot y\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.
            (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* (/ x a_m) y)))
            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 / a_m) * y);
            }
            
            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 / a_m) * y)
            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 / a_m) * y);
            }
            
            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 / a_m) * y)
            
            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(Float64(x / a_m) * y))
            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 / a_m) * y);
            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[(N[(x / a$95$m), $MachinePrecision] * y), $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(\frac{x}{a\_m} \cdot y\right)
            \end{array}
            
            Derivation
            1. Initial program 87.0%

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

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

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
              3. lower-/.f6451.6

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

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

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

            Developer Target 1: 90.9% 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 2024326 
            (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))