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

Percentage Accurate: 91.2% → 96.8%
Time: 6.9s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 91.2% 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.8% accurate, 0.1× 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}}\\ t_2 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_2 \leq -5 \cdot 10^{+272}:\\ \;\;\;\;\mathsf{fma}\left(-1, t_1, \frac{y}{\frac{a}{x}}\right)\\ \mathbf{elif}\;t_2 \leq 10^{+288}:\\ \;\;\;\;\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{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 (/ a z))) (t_2 (- (* x y) (* z t))))
   (if (<= t_2 -5e+272)
     (fma -1.0 t_1 (/ y (/ a x)))
     (if (<= t_2 1e+288)
       (* (fma x y (* t (- z))) (/ 1.0 a))
       (- (* x (/ y 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 t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -5e+272) {
		tmp = fma(-1.0, t_1, (y / (a / x)));
	} else if (t_2 <= 1e+288) {
		tmp = fma(x, y, (t * -z)) * (1.0 / a);
	} else {
		tmp = (x * (y / 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(a / z))
	t_2 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_2 <= -5e+272)
		tmp = fma(-1.0, t_1, Float64(y / Float64(a / x)));
	elseif (t_2 <= 1e+288)
		tmp = Float64(fma(x, y, Float64(t * Float64(-z))) * Float64(1.0 / a));
	else
		tmp = Float64(Float64(x * Float64(y / a)) - t_1);
	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[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+272], N[(-1.0 * t$95$1 + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+288], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] * N[(1.0 / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / 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 := \frac{t}{\frac{a}{z}}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+272}:\\
\;\;\;\;\mathsf{fma}\left(-1, t_1, \frac{y}{\frac{a}{x}}\right)\\

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

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

    if -4.99999999999999973e272 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 99.1%

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

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

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

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

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

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

    if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{a} \cdot \left(\color{blue}{y \cdot x} + t \cdot \left(-z\right)\right) \]
      4. distribute-rgt-neg-out71.6%

        \[\leadsto \frac{1}{a} \cdot \left(y \cdot x + \color{blue}{\left(-t \cdot z\right)}\right) \]
      5. distribute-lft-neg-out71.6%

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

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

        \[\leadsto \color{blue}{\frac{y \cdot x}{a}} + \left(\left(-t\right) \cdot z\right) \cdot \frac{1}{a} \]
      8. distribute-lft-neg-out68.8%

        \[\leadsto \frac{y \cdot x}{a} + \color{blue}{\left(-t \cdot z\right)} \cdot \frac{1}{a} \]
      9. distribute-lft-neg-in68.8%

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

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

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

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

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

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

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

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

Alternative 2: 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 -5 \cdot 10^{+274} \lor \neg \left(t_1 \leq 10^{+288}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right) \cdot \frac{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+274) (not (<= t_1 1e+288)))
     (- (* x (/ y a)) (/ t (/ a z)))
     (* (fma x y (* t (- z))) (/ 1.0 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+274) || !(t_1 <= 1e+288)) {
		tmp = (x * (y / a)) - (t / (a / z));
	} else {
		tmp = fma(x, y, (t * -z)) * (1.0 / 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+274) || !(t_1 <= 1e+288))
		tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z)));
	else
		tmp = Float64(fma(x, y, Float64(t * Float64(-z))) * Float64(1.0 / 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[Or[LessEqual[t$95$1, -5e+274], N[Not[LessEqual[t$95$1, 1e+288]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] * N[(1.0 / a), $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 -5 \cdot 10^{+274} \lor \neg \left(t_1 \leq 10^{+288}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

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


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

    1. Initial program 70.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right) \cdot \frac{1}{a}} \]
    4. Step-by-step derivation
      1. *-commutative70.2%

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

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

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

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

        \[\leadsto \frac{1}{a} \cdot \left(y \cdot x + \color{blue}{\left(-t\right) \cdot z}\right) \]
      6. distribute-rgt-in68.8%

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

        \[\leadsto \color{blue}{\frac{y \cdot x}{a}} + \left(\left(-t\right) \cdot z\right) \cdot \frac{1}{a} \]
      8. distribute-lft-neg-out68.8%

        \[\leadsto \frac{y \cdot x}{a} + \color{blue}{\left(-t \cdot z\right)} \cdot \frac{1}{a} \]
      9. distribute-lft-neg-in68.8%

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

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

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

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

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

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

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

    if -4.9999999999999998e274 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 99.1%

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

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

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

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

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

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

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

Alternative 3: 97.0% 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^{+274} \lor \neg \left(t_1 \leq 10^{+288}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \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+274) (not (<= t_1 1e+288)))
     (- (* x (/ y a)) (/ t (/ a z)))
     (/ 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+274) || !(t_1 <= 1e+288)) {
		tmp = (x * (y / a)) - (t / (a / z));
	} 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+274)) .or. (.not. (t_1 <= 1d+288))) then
        tmp = (x * (y / a)) - (t / (a / z))
    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+274) || !(t_1 <= 1e+288)) {
		tmp = (x * (y / a)) - (t / (a / z));
	} 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+274) or not (t_1 <= 1e+288):
		tmp = (x * (y / a)) - (t / (a / z))
	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+274) || !(t_1 <= 1e+288))
		tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z)));
	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+274) || ~((t_1 <= 1e+288)))
		tmp = (x * (y / a)) - (t / (a / z));
	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+274], N[Not[LessEqual[t$95$1, 1e+288]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $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^{+274} \lor \neg \left(t_1 \leq 10^{+288}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

\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)) < -4.9999999999999998e274 or 1e288 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 70.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right) \cdot \frac{1}{a}} \]
    4. Step-by-step derivation
      1. *-commutative70.2%

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

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

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

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

        \[\leadsto \frac{1}{a} \cdot \left(y \cdot x + \color{blue}{\left(-t\right) \cdot z}\right) \]
      6. distribute-rgt-in68.8%

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

        \[\leadsto \color{blue}{\frac{y \cdot x}{a}} + \left(\left(-t\right) \cdot z\right) \cdot \frac{1}{a} \]
      8. distribute-lft-neg-out68.8%

        \[\leadsto \frac{y \cdot x}{a} + \color{blue}{\left(-t \cdot z\right)} \cdot \frac{1}{a} \]
      9. distribute-lft-neg-in68.8%

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

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

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

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

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

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

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

    if -4.9999999999999998e274 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 99.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -5 \cdot 10^{+274} \lor \neg \left(x \cdot y - z \cdot t \leq 10^{+288}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{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 -5 \cdot 10^{+255}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;t_1 \leq 10^{+288}:\\ \;\;\;\;\frac{t_1}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \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 -5e+255)
     (- (/ x (/ a y)) (/ z (/ a t)))
     (if (<= t_1 1e+288) (/ t_1 a) (- (* x (/ y a)) (/ t (/ a z)))))))
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+255) {
		tmp = (x / (a / y)) - (z / (a / t));
	} else if (t_1 <= 1e+288) {
		tmp = t_1 / a;
	} else {
		tmp = (x * (y / a)) - (t / (a / z));
	}
	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+255)) then
        tmp = (x / (a / y)) - (z / (a / t))
    else if (t_1 <= 1d+288) then
        tmp = t_1 / a
    else
        tmp = (x * (y / a)) - (t / (a / z))
    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+255) {
		tmp = (x / (a / y)) - (z / (a / t));
	} else if (t_1 <= 1e+288) {
		tmp = t_1 / a;
	} else {
		tmp = (x * (y / a)) - (t / (a / z));
	}
	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+255:
		tmp = (x / (a / y)) - (z / (a / t))
	elif t_1 <= 1e+288:
		tmp = t_1 / a
	else:
		tmp = (x * (y / a)) - (t / (a / z))
	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+255)
		tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t)));
	elseif (t_1 <= 1e+288)
		tmp = Float64(t_1 / a);
	else
		tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z)));
	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+255)
		tmp = (x / (a / y)) - (z / (a / t));
	elseif (t_1 <= 1e+288)
		tmp = t_1 / a;
	else
		tmp = (x * (y / a)) - (t / (a / z));
	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, -5e+255], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+288], N[(t$95$1 / a), $MachinePrecision], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $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 -5 \cdot 10^{+255}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\

\mathbf{elif}\;t_1 \leq 10^{+288}:\\
\;\;\;\;\frac{t_1}{a}\\

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


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

    1. Initial program 72.5%

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

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

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

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

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

    if -5.0000000000000002e255 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 99.1%

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

    if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 71.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{a} \cdot \left(\color{blue}{y \cdot x} + t \cdot \left(-z\right)\right) \]
      4. distribute-rgt-neg-out71.6%

        \[\leadsto \frac{1}{a} \cdot \left(y \cdot x + \color{blue}{\left(-t \cdot z\right)}\right) \]
      5. distribute-lft-neg-out71.6%

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

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

        \[\leadsto \color{blue}{\frac{y \cdot x}{a}} + \left(\left(-t\right) \cdot z\right) \cdot \frac{1}{a} \]
      8. distribute-lft-neg-out68.8%

        \[\leadsto \frac{y \cdot x}{a} + \color{blue}{\left(-t \cdot z\right)} \cdot \frac{1}{a} \]
      9. distribute-lft-neg-in68.8%

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

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

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

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

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

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

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

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

Alternative 5: 94.7% 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 -2 \cdot 10^{+269}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+207}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{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 y) -2e+269)
   (/ y (/ a x))
   (if (<= (* x y) 5e+207) (/ (- (* x y) (* z t)) 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 * y) <= -2e+269) {
		tmp = y / (a / x);
	} else if ((x * y) <= 5e+207) {
		tmp = ((x * y) - (z * t)) / 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 * y) <= (-2d+269)) then
        tmp = y / (a / x)
    else if ((x * y) <= 5d+207) then
        tmp = ((x * y) - (z * t)) / 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 * y) <= -2e+269) {
		tmp = y / (a / x);
	} else if ((x * y) <= 5e+207) {
		tmp = ((x * y) - (z * t)) / 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 * y) <= -2e+269:
		tmp = y / (a / x)
	elif (x * y) <= 5e+207:
		tmp = ((x * y) - (z * t)) / 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 (Float64(x * y) <= -2e+269)
		tmp = Float64(y / Float64(a / x));
	elseif (Float64(x * y) <= 5e+207)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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 * y) <= -2e+269)
		tmp = y / (a / x);
	elseif ((x * y) <= 5e+207)
		tmp = ((x * y) - (z * t)) / 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[N[(x * y), $MachinePrecision], -2e+269], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+207], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $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 \cdot y \leq -2 \cdot 10^{+269}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

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

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


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

    1. Initial program 70.2%

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

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

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

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

    if -2.0000000000000001e269 < (*.f64 x y) < 4.9999999999999999e207

    1. Initial program 95.6%

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

    if 4.9999999999999999e207 < (*.f64 x y)

    1. Initial program 70.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 67.7% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-67}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+39}:\\ \;\;\;\;\frac{-t}{\frac{a}{z}}\\ \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 (<= y -1.3e-67)
   (/ x (/ a y))
   (if (<= y 5.8e+39) (/ (- t) (/ a z)) (* x (/ y a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -1.3e-67) {
		tmp = x / (a / y);
	} else if (y <= 5.8e+39) {
		tmp = -t / (a / z);
	} 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 (y <= (-1.3d-67)) then
        tmp = x / (a / y)
    else if (y <= 5.8d+39) then
        tmp = -t / (a / z)
    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 (y <= -1.3e-67) {
		tmp = x / (a / y);
	} else if (y <= 5.8e+39) {
		tmp = -t / (a / z);
	} 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 y <= -1.3e-67:
		tmp = x / (a / y)
	elif y <= 5.8e+39:
		tmp = -t / (a / z)
	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 (y <= -1.3e-67)
		tmp = Float64(x / Float64(a / y));
	elseif (y <= 5.8e+39)
		tmp = Float64(Float64(-t) / Float64(a / z));
	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 (y <= -1.3e-67)
		tmp = x / (a / y);
	elseif (y <= 5.8e+39)
		tmp = -t / (a / z);
	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[y, -1.3e-67], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+39], N[((-t) / N[(a / z), $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}\;y \leq -1.3 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\

\mathbf{elif}\;y \leq 5.8 \cdot 10^{+39}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.2999999999999999e-67

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

    if -1.2999999999999999e-67 < y < 5.80000000000000059e39

    1. Initial program 95.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-t\right) \cdot z}{a}} \]
    5. Step-by-step derivation
      1. associate-/l*73.2%

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

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

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

    if 5.80000000000000059e39 < y

    1. Initial program 85.8%

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

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

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

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

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

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

Alternative 7: 67.7% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-67}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+40}:\\ \;\;\;\;z \cdot \frac{-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 (<= y -1.3e-67)
   (/ x (/ a y))
   (if (<= y 1.35e+40) (* 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 (y <= -1.3e-67) {
		tmp = x / (a / y);
	} else if (y <= 1.35e+40) {
		tmp = z * (-t / 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 (y <= (-1.3d-67)) then
        tmp = x / (a / y)
    else if (y <= 1.35d+40) then
        tmp = z * (-t / 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 (y <= -1.3e-67) {
		tmp = x / (a / y);
	} else if (y <= 1.35e+40) {
		tmp = 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 y <= -1.3e-67:
		tmp = x / (a / y)
	elif y <= 1.35e+40:
		tmp = 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 (y <= -1.3e-67)
		tmp = Float64(x / Float64(a / y));
	elseif (y <= 1.35e+40)
		tmp = Float64(z * Float64(Float64(-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 (y <= -1.3e-67)
		tmp = x / (a / y);
	elseif (y <= 1.35e+40)
		tmp = 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[y, -1.3e-67], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+40], N[(z * N[((-t) / 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}\;y \leq -1.3 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\

\mathbf{elif}\;y \leq 1.35 \cdot 10^{+40}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.2999999999999999e-67

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

    if -1.2999999999999999e-67 < y < 1.35000000000000005e40

    1. Initial program 95.8%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt47.9%

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

        \[\leadsto \frac{x}{\frac{a}{y}} - \frac{\color{blue}{\sqrt{z \cdot z}}}{\frac{a}{t}} \]
      3. sqr-neg49.0%

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

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

        \[\leadsto \frac{x}{\frac{a}{y}} - \frac{\color{blue}{-z}}{\frac{a}{t}} \]
      6. distribute-neg-frac32.4%

        \[\leadsto \frac{x}{\frac{a}{y}} - \color{blue}{\left(-\frac{z}{\frac{a}{t}}\right)} \]
      7. associate-/r/33.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.35000000000000005e40 < y

    1. Initial program 85.8%

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

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

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

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

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

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

Alternative 8: 51.8% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{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 (<= z -5.2e-72) (* x (/ y a)) (* y (/ x a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -5.2e-72) {
		tmp = x * (y / a);
	} else {
		tmp = y * (x / 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 (z <= (-5.2d-72)) then
        tmp = x * (y / a)
    else
        tmp = y * (x / 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 (z <= -5.2e-72) {
		tmp = x * (y / a);
	} else {
		tmp = y * (x / a);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -5.2e-72:
		tmp = x * (y / a)
	else:
		tmp = y * (x / a)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -5.2e-72)
		tmp = Float64(x * Float64(y / a));
	else
		tmp = Float64(y * Float64(x / 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 (z <= -5.2e-72)
		tmp = x * (y / a);
	else
		tmp = y * (x / 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[z, -5.2e-72], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \frac{y}{a}\\

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


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

    1. Initial program 88.8%

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

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

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

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

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

    if -5.19999999999999992e-72 < z

    1. Initial program 91.8%

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

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

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

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

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

Alternative 9: 51.8% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \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 (<= z -5e-68) (* x (/ y a)) (/ y (/ a x))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -5e-68) {
		tmp = x * (y / a);
	} else {
		tmp = y / (a / x);
	}
	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 (z <= (-5d-68)) then
        tmp = x * (y / a)
    else
        tmp = y / (a / x)
    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 (z <= -5e-68) {
		tmp = x * (y / a);
	} else {
		tmp = y / (a / x);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -5e-68:
		tmp = x * (y / a)
	else:
		tmp = y / (a / x)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -5e-68)
		tmp = Float64(x * Float64(y / a));
	else
		tmp = Float64(y / Float64(a / x));
	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 (z <= -5e-68)
		tmp = x * (y / a);
	else
		tmp = y / (a / x);
	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[z, -5e-68], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \frac{y}{a}\\

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


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

    1. Initial program 88.6%

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

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

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

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

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

    if -4.99999999999999971e-68 < z

    1. Initial program 91.8%

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

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

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

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

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

Alternative 10: 52.1% accurate, 1.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ y \cdot \frac{x}{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 (* y (/ x a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	return y * (x / 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 = y * (x / a)
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	return y * (x / a);
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	return y * (x / a)
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	return Float64(y * Float64(x / a))
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
	tmp = y * (x / 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[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
y \cdot \frac{x}{a}
\end{array}
Derivation
  1. Initial program 90.9%

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

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

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

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

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

Developer target: 91.4% 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 2023200 
(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))