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

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

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


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

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

    if 7.00000000000000003e38 < a

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

Alternative 2: 95.2% 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 10^{+44}:\\ \;\;\;\;\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 1e+44)
    (/ (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 <= 1e+44) {
		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 <= 1e+44)
		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, 1e+44], 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 10^{+44}:\\
\;\;\;\;\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 < 1.0000000000000001e44

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

    if 1.0000000000000001e44 < a

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

    if -3.99999999999999978e72 < (*.f64 x y) < 5.0000000000000002e-57 or 9.99999999999999967e78 < (*.f64 x y) < 2.0000000000000001e148

    1. Initial program 94.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \frac{z}{-a}} \]
    6. Step-by-step derivation
      1. distribute-frac-neg280.8%

        \[\leadsto t \cdot \color{blue}{\left(-\frac{z}{a}\right)} \]
      2. distribute-rgt-neg-out80.8%

        \[\leadsto \color{blue}{-t \cdot \frac{z}{a}} \]
      3. add-sqr-sqrt38.6%

        \[\leadsto -t \cdot \frac{z}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
      4. sqrt-unprod36.3%

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

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

        \[\leadsto -t \cdot \frac{z}{\color{blue}{\sqrt{-a} \cdot \sqrt{-a}}} \]
      7. add-sqr-sqrt9.1%

        \[\leadsto -t \cdot \frac{z}{\color{blue}{-a}} \]
      8. clear-num9.1%

        \[\leadsto -t \cdot \color{blue}{\frac{1}{\frac{-a}{z}}} \]
      9. un-div-inv9.1%

        \[\leadsto -\color{blue}{\frac{t}{\frac{-a}{z}}} \]
      10. add-sqr-sqrt5.6%

        \[\leadsto -\frac{t}{\frac{\color{blue}{\sqrt{-a} \cdot \sqrt{-a}}}{z}} \]
      11. sqrt-unprod36.4%

        \[\leadsto -\frac{t}{\frac{\color{blue}{\sqrt{\left(-a\right) \cdot \left(-a\right)}}}{z}} \]
      12. sqr-neg36.4%

        \[\leadsto -\frac{t}{\frac{\sqrt{\color{blue}{a \cdot a}}}{z}} \]
      13. sqrt-unprod38.7%

        \[\leadsto -\frac{t}{\frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{z}} \]
      14. add-sqr-sqrt80.7%

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

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

    if 5.0000000000000002e-57 < (*.f64 x y) < 9.99999999999999967e78

    1. Initial program 99.8%

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

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

    if 2.0000000000000001e148 < (*.f64 x y)

    1. Initial program 75.4%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      3. add-sqr-sqrt37.6%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
      4. frac-times48.7%

        \[\leadsto \color{blue}{\frac{y}{\sqrt{a}} \cdot \frac{x}{\sqrt{a}}} \]
      5. clear-num48.6%

        \[\leadsto \frac{y}{\sqrt{a}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{a}}{x}}} \]
      6. un-div-inv48.7%

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

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

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

        \[\leadsto \frac{y}{\color{blue}{\frac{\sqrt{a} \cdot \sqrt{a}}{x}}} \]
      3. rem-square-sqrt89.4%

        \[\leadsto \frac{y}{\frac{\color{blue}{a}}{x}} \]
    9. Simplified89.4%

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

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

Alternative 4: 72.0% 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])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+72}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\ \;\;\;\;\frac{t}{\frac{a\_m}{-z}}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+44}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+148}:\\ \;\;\;\;\frac{t}{a\_m} \cdot \left(-z\right)\\ \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) -4e+72)
    (* y (/ x a_m))
    (if (<= (* x y) 5e-57)
      (/ t (/ a_m (- z)))
      (if (<= (* x y) 2e+44)
        (/ (* x y) a_m)
        (if (<= (* x y) 2e+148) (* (/ t a_m) (- z)) (/ 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) <= -4e+72) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e-57) {
		tmp = t / (a_m / -z);
	} else if ((x * y) <= 2e+44) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e+148) {
		tmp = (t / a_m) * -z;
	} 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) <= (-4d+72)) then
        tmp = y * (x / a_m)
    else if ((x * y) <= 5d-57) then
        tmp = t / (a_m / -z)
    else if ((x * y) <= 2d+44) then
        tmp = (x * y) / a_m
    else if ((x * y) <= 2d+148) then
        tmp = (t / a_m) * -z
    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) <= -4e+72) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e-57) {
		tmp = t / (a_m / -z);
	} else if ((x * y) <= 2e+44) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e+148) {
		tmp = (t / a_m) * -z;
	} 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) <= -4e+72:
		tmp = y * (x / a_m)
	elif (x * y) <= 5e-57:
		tmp = t / (a_m / -z)
	elif (x * y) <= 2e+44:
		tmp = (x * y) / a_m
	elif (x * y) <= 2e+148:
		tmp = (t / a_m) * -z
	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) <= -4e+72)
		tmp = Float64(y * Float64(x / a_m));
	elseif (Float64(x * y) <= 5e-57)
		tmp = Float64(t / Float64(a_m / Float64(-z)));
	elseif (Float64(x * y) <= 2e+44)
		tmp = Float64(Float64(x * y) / a_m);
	elseif (Float64(x * y) <= 2e+148)
		tmp = Float64(Float64(t / a_m) * Float64(-z));
	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) <= -4e+72)
		tmp = y * (x / a_m);
	elseif ((x * y) <= 5e-57)
		tmp = t / (a_m / -z);
	elseif ((x * y) <= 2e+44)
		tmp = (x * y) / a_m;
	elseif ((x * y) <= 2e+148)
		tmp = (t / a_m) * -z;
	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], -4e+72], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], N[(t / N[(a$95$m / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+44], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+148], N[(N[(t / a$95$m), $MachinePrecision] * (-z)), $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 -4 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\

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

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

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

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

    if -3.99999999999999978e72 < (*.f64 x y) < 5.0000000000000002e-57

    1. Initial program 94.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \frac{z}{-a}} \]
    6. Step-by-step derivation
      1. distribute-frac-neg280.7%

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

        \[\leadsto \color{blue}{-t \cdot \frac{z}{a}} \]
      3. add-sqr-sqrt38.1%

        \[\leadsto -t \cdot \frac{z}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
      4. sqrt-unprod36.4%

        \[\leadsto -t \cdot \frac{z}{\color{blue}{\sqrt{a \cdot a}}} \]
      5. sqr-neg36.4%

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

        \[\leadsto -t \cdot \frac{z}{\color{blue}{\sqrt{-a} \cdot \sqrt{-a}}} \]
      7. add-sqr-sqrt9.4%

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

        \[\leadsto -t \cdot \color{blue}{\frac{1}{\frac{-a}{z}}} \]
      9. un-div-inv9.5%

        \[\leadsto -\color{blue}{\frac{t}{\frac{-a}{z}}} \]
      10. add-sqr-sqrt5.8%

        \[\leadsto -\frac{t}{\frac{\color{blue}{\sqrt{-a} \cdot \sqrt{-a}}}{z}} \]
      11. sqrt-unprod36.4%

        \[\leadsto -\frac{t}{\frac{\color{blue}{\sqrt{\left(-a\right) \cdot \left(-a\right)}}}{z}} \]
      12. sqr-neg36.4%

        \[\leadsto -\frac{t}{\frac{\sqrt{\color{blue}{a \cdot a}}}{z}} \]
      13. sqrt-unprod38.2%

        \[\leadsto -\frac{t}{\frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{z}} \]
      14. add-sqr-sqrt80.6%

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

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

    if 5.0000000000000002e-57 < (*.f64 x y) < 2.0000000000000002e44

    1. Initial program 99.8%

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

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

    if 2.0000000000000002e44 < (*.f64 x y) < 2.0000000000000001e148

    1. Initial program 90.4%

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

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

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

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

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

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

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

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

    if 2.0000000000000001e148 < (*.f64 x y)

    1. Initial program 75.4%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      3. add-sqr-sqrt37.6%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
      4. frac-times48.7%

        \[\leadsto \color{blue}{\frac{y}{\sqrt{a}} \cdot \frac{x}{\sqrt{a}}} \]
      5. clear-num48.6%

        \[\leadsto \frac{y}{\sqrt{a}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{a}}{x}}} \]
      6. un-div-inv48.7%

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

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

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

        \[\leadsto \frac{y}{\color{blue}{\frac{\sqrt{a} \cdot \sqrt{a}}{x}}} \]
      3. rem-square-sqrt89.4%

        \[\leadsto \frac{y}{\frac{\color{blue}{a}}{x}} \]
    9. Simplified89.4%

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

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

Alternative 5: 73.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])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+72}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+44}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+148}:\\ \;\;\;\;\frac{t}{a\_m} \cdot \left(-z\right)\\ \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) -4e+72)
    (* y (/ x a_m))
    (if (<= (* x y) 5e-57)
      (/ (* z (- t)) a_m)
      (if (<= (* x y) 2e+44)
        (/ (* x y) a_m)
        (if (<= (* x y) 2e+148) (* (/ t a_m) (- z)) (/ 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) <= -4e+72) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e-57) {
		tmp = (z * -t) / a_m;
	} else if ((x * y) <= 2e+44) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e+148) {
		tmp = (t / a_m) * -z;
	} 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) <= (-4d+72)) then
        tmp = y * (x / a_m)
    else if ((x * y) <= 5d-57) then
        tmp = (z * -t) / a_m
    else if ((x * y) <= 2d+44) then
        tmp = (x * y) / a_m
    else if ((x * y) <= 2d+148) then
        tmp = (t / a_m) * -z
    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) <= -4e+72) {
		tmp = y * (x / a_m);
	} else if ((x * y) <= 5e-57) {
		tmp = (z * -t) / a_m;
	} else if ((x * y) <= 2e+44) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e+148) {
		tmp = (t / a_m) * -z;
	} 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) <= -4e+72:
		tmp = y * (x / a_m)
	elif (x * y) <= 5e-57:
		tmp = (z * -t) / a_m
	elif (x * y) <= 2e+44:
		tmp = (x * y) / a_m
	elif (x * y) <= 2e+148:
		tmp = (t / a_m) * -z
	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) <= -4e+72)
		tmp = Float64(y * Float64(x / a_m));
	elseif (Float64(x * y) <= 5e-57)
		tmp = Float64(Float64(z * Float64(-t)) / a_m);
	elseif (Float64(x * y) <= 2e+44)
		tmp = Float64(Float64(x * y) / a_m);
	elseif (Float64(x * y) <= 2e+148)
		tmp = Float64(Float64(t / a_m) * Float64(-z));
	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) <= -4e+72)
		tmp = y * (x / a_m);
	elseif ((x * y) <= 5e-57)
		tmp = (z * -t) / a_m;
	elseif ((x * y) <= 2e+44)
		tmp = (x * y) / a_m;
	elseif ((x * y) <= 2e+148)
		tmp = (t / a_m) * -z;
	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], -4e+72], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], N[(N[(z * (-t)), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+44], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+148], N[(N[(t / a$95$m), $MachinePrecision] * (-z)), $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 -4 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\

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

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

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

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

    if -3.99999999999999978e72 < (*.f64 x y) < 5.0000000000000002e-57

    1. Initial program 94.8%

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

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

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

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

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

    if 5.0000000000000002e-57 < (*.f64 x y) < 2.0000000000000002e44

    1. Initial program 99.8%

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

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

    if 2.0000000000000002e44 < (*.f64 x y) < 2.0000000000000001e148

    1. Initial program 90.4%

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

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

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

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

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

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

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

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

    if 2.0000000000000001e148 < (*.f64 x y)

    1. Initial program 75.4%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      3. add-sqr-sqrt37.6%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
      4. frac-times48.7%

        \[\leadsto \color{blue}{\frac{y}{\sqrt{a}} \cdot \frac{x}{\sqrt{a}}} \]
      5. clear-num48.6%

        \[\leadsto \frac{y}{\sqrt{a}} \cdot \color{blue}{\frac{1}{\frac{\sqrt{a}}{x}}} \]
      6. un-div-inv48.7%

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

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

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

        \[\leadsto \frac{y}{\color{blue}{\frac{\sqrt{a} \cdot \sqrt{a}}{x}}} \]
      3. rem-square-sqrt89.4%

        \[\leadsto \frac{y}{\frac{\color{blue}{a}}{x}} \]
    9. Simplified89.4%

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

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

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

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


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

    1. Initial program 95.0%

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

    if 2.00000000000000007e286 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(\frac{x}{a} - \color{blue}{\frac{z \cdot \frac{t}{y}}{a}}\right) \]
      7. /-rgt-identity97.1%

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

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

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

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

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

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

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

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

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


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

    1. Initial program 94.1%

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

    if 2.00000000000000001e277 < (*.f64 x y)

    1. Initial program 50.9%

      \[\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/99.8%

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

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

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

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

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

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

Alternative 8: 94.9% accurate, 0.6× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 2 \cdot 10^{+37}:\\ \;\;\;\;\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 2e+37)
    (/ (- (* 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 <= 2e+37) {
		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 <= 2d+37) 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 <= 2e+37) {
		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 <= 2e+37:
		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 <= 2e+37)
		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 <= 2e+37)
		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, 2e+37], 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 2 \cdot 10^{+37}:\\
\;\;\;\;\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 < 1.99999999999999991e37

    1. Initial program 93.4%

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

    if 1.99999999999999991e37 < a

    1. Initial program 79.0%

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

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

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

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

      \[\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 2 \cdot 10^{+37}:\\ \;\;\;\;\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: 51.8% 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 -5000:\\ \;\;\;\;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 -5000.0) (* 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 <= -5000.0) {
		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 <= (-5000.0d0)) 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 <= -5000.0) {
		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 <= -5000.0:
		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 <= -5000.0)
		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 <= -5000.0)
		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, -5000.0], 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 -5000:\\
\;\;\;\;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 < -5e3

    1. Initial program 88.3%

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

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

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

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

    if -5e3 < z

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -205000

    1. Initial program 88.3%

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

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

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

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

    if -205000 < z

    1. Initial program 91.3%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      3. add-sqr-sqrt24.6%

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

        \[\leadsto \color{blue}{\frac{y}{\sqrt{a}} \cdot \frac{x}{\sqrt{a}}} \]
      5. clear-num26.5%

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

        \[\leadsto \color{blue}{\frac{\frac{y}{\sqrt{a}}}{\frac{\sqrt{a}}{x}}} \]
    7. Applied egg-rr26.5%

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

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

        \[\leadsto \frac{y}{\color{blue}{\frac{\sqrt{a} \cdot \sqrt{a}}{x}}} \]
      3. rem-square-sqrt51.0%

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

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

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

Alternative 11: 52.5% 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.6%

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

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

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

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

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

Developer target: 91.8% 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 2024071 
(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))