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

Percentage Accurate: 91.6% → 96.9%
Time: 7.9s
Alternatives: 11
Speedup: 0.5×

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.6% 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.9% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+228}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+293}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (if (<= t_1 -1e+228)
     (- (/ x (/ a y)) (/ z (/ a t)))
     (if (<= t_1 2e+293)
       (/ (fma x y (* z (- t))) a)
       (- (* y (/ x a)) (* t (/ z a)))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if (t_1 <= -1e+228) {
		tmp = (x / (a / y)) - (z / (a / t));
	} else if (t_1 <= 2e+293) {
		tmp = fma(x, y, (z * -t)) / a;
	} else {
		tmp = (y * (x / a)) - (t * (z / a));
	}
	return tmp;
}
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_1 <= -1e+228)
		tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t)));
	elseif (t_1 <= 2e+293)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a);
	else
		tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a)));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+228], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+293], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+228}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\

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


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

    1. Initial program 78.1%

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

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

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

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

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

    if -9.9999999999999992e227 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999998e293

    1. Initial program 99.2%

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

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

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

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

    if 1.9999999999999998e293 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 69.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Step-by-step derivation
      1. +-commutative64.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} + -1 \cdot \frac{t \cdot z}{a}} \]
      2. mul-1-neg64.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -1 \cdot 10^{+228}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \leq 2 \cdot 10^{+293}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \end{array} \]

Alternative 2: 97.3% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+305} \lor \neg \left(t_1 \leq 2 \cdot 10^{+293}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (if (or (<= t_1 -5e+305) (not (<= t_1 2e+293)))
     (- (* x (/ y a)) (* t (/ z a)))
     (/ t_1 a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -5e+305) || !(t_1 <= 2e+293)) {
		tmp = (x * (y / a)) - (t * (z / a));
	} else {
		tmp = t_1 / a;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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 = (x * y) - (z * t)
    if ((t_1 <= (-5d+305)) .or. (.not. (t_1 <= 2d+293))) then
        tmp = (x * (y / a)) - (t * (z / a))
    else
        tmp = t_1 / a
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -5e+305) || !(t_1 <= 2e+293)) {
		tmp = (x * (y / a)) - (t * (z / a));
	} else {
		tmp = t_1 / a;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = (x * y) - (z * t)
	tmp = 0
	if (t_1 <= -5e+305) or not (t_1 <= 2e+293):
		tmp = (x * (y / a)) - (t * (z / a))
	else:
		tmp = t_1 / a
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= -5e+305) || !(t_1 <= 2e+293))
		tmp = Float64(Float64(x * Float64(y / a)) - Float64(t * Float64(z / a)));
	else
		tmp = Float64(t_1 / a);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x * y) - (z * t);
	tmp = 0.0;
	if ((t_1 <= -5e+305) || ~((t_1 <= 2e+293)))
		tmp = (x * (y / a)) - (t * (z / a));
	else
		tmp = t_1 / a;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+305], N[Not[LessEqual[t$95$1, 2e+293]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+305} \lor \neg \left(t_1 \leq 2 \cdot 10^{+293}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z t)) < -5.00000000000000009e305 or 1.9999999999999998e293 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 69.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Step-by-step derivation
      1. associate-*l/74.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} - \frac{z}{\frac{a}{t}} \]
      8. associate-/r/92.6%

        \[\leadsto x \cdot \frac{y}{a} - \color{blue}{\frac{z}{a} \cdot t} \]
      9. *-commutative92.6%

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

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

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

    1. Initial program 99.2%

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

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

Alternative 3: 97.4% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := t \cdot \frac{z}{a}\\ t_2 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_2 \leq -5 \cdot 10^{+305}:\\ \;\;\;\;x \cdot \frac{y}{a} - t_1\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+293}:\\ \;\;\;\;\frac{t_2}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - t_1\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* t (/ z a))) (t_2 (- (* x y) (* z t))))
   (if (<= t_2 -5e+305)
     (- (* x (/ y a)) t_1)
     (if (<= t_2 2e+293) (/ t_2 a) (- (* y (/ x a)) t_1)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = t * (z / a);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -5e+305) {
		tmp = (x * (y / a)) - t_1;
	} else if (t_2 <= 2e+293) {
		tmp = t_2 / a;
	} else {
		tmp = (y * (x / a)) - t_1;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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) :: t_2
    real(8) :: tmp
    t_1 = t * (z / a)
    t_2 = (x * y) - (z * t)
    if (t_2 <= (-5d+305)) then
        tmp = (x * (y / a)) - t_1
    else if (t_2 <= 2d+293) then
        tmp = t_2 / a
    else
        tmp = (y * (x / a)) - t_1
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = t * (z / a);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -5e+305) {
		tmp = (x * (y / a)) - t_1;
	} else if (t_2 <= 2e+293) {
		tmp = t_2 / a;
	} else {
		tmp = (y * (x / a)) - t_1;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = t * (z / a)
	t_2 = (x * y) - (z * t)
	tmp = 0
	if t_2 <= -5e+305:
		tmp = (x * (y / a)) - t_1
	elif t_2 <= 2e+293:
		tmp = t_2 / a
	else:
		tmp = (y * (x / a)) - t_1
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(t * Float64(z / a))
	t_2 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_2 <= -5e+305)
		tmp = Float64(Float64(x * Float64(y / a)) - t_1);
	elseif (t_2 <= 2e+293)
		tmp = Float64(t_2 / a);
	else
		tmp = Float64(Float64(y * Float64(x / a)) - t_1);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = t * (z / a);
	t_2 = (x * y) - (z * t);
	tmp = 0.0;
	if (t_2 <= -5e+305)
		tmp = (x * (y / a)) - t_1;
	elseif (t_2 <= 2e+293)
		tmp = t_2 / a;
	else
		tmp = (y * (x / a)) - t_1;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+305], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+293], N[(t$95$2 / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \frac{z}{a}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \frac{y}{a} - t_1\\

\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\frac{t_2}{a}\\

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


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

    1. Initial program 69.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Step-by-step derivation
      1. associate-*l/75.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} - \frac{z}{\frac{a}{t}} \]
      8. associate-/r/96.6%

        \[\leadsto x \cdot \frac{y}{a} - \color{blue}{\frac{z}{a} \cdot t} \]
      9. *-commutative96.6%

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

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

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

    1. Initial program 99.2%

      \[\frac{x \cdot y - z \cdot t}{a} \]

    if 1.9999999999999998e293 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 69.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Step-by-step derivation
      1. +-commutative64.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} + -1 \cdot \frac{t \cdot z}{a}} \]
      2. mul-1-neg64.7%

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

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

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

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

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

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

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

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

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

Alternative 4: 96.9% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+228}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+293}:\\ \;\;\;\;\frac{t_1}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (if (<= t_1 -1e+228)
     (- (/ x (/ a y)) (/ z (/ a t)))
     (if (<= t_1 2e+293) (/ t_1 a) (- (* y (/ x a)) (* t (/ z a)))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if (t_1 <= -1e+228) {
		tmp = (x / (a / y)) - (z / (a / t));
	} else if (t_1 <= 2e+293) {
		tmp = t_1 / a;
	} else {
		tmp = (y * (x / a)) - (t * (z / a));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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 = (x * y) - (z * t)
    if (t_1 <= (-1d+228)) then
        tmp = (x / (a / y)) - (z / (a / t))
    else if (t_1 <= 2d+293) then
        tmp = t_1 / a
    else
        tmp = (y * (x / a)) - (t * (z / a))
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if (t_1 <= -1e+228) {
		tmp = (x / (a / y)) - (z / (a / t));
	} else if (t_1 <= 2e+293) {
		tmp = t_1 / a;
	} else {
		tmp = (y * (x / a)) - (t * (z / a));
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = (x * y) - (z * t)
	tmp = 0
	if t_1 <= -1e+228:
		tmp = (x / (a / y)) - (z / (a / t))
	elif t_1 <= 2e+293:
		tmp = t_1 / a
	else:
		tmp = (y * (x / a)) - (t * (z / a))
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_1 <= -1e+228)
		tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t)));
	elseif (t_1 <= 2e+293)
		tmp = Float64(t_1 / a);
	else
		tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x * y) - (z * t);
	tmp = 0.0;
	if (t_1 <= -1e+228)
		tmp = (x / (a / y)) - (z / (a / t));
	elseif (t_1 <= 2e+293)
		tmp = t_1 / a;
	else
		tmp = (y * (x / a)) - (t * (z / a));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+228], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+293], N[(t$95$1 / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+228}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\frac{t_1}{a}\\

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


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

    1. Initial program 78.1%

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

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

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

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

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

    if -9.9999999999999992e227 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999998e293

    1. Initial program 99.2%

      \[\frac{x \cdot y - z \cdot t}{a} \]

    if 1.9999999999999998e293 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 69.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Step-by-step derivation
      1. +-commutative64.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} + -1 \cdot \frac{t \cdot z}{a}} \]
      2. mul-1-neg64.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -1 \cdot 10^{+228}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \leq 2 \cdot 10^{+293}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \end{array} \]

Alternative 5: 95.1% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+217}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* x y) (- INFINITY))
   (/ x (/ a y))
   (if (<= (* x y) 5e+217) (/ (- (* x y) (* z t)) a) (* x (/ y a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -((double) INFINITY)) {
		tmp = x / (a / y);
	} else if ((x * y) <= 5e+217) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -Double.POSITIVE_INFINITY) {
		tmp = x / (a / y);
	} else if ((x * y) <= 5e+217) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if (x * y) <= -math.inf:
		tmp = x / (a / y)
	elif (x * y) <= 5e+217:
		tmp = ((x * y) - (z * t)) / a
	else:
		tmp = x * (y / a)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(x * y) <= Float64(-Inf))
		tmp = Float64(x / Float64(a / y));
	elseif (Float64(x * y) <= 5e+217)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
	else
		tmp = Float64(x * Float64(y / a));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((x * y) <= -Inf)
		tmp = x / (a / y);
	elseif ((x * y) <= 5e+217)
		tmp = ((x * y) - (z * t)) / a;
	else
		tmp = x * (y / a);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+217], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\

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

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


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

    1. Initial program 58.5%

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

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

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

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

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

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

    if -inf.0 < (*.f64 x y) < 5.00000000000000041e217

    1. Initial program 96.7%

      \[\frac{x \cdot y - z \cdot t}{a} \]

    if 5.00000000000000041e217 < (*.f64 x y)

    1. Initial program 73.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Taylor expanded in t around 0 73.2%

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

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

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

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

Alternative 6: 67.6% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := \frac{-t}{\frac{a}{z}}\\ \mathbf{if}\;t \leq -1.55 \cdot 10^{-133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 7.1 \cdot 10^{-243}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{-153}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{+50}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (- t) (/ a z))))
   (if (<= t -1.55e-133)
     t_1
     (if (<= t 7.1e-243)
       (/ y (/ a x))
       (if (<= t 3.3e-153)
         (* x (/ y a))
         (if (<= t 1.3e+50) (* y (/ x a)) t_1))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = -t / (a / z);
	double tmp;
	if (t <= -1.55e-133) {
		tmp = t_1;
	} else if (t <= 7.1e-243) {
		tmp = y / (a / x);
	} else if (t <= 3.3e-153) {
		tmp = x * (y / a);
	} else if (t <= 1.3e+50) {
		tmp = y * (x / a);
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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 = -t / (a / z)
    if (t <= (-1.55d-133)) then
        tmp = t_1
    else if (t <= 7.1d-243) then
        tmp = y / (a / x)
    else if (t <= 3.3d-153) then
        tmp = x * (y / a)
    else if (t <= 1.3d+50) then
        tmp = y * (x / a)
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = -t / (a / z);
	double tmp;
	if (t <= -1.55e-133) {
		tmp = t_1;
	} else if (t <= 7.1e-243) {
		tmp = y / (a / x);
	} else if (t <= 3.3e-153) {
		tmp = x * (y / a);
	} else if (t <= 1.3e+50) {
		tmp = y * (x / a);
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = -t / (a / z)
	tmp = 0
	if t <= -1.55e-133:
		tmp = t_1
	elif t <= 7.1e-243:
		tmp = y / (a / x)
	elif t <= 3.3e-153:
		tmp = x * (y / a)
	elif t <= 1.3e+50:
		tmp = y * (x / a)
	else:
		tmp = t_1
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(-t) / Float64(a / z))
	tmp = 0.0
	if (t <= -1.55e-133)
		tmp = t_1;
	elseif (t <= 7.1e-243)
		tmp = Float64(y / Float64(a / x));
	elseif (t <= 3.3e-153)
		tmp = Float64(x * Float64(y / a));
	elseif (t <= 1.3e+50)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = t_1;
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = -t / (a / z);
	tmp = 0.0;
	if (t <= -1.55e-133)
		tmp = t_1;
	elseif (t <= 7.1e-243)
		tmp = y / (a / x);
	elseif (t <= 3.3e-153)
		tmp = x * (y / a);
	elseif (t <= 1.3e+50)
		tmp = y * (x / a);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.55e-133], t$95$1, If[LessEqual[t, 7.1e-243], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.3e-153], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e+50], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{-t}{\frac{a}{z}}\\
\mathbf{if}\;t \leq -1.55 \cdot 10^{-133}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 7.1 \cdot 10^{-243}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;t \leq 3.3 \cdot 10^{-153}:\\
\;\;\;\;x \cdot \frac{y}{a}\\

\mathbf{elif}\;t \leq 1.3 \cdot 10^{+50}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.55000000000000008e-133 or 1.3000000000000001e50 < t

    1. Initial program 88.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. mul-1-neg66.5%

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

        \[\leadsto -\color{blue}{\frac{t}{\frac{a}{z}}} \]
    4. Simplified65.8%

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

    if -1.55000000000000008e-133 < t < 7.1000000000000004e-243

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

    if 7.1000000000000004e-243 < t < 3.29999999999999988e-153

    1. Initial program 90.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Taylor expanded in t around 0 86.1%

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

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

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

    if 3.29999999999999988e-153 < t < 1.3000000000000001e50

    1. Initial program 95.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.55 \cdot 10^{-133}:\\ \;\;\;\;\frac{-t}{\frac{a}{z}}\\ \mathbf{elif}\;t \leq 7.1 \cdot 10^{-243}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{-153}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{+50}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-t}{\frac{a}{z}}\\ \end{array} \]

Alternative 7: 72.8% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+25} \lor \neg \left(x \cdot y \leq 10^{-31}\right):\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{-t}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= (* x y) -5e+25) (not (<= (* x y) 1e-31)))
   (* y (/ x a))
   (* z (/ (- t) a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((x * y) <= -5e+25) || !((x * y) <= 1e-31)) {
		tmp = y * (x / a);
	} else {
		tmp = z * (-t / a);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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) :: tmp
    if (((x * y) <= (-5d+25)) .or. (.not. ((x * y) <= 1d-31))) then
        tmp = y * (x / a)
    else
        tmp = z * (-t / a)
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((x * y) <= -5e+25) || !((x * y) <= 1e-31)) {
		tmp = y * (x / a);
	} else {
		tmp = z * (-t / a);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if ((x * y) <= -5e+25) or not ((x * y) <= 1e-31):
		tmp = y * (x / a)
	else:
		tmp = z * (-t / a)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((Float64(x * y) <= -5e+25) || !(Float64(x * y) <= 1e-31))
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(z * Float64(Float64(-t) / a));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (((x * y) <= -5e+25) || ~(((x * y) <= 1e-31)))
		tmp = y * (x / a);
	else
		tmp = z * (-t / a);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e+25], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e-31]], $MachinePrecision]], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+25} \lor \neg \left(x \cdot y \leq 10^{-31}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5.00000000000000024e25 or 1e-31 < (*.f64 x y)

    1. Initial program 87.0%

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

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

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

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

    if -5.00000000000000024e25 < (*.f64 x y) < 1e-31

    1. Initial program 96.1%

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

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

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

        \[\leadsto \frac{x}{\frac{a}{y}} - \color{blue}{\frac{z}{\frac{a}{t}}} \]
    3. Applied egg-rr93.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. associate-*r/77.3%

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{-t}{a}} \]
    6. Simplified74.9%

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

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

Alternative 8: 73.5% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+25} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{-87}\right):\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= (* x y) -5e+25) (not (<= (* x y) 2e-87)))
   (* y (/ x a))
   (/ (* z (- t)) a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((x * y) <= -5e+25) || !((x * y) <= 2e-87)) {
		tmp = y * (x / a);
	} else {
		tmp = (z * -t) / a;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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) :: tmp
    if (((x * y) <= (-5d+25)) .or. (.not. ((x * y) <= 2d-87))) then
        tmp = y * (x / a)
    else
        tmp = (z * -t) / a
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((x * y) <= -5e+25) || !((x * y) <= 2e-87)) {
		tmp = y * (x / a);
	} else {
		tmp = (z * -t) / a;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if ((x * y) <= -5e+25) or not ((x * y) <= 2e-87):
		tmp = y * (x / a)
	else:
		tmp = (z * -t) / a
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((Float64(x * y) <= -5e+25) || !(Float64(x * y) <= 2e-87))
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(Float64(z * Float64(-t)) / a);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (((x * y) <= -5e+25) || ~(((x * y) <= 2e-87)))
		tmp = y * (x / a);
	else
		tmp = (z * -t) / a;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e+25], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e-87]], $MachinePrecision]], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+25} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{-87}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5.00000000000000024e25 or 2.00000000000000004e-87 < (*.f64 x y)

    1. Initial program 87.2%

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

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

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

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

    if -5.00000000000000024e25 < (*.f64 x y) < 2.00000000000000004e-87

    1. Initial program 96.7%

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

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

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

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

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

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

Alternative 9: 53.5% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -2.9e-102) (* y (/ x a)) (* x (/ y a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -2.9e-102) {
		tmp = y * (x / a);
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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) :: tmp
    if (x <= (-2.9d-102)) then
        tmp = y * (x / a)
    else
        tmp = x * (y / a)
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -2.9e-102) {
		tmp = y * (x / a);
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if x <= -2.9e-102:
		tmp = y * (x / a)
	else:
		tmp = x * (y / a)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -2.9e-102)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(x * Float64(y / a));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -2.9e-102)
		tmp = y * (x / a);
	else
		tmp = x * (y / a);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.9e-102], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-102}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.89999999999999986e-102

    1. Initial program 91.5%

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

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

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

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

    if -2.89999999999999986e-102 < x

    1. Initial program 91.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
    3. Taylor expanded in t around 0 47.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \]

Alternative 10: 53.5% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -3.6e-102) (* y (/ x a)) (/ x (/ a y))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -3.6e-102) {
		tmp = y * (x / a);
	} else {
		tmp = x / (a / y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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) :: tmp
    if (x <= (-3.6d-102)) then
        tmp = y * (x / a)
    else
        tmp = x / (a / y)
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -3.6e-102) {
		tmp = y * (x / a);
	} else {
		tmp = x / (a / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if x <= -3.6e-102:
		tmp = y * (x / a)
	else:
		tmp = x / (a / y)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -3.6e-102)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(x / Float64(a / y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -3.6e-102)
		tmp = y * (x / a);
	else
		tmp = x / (a / y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.6e-102], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-102}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.6e-102

    1. Initial program 91.5%

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

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

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

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

    if -3.6e-102 < x

    1. Initial program 91.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \end{array} \]

Alternative 11: 53.0% accurate, 1.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ x \cdot \frac{y}{a} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	return x * (y / a);
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
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 / a)
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	return x * (y / a);
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	return x * (y / a)
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	return Float64(x * Float64(y / a))
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
	tmp = x * (y / a);
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
x \cdot \frac{y}{a}
\end{array}
Derivation
  1. Initial program 91.3%

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

    \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a} + \frac{x \cdot y}{a}} \]
  3. Taylor expanded in t around 0 52.7%

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

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

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

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

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

  :herbie-target
  (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))