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

Percentage Accurate: 91.3% → 95.4%
Time: 9.7s
Alternatives: 11
Speedup: 0.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 91.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: 95.4% accurate, 0.0× speedup?

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

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


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

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

    if 2.89999999999999986e80 < a

    1. Initial program 75.7%

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt75.5%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/75.5%

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x \cdot y}{\sqrt{a}}}{\sqrt{a}}} - \frac{t \cdot z}{a} \]
      5. *-lft-identity75.5%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\sqrt{a}} \cdot \frac{y}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
  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 5 \cdot 10^{+305}\right):\\ \;\;\;\;x \cdot \left(\frac{y}{a\_m} - \frac{t \cdot \frac{z}{x}}{a\_m}\right)\\ \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 5e+305)))
      (* x (- (/ y a_m) (/ (* t (/ z x)) a_m)))
      (/ 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 <= 5e+305)) {
		tmp = x * ((y / a_m) - ((t * (z / x)) / a_m));
	} else {
		tmp = t_1 / a_m;
	}
	return a_s * tmp;
}
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+305)) {
		tmp = x * ((y / a_m) - ((t * (z / x)) / a_m));
	} else {
		tmp = t_1 / 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):
	t_1 = (x * y) - (z * t)
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 5e+305):
		tmp = x * ((y / a_m) - ((t * (z / x)) / a_m))
	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 <= 5e+305))
		tmp = Float64(x * Float64(Float64(y / a_m) - Float64(Float64(t * Float64(z / x)) / a_m)));
	else
		tmp = Float64(t_1 / 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)
	t_1 = (x * y) - (z * t);
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 5e+305)))
		tmp = x * ((y / a_m) - ((t * (z / x)) / a_m));
	else
		tmp = t_1 / 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_] := 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, 5e+305]], $MachinePrecision]], N[(x * N[(N[(y / a$95$m), $MachinePrecision] - N[(N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision]), $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 5 \cdot 10^{+305}\right):\\
\;\;\;\;x \cdot \left(\frac{y}{a\_m} - \frac{t \cdot \frac{z}{x}}{a\_m}\right)\\

\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 5.00000000000000009e305 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 67.5%

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

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{a} + -1 \cdot \frac{t \cdot z}{a \cdot x}\right)} \]
      2. mul-1-neg80.1%

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

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

        \[\leadsto x \cdot \left(\frac{y}{a} - \color{blue}{\frac{t}{a} \cdot \frac{z}{x}}\right) \]
      5. associate-*l/91.0%

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000009e305

    1. Initial program 99.6%

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

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\frac{t\_1}{a\_m}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z t)) < -5.0000000000000003e299

    1. Initial program 67.6%

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

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{t \cdot z}{a \cdot x} + \frac{y}{a}\right)} \]
    4. Step-by-step derivation
      1. +-commutative83.1%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{a} + -1 \cdot \frac{t \cdot z}{a \cdot x}\right)} \]
      2. mul-1-neg83.1%

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

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

        \[\leadsto x \cdot \left(\frac{y}{a} - \color{blue}{\frac{t}{a} \cdot \frac{z}{x}}\right) \]
      5. associate-*l/93.1%

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

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

      \[\leadsto x \cdot \color{blue}{\left(z \cdot \left(\frac{y}{a \cdot z} - \frac{t}{a \cdot x}\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative92.9%

        \[\leadsto x \cdot \left(z \cdot \left(\frac{y}{\color{blue}{z \cdot a}} - \frac{t}{a \cdot x}\right)\right) \]
    8. Simplified92.9%

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

    if -5.0000000000000003e299 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000009e305

    1. Initial program 99.6%

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

    if 5.00000000000000009e305 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 70.7%

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

      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \frac{t \cdot z}{a \cdot x} + \frac{y}{a}\right)} \]
    4. Step-by-step derivation
      1. +-commutative77.4%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{a} + -1 \cdot \frac{t \cdot z}{a \cdot x}\right)} \]
      2. mul-1-neg77.4%

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

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

        \[\leadsto x \cdot \left(\frac{y}{a} - \color{blue}{\frac{t}{a} \cdot \frac{z}{x}}\right) \]
      5. associate-*l/90.3%

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

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

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

Alternative 4: 74.0% accurate, 0.4× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 10^{-30}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a\_m}{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 (<= (* x y) -2e-41)
    (/ x (/ a_m y))
    (if (<= (* x y) 1e-30) (/ (* z (- t)) 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 tmp;
	if ((x * y) <= -2e-41) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e-30) {
		tmp = (z * -t) / 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) :: tmp
    if ((x * y) <= (-2d-41)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 1d-30) then
        tmp = (z * -t) / 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 tmp;
	if ((x * y) <= -2e-41) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e-30) {
		tmp = (z * -t) / 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):
	tmp = 0
	if (x * y) <= -2e-41:
		tmp = x / (a_m / y)
	elif (x * y) <= 1e-30:
		tmp = (z * -t) / 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)
	tmp = 0.0
	if (Float64(x * y) <= -2e-41)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 1e-30)
		tmp = Float64(Float64(z * Float64(-t)) / a_m);
	else
		tmp = Float64(y / Float64(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 ((x * y) <= -2e-41)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 1e-30)
		tmp = (z * -t) / 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_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e-41], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-30], N[(N[(z * (-t)), $MachinePrecision] / a$95$m), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

\mathbf{elif}\;x \cdot y \leq 10^{-30}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a\_m}\\

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


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

    1. Initial program 87.8%

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

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

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

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

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

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

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

    if -2.00000000000000001e-41 < (*.f64 x y) < 1e-30

    1. Initial program 98.0%

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

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

        \[\leadsto \frac{\color{blue}{-t \cdot z}}{a} \]
      2. *-commutative84.5%

        \[\leadsto \frac{-\color{blue}{z \cdot t}}{a} \]
      3. distribute-rgt-neg-in84.5%

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

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

    if 1e-30 < (*.f64 x y)

    1. Initial program 86.2%

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt34.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. associate-/l*36.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    8. Step-by-step derivation
      1. *-commutative67.7%

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
    10. Step-by-step derivation
      1. clear-num69.0%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    11. Applied egg-rr69.1%

      \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 73.9% accurate, 0.4× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -20000000:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 10^{-30}:\\ \;\;\;\;z \cdot \frac{t}{-a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a\_m}{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 (<= (* x y) -20000000.0)
    (/ x (/ a_m y))
    (if (<= (* x y) 1e-30) (* z (/ t (- 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 tmp;
	if ((x * y) <= -20000000.0) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e-30) {
		tmp = z * (t / -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) :: tmp
    if ((x * y) <= (-20000000.0d0)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 1d-30) then
        tmp = z * (t / -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 tmp;
	if ((x * y) <= -20000000.0) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e-30) {
		tmp = z * (t / -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):
	tmp = 0
	if (x * y) <= -20000000.0:
		tmp = x / (a_m / y)
	elif (x * y) <= 1e-30:
		tmp = z * (t / -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)
	tmp = 0.0
	if (Float64(x * y) <= -20000000.0)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 1e-30)
		tmp = Float64(z * Float64(t / Float64(-a_m)));
	else
		tmp = Float64(y / Float64(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 ((x * y) <= -20000000.0)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 1e-30)
		tmp = z * (t / -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_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -20000000.0], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-30], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -20000000:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

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

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


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

    1. Initial program 87.9%

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

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

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

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

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

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

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

    if -2e7 < (*.f64 x y) < 1e-30

    1. Initial program 97.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. *-commutative82.0%

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

        \[\leadsto -1 \cdot \color{blue}{\left(z \cdot \frac{t}{a}\right)} \]
      3. neg-mul-178.5%

        \[\leadsto \color{blue}{-z \cdot \frac{t}{a}} \]
      4. distribute-rgt-neg-in78.5%

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

        \[\leadsto z \cdot \color{blue}{\frac{-t}{a}} \]
    5. Simplified78.5%

      \[\leadsto \color{blue}{z \cdot \frac{-t}{a}} \]

    if 1e-30 < (*.f64 x y)

    1. Initial program 86.2%

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt34.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. associate-/l*36.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    8. Step-by-step derivation
      1. *-commutative67.7%

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
    10. Step-by-step derivation
      1. clear-num69.0%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    11. Applied egg-rr69.1%

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

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

Alternative 6: 73.6% accurate, 0.4× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -0.0001:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 10^{-30}:\\ \;\;\;\;t \cdot \frac{z}{-a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a\_m}{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 (<= (* x y) -0.0001)
    (/ x (/ a_m y))
    (if (<= (* x y) 1e-30) (* t (/ z (- 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 tmp;
	if ((x * y) <= -0.0001) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e-30) {
		tmp = t * (z / -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) :: tmp
    if ((x * y) <= (-0.0001d0)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 1d-30) then
        tmp = t * (z / -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 tmp;
	if ((x * y) <= -0.0001) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e-30) {
		tmp = t * (z / -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):
	tmp = 0
	if (x * y) <= -0.0001:
		tmp = x / (a_m / y)
	elif (x * y) <= 1e-30:
		tmp = t * (z / -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)
	tmp = 0.0
	if (Float64(x * y) <= -0.0001)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 1e-30)
		tmp = Float64(t * Float64(z / Float64(-a_m)));
	else
		tmp = Float64(y / Float64(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 ((x * y) <= -0.0001)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 1e-30)
		tmp = t * (z / -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_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -0.0001], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-30], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -0.0001:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

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

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


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

    1. Initial program 88.3%

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

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

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

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

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

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

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

    if -1.00000000000000005e-4 < (*.f64 x y) < 1e-30

    1. Initial program 97.2%

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

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

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

        \[\leadsto -\color{blue}{t \cdot \frac{z}{a}} \]
      3. distribute-rgt-neg-in78.3%

        \[\leadsto \color{blue}{t \cdot \left(-\frac{z}{a}\right)} \]
      4. distribute-neg-frac278.3%

        \[\leadsto t \cdot \color{blue}{\frac{z}{-a}} \]
    5. Simplified78.3%

      \[\leadsto \color{blue}{t \cdot \frac{z}{-a}} \]

    if 1e-30 < (*.f64 x y)

    1. Initial program 86.2%

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt34.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. associate-/l*36.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    8. Step-by-step derivation
      1. *-commutative67.7%

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
    10. Step-by-step derivation
      1. clear-num69.0%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    11. Applied egg-rr69.1%

      \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 92.7% accurate, 0.6× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+180}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \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 (<= (* x y) -5e+180) (* y (/ x a_m)) (/ (- (* 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) <= -5e+180) {
		tmp = y * (x / a_m);
	} 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) <= (-5d+180)) then
        tmp = y * (x / a_m)
    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) <= -5e+180) {
		tmp = y * (x / a_m);
	} 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) <= -5e+180:
		tmp = y * (x / a_m)
	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) <= -5e+180)
		tmp = Float64(y * Float64(x / a_m));
	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) <= -5e+180)
		tmp = y * (x / a_m);
	else
		tmp = ((x * y) - (z * t)) / a_m;
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -5e+180], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+180}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\

\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) < -4.9999999999999996e180

    1. Initial program 73.8%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity66.9%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt28.7%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. associate-/l*38.5%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

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

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

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

    if -4.9999999999999996e180 < (*.f64 x y)

    1. Initial program 93.9%

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

Alternative 8: 52.9% accurate, 0.9× speedup?

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

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


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

    1. Initial program 95.0%

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

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

    if 5.50000000000000022e-62 < a

    1. Initial program 83.3%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity83.3%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt83.1%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. associate-/l*91.5%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    8. Step-by-step derivation
      1. *-commutative47.3%

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 52.0% accurate, 0.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.4999999999999998e164

    1. Initial program 89.6%

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

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

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

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

    if -3.4999999999999998e164 < x

    1. Initial program 91.9%

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

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

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt42.5%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. associate-/l*42.8%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    8. Step-by-step derivation
      1. *-commutative45.7%

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 52.0% accurate, 1.8× speedup?

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
    2. *-un-lft-identity88.9%

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
    3. add-sqr-sqrt42.2%

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
  5. Step-by-step derivation
    1. associate-/l*42.9%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
  10. Step-by-step derivation
    1. clear-num51.2%

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

      \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
  11. Applied egg-rr51.3%

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

Alternative 11: 52.0% accurate, 1.8× speedup?

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

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

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

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

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

Developer Target 1: 91.6% accurate, 0.4× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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