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

Percentage Accurate: 91.4% → 95.1%
Time: 9.3s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 91.4% 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.1% accurate, 0.1× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 3 \cdot 10^{+15}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a\_m} - z \cdot \frac{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 (<= a_m 3e+15)
    (/ (fma x y (* z (- t))) a_m)
    (- (* x (/ y a_m)) (* 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 (a_m <= 3e+15) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = (x * (y / a_m)) - (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 (a_m <= 3e+15)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(z * Float64(t / 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, 3e+15], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / 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 \cdot 10^{+15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\

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


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

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

    if 3e15 < a

    1. Initial program 76.7%

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

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

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

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

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

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

Alternative 2: 71.3% accurate, 0.2× 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 := z \cdot \frac{t}{-a\_m}\\ t_2 := \frac{y}{\frac{a\_m}{x}}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-90}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 10^{-6}:\\ \;\;\;\;t \cdot \frac{z}{-a\_m}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \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 (* z (/ t (- a_m)))) (t_2 (/ y (/ a_m x))))
   (*
    a_s
    (if (<= (* x y) -1e+37)
      t_2
      (if (<= (* x y) 5e-135)
        t_1
        (if (<= (* x y) 5e-90)
          (* y (/ x a_m))
          (if (<= (* x y) 1e-6)
            (* t (/ z (- a_m)))
            (if (<= (* x y) 2e+26)
              (/ x (/ a_m y))
              (if (<= (* x y) 5e+112) t_1 t_2)))))))))
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 = z * (t / -a_m);
	double t_2 = y / (a_m / x);
	double tmp;
	if ((x * y) <= -1e+37) {
		tmp = t_2;
	} else if ((x * y) <= 5e-135) {
		tmp = t_1;
	} else if ((x * y) <= 5e-90) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 1e-6) {
		tmp = t * (z / -a_m);
	} else if ((x * y) <= 2e+26) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 5e+112) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = z * (t / -a_m)
    t_2 = y / (a_m / x)
    if ((x * y) <= (-1d+37)) then
        tmp = t_2
    else if ((x * y) <= 5d-135) then
        tmp = t_1
    else if ((x * y) <= 5d-90) then
        tmp = y * (x / a_m)
    else if ((x * y) <= 1d-6) then
        tmp = t * (z / -a_m)
    else if ((x * y) <= 2d+26) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 5d+112) then
        tmp = t_1
    else
        tmp = t_2
    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 = z * (t / -a_m);
	double t_2 = y / (a_m / x);
	double tmp;
	if ((x * y) <= -1e+37) {
		tmp = t_2;
	} else if ((x * y) <= 5e-135) {
		tmp = t_1;
	} else if ((x * y) <= 5e-90) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 1e-6) {
		tmp = t * (z / -a_m);
	} else if ((x * y) <= 2e+26) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 5e+112) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = z * (t / -a_m)
	t_2 = y / (a_m / x)
	tmp = 0
	if (x * y) <= -1e+37:
		tmp = t_2
	elif (x * y) <= 5e-135:
		tmp = t_1
	elif (x * y) <= 5e-90:
		tmp = y * (x / a_m)
	elif (x * y) <= 1e-6:
		tmp = t * (z / -a_m)
	elif (x * y) <= 2e+26:
		tmp = x / (a_m / y)
	elif (x * y) <= 5e+112:
		tmp = t_1
	else:
		tmp = t_2
	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(z * Float64(t / Float64(-a_m)))
	t_2 = Float64(y / Float64(a_m / x))
	tmp = 0.0
	if (Float64(x * y) <= -1e+37)
		tmp = t_2;
	elseif (Float64(x * y) <= 5e-135)
		tmp = t_1;
	elseif (Float64(x * y) <= 5e-90)
		tmp = Float64(y * Float64(x / a_m));
	elseif (Float64(x * y) <= 1e-6)
		tmp = Float64(t * Float64(z / Float64(-a_m)));
	elseif (Float64(x * y) <= 2e+26)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 5e+112)
		tmp = t_1;
	else
		tmp = t_2;
	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 = z * (t / -a_m);
	t_2 = y / (a_m / x);
	tmp = 0.0;
	if ((x * y) <= -1e+37)
		tmp = t_2;
	elseif ((x * y) <= 5e-135)
		tmp = t_1;
	elseif ((x * y) <= 5e-90)
		tmp = y * (x / a_m);
	elseif ((x * y) <= 1e-6)
		tmp = t * (z / -a_m);
	elseif ((x * y) <= 2e+26)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 5e+112)
		tmp = t_1;
	else
		tmp = t_2;
	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[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+37], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5e-135], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-90], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-6], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+26], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+112], t$95$1, t$95$2]]]]]]), $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 := z \cdot \frac{t}{-a\_m}\\
t_2 := \frac{y}{\frac{a\_m}{x}}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\

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

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

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y)

    1. Initial program 82.1%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{a} - z \cdot \frac{t}{a}} \]
    5. Taylor expanded in x around 0 74.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    8. Simplified81.3%

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

    if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135 or 2.0000000000000001e26 < (*.f64 x y) < 5e112

    1. Initial program 94.6%

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

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

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

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

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

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

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

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

    if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90

    1. Initial program 99.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/79.4%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    9. Applied egg-rr79.4%

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

    if 5.00000000000000019e-90 < (*.f64 x y) < 9.99999999999999955e-7

    1. Initial program 93.0%

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

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

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

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

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

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

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

    if 9.99999999999999955e-7 < (*.f64 x y) < 2.0000000000000001e26

    1. Initial program 99.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\ \;\;\;\;z \cdot \frac{t}{-a}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-90}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \cdot y \leq 10^{-6}:\\ \;\;\;\;t \cdot \frac{z}{-a}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\ \;\;\;\;z \cdot \frac{t}{-a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 71.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 := t \cdot \frac{z}{-a\_m}\\ t_2 := \frac{y}{\frac{a\_m}{x}}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-90}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \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 (* t (/ z (- a_m)))) (t_2 (/ y (/ a_m x))))
   (*
    a_s
    (if (<= (* x y) -1e+37)
      t_2
      (if (<= (* x y) 5e-135)
        t_1
        (if (<= (* x y) 5e-90)
          (* y (/ x a_m))
          (if (<= (* x y) 5e+112) t_1 t_2)))))))
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 = t * (z / -a_m);
	double t_2 = y / (a_m / x);
	double tmp;
	if ((x * y) <= -1e+37) {
		tmp = t_2;
	} else if ((x * y) <= 5e-135) {
		tmp = t_1;
	} else if ((x * y) <= 5e-90) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e+112) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = t * (z / -a_m)
    t_2 = y / (a_m / x)
    if ((x * y) <= (-1d+37)) then
        tmp = t_2
    else if ((x * y) <= 5d-135) then
        tmp = t_1
    else if ((x * y) <= 5d-90) then
        tmp = y * (x / a_m)
    else if ((x * y) <= 5d+112) then
        tmp = t_1
    else
        tmp = t_2
    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 = t * (z / -a_m);
	double t_2 = y / (a_m / x);
	double tmp;
	if ((x * y) <= -1e+37) {
		tmp = t_2;
	} else if ((x * y) <= 5e-135) {
		tmp = t_1;
	} else if ((x * y) <= 5e-90) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e+112) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = t * (z / -a_m)
	t_2 = y / (a_m / x)
	tmp = 0
	if (x * y) <= -1e+37:
		tmp = t_2
	elif (x * y) <= 5e-135:
		tmp = t_1
	elif (x * y) <= 5e-90:
		tmp = y * (x / a_m)
	elif (x * y) <= 5e+112:
		tmp = t_1
	else:
		tmp = t_2
	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(t * Float64(z / Float64(-a_m)))
	t_2 = Float64(y / Float64(a_m / x))
	tmp = 0.0
	if (Float64(x * y) <= -1e+37)
		tmp = t_2;
	elseif (Float64(x * y) <= 5e-135)
		tmp = t_1;
	elseif (Float64(x * y) <= 5e-90)
		tmp = Float64(y * Float64(x / a_m));
	elseif (Float64(x * y) <= 5e+112)
		tmp = t_1;
	else
		tmp = t_2;
	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 = t * (z / -a_m);
	t_2 = y / (a_m / x);
	tmp = 0.0;
	if ((x * y) <= -1e+37)
		tmp = t_2;
	elseif ((x * y) <= 5e-135)
		tmp = t_1;
	elseif ((x * y) <= 5e-90)
		tmp = y * (x / a_m);
	elseif ((x * y) <= 5e+112)
		tmp = t_1;
	else
		tmp = t_2;
	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[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+37], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5e-135], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-90], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+112], t$95$1, t$95$2]]]]), $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 := t \cdot \frac{z}{-a\_m}\\
t_2 := \frac{y}{\frac{a\_m}{x}}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y)

    1. Initial program 82.1%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{a} - z \cdot \frac{t}{a}} \]
    5. Taylor expanded in x around 0 74.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    8. Simplified81.3%

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

    if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135 or 5.00000000000000019e-90 < (*.f64 x y) < 5e112

    1. Initial program 94.7%

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

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

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

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

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

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

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

    if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90

    1. Initial program 99.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/79.4%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    9. Applied egg-rr79.4%

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

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

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

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

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

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y)

    1. Initial program 82.1%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{a} - z \cdot \frac{t}{a}} \]
    5. Taylor expanded in x around 0 74.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    8. Simplified81.3%

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

    if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

    if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90

    1. Initial program 99.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/79.4%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    9. Applied egg-rr79.4%

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

    if 5.00000000000000019e-90 < (*.f64 x y) < 5e112

    1. Initial program 96.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \frac{z}{-a}} \]
    6. Step-by-step derivation
      1. *-commutative64.5%

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

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

        \[\leadsto \color{blue}{-\frac{z}{a} \cdot t} \]
      4. associate-/r/62.2%

        \[\leadsto -\color{blue}{\frac{z}{\frac{a}{t}}} \]
      5. distribute-neg-frac62.2%

        \[\leadsto \color{blue}{\frac{-z}{\frac{a}{t}}} \]
    7. Applied egg-rr62.2%

      \[\leadsto \color{blue}{\frac{-z}{\frac{a}{t}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.0%

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

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

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

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

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -9.99999999999999954e36 or 5e112 < (*.f64 x y)

    1. Initial program 82.1%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{a} - z \cdot \frac{t}{a}} \]
    5. Taylor expanded in x around 0 74.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    8. Simplified81.3%

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

    if -9.99999999999999954e36 < (*.f64 x y) < 5.0000000000000002e-135

    1. Initial program 94.0%

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(t \cdot z\right)}}{a} \]
    4. Step-by-step derivation
      1. associate-*r*79.3%

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

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

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

    if 5.0000000000000002e-135 < (*.f64 x y) < 5.00000000000000019e-90

    1. Initial program 99.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/79.4%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    9. Applied egg-rr79.4%

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

    if 5.00000000000000019e-90 < (*.f64 x y) < 5e112

    1. Initial program 96.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \frac{z}{-a}} \]
    6. Step-by-step derivation
      1. *-commutative64.5%

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

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

        \[\leadsto \color{blue}{-\frac{z}{a} \cdot t} \]
      4. associate-/r/62.2%

        \[\leadsto -\color{blue}{\frac{z}{\frac{a}{t}}} \]
      5. distribute-neg-frac62.2%

        \[\leadsto \color{blue}{\frac{-z}{\frac{a}{t}}} \]
    7. Applied egg-rr62.2%

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

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

Alternative 6: 94.8% 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 -5 \cdot 10^{+303}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+258}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{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+303)
    (* y (/ x a_m))
    (if (<= (* x y) 5e+258) (/ (- (* x y) (* z t)) a_m) (* 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) {
	double tmp;
	if ((x * y) <= -5e+303) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e+258) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = x * (y / 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+303)) then
        tmp = y * (x / a_m)
    else if ((x * y) <= 5d+258) then
        tmp = ((x * y) - (z * t)) / a_m
    else
        tmp = x * (y / 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+303) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e+258) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = x * (y / 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+303:
		tmp = y * (x / a_m)
	elif (x * y) <= 5e+258:
		tmp = ((x * y) - (z * t)) / a_m
	else:
		tmp = x * (y / 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+303)
		tmp = Float64(y * Float64(x / a_m));
	elseif (Float64(x * y) <= 5e+258)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = Float64(x * Float64(y / 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+303)
		tmp = y * (x / a_m);
	elseif ((x * y) <= 5e+258)
		tmp = ((x * y) - (z * t)) / a_m;
	else
		tmp = x * (y / 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+303], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+258], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+303}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\

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

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


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

    1. Initial program 62.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/96.1%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    9. Applied egg-rr96.1%

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

    if -4.9999999999999997e303 < (*.f64 x y) < 5e258

    1. Initial program 95.0%

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

    if 5e258 < (*.f64 x y)

    1. Initial program 61.7%

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

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

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

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

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

Alternative 7: 93.5% 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])\\ \\ \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^{+269}:\\ \;\;\;\;\frac{t\_1}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{\frac{x \cdot y}{z} - t}{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 (<= t_1 5e+269) (/ t_1 a_m) (* z (/ (- (/ (* 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 t_1 = (x * y) - (z * t);
	double tmp;
	if (t_1 <= 5e+269) {
		tmp = t_1 / a_m;
	} else {
		tmp = z * ((((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) :: t_1
    real(8) :: tmp
    t_1 = (x * y) - (z * t)
    if (t_1 <= 5d+269) then
        tmp = t_1 / a_m
    else
        tmp = z * ((((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 t_1 = (x * y) - (z * t);
	double tmp;
	if (t_1 <= 5e+269) {
		tmp = t_1 / a_m;
	} else {
		tmp = z * ((((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):
	t_1 = (x * y) - (z * t)
	tmp = 0
	if t_1 <= 5e+269:
		tmp = t_1 / a_m
	else:
		tmp = z * ((((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)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_1 <= 5e+269)
		tmp = Float64(t_1 / a_m);
	else
		tmp = Float64(z * Float64(Float64(Float64(Float64(x * y) / 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)
	t_1 = (x * y) - (z * t);
	tmp = 0.0;
	if (t_1 <= 5e+269)
		tmp = t_1 / a_m;
	else
		tmp = z * ((((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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 5e+269], N[(t$95$1 / a$95$m), $MachinePrecision], N[(z * N[(N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $MachinePrecision] / 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])\\
\\
\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^{+269}:\\
\;\;\;\;\frac{t\_1}{a\_m}\\

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


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

    1. Initial program 95.8%

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

    if 5.0000000000000002e269 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 58.3%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{a} - z \cdot \frac{t}{a}} \]
    5. Step-by-step derivation
      1. clear-num87.0%

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

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

      \[\leadsto x \cdot \frac{y}{a} - \color{blue}{\frac{z}{\frac{a}{t}}} \]
    7. Taylor expanded in z around inf 72.6%

      \[\leadsto \color{blue}{z \cdot \left(\frac{x \cdot y}{a \cdot z} - \frac{t}{a}\right)} \]
    8. Step-by-step derivation
      1. times-frac77.5%

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

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

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

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

Alternative 8: 94.7% accurate, 0.6× speedup?

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

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


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

    1. Initial program 94.3%

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

    if 9e14 < a

    1. Initial program 76.7%

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

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

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

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

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

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

Alternative 9: 50.7% 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}\;z \leq -4.6 \cdot 10^{-122}:\\ \;\;\;\;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 (<= z -4.6e-122) (* 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 (z <= -4.6e-122) {
		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 (z <= (-4.6d-122)) 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 (z <= -4.6e-122) {
		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 z <= -4.6e-122:
		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 (z <= -4.6e-122)
		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 (z <= -4.6e-122)
		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[z, -4.6e-122], 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}\;z \leq -4.6 \cdot 10^{-122}:\\
\;\;\;\;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 z < -4.60000000000000014e-122

    1. Initial program 88.9%

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

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

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

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

    if -4.60000000000000014e-122 < z

    1. Initial program 90.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/56.2%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    9. Applied egg-rr56.2%

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

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

Alternative 10: 50.6% accurate, 1.8× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right) \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #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 90.1%

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

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

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

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

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

Developer target: 91.9% 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 2024073 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

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

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