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

Percentage Accurate: 91.1% → 93.2%
Time: 6.9s
Alternatives: 9
Speedup: 0.7×

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 9 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.1% 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: 93.2% 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{x \cdot y - z \cdot t}{a}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{+283}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, \frac{y}{\frac{a}{x}}\right)\\ \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)) a)))
   (if (<= t_1 2e+283) t_1 (fma -1.0 (/ t (/ a z)) (/ y (/ a x))))))
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)) / a;
	double tmp;
	if (t_1 <= 2e+283) {
		tmp = t_1;
	} else {
		tmp = fma(-1.0, (t / (a / z)), (y / (a / x)));
	}
	return tmp;
}
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a)
	tmp = 0.0
	if (t_1 <= 2e+283)
		tmp = t_1;
	else
		tmp = fma(-1.0, Float64(t / Float64(a / z)), Float64(y / Float64(a / x)));
	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[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+283], t$95$1, N[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+283}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 98.8%

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

    if 1.99999999999999991e283 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a)

    1. Initial program 72.5%

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

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

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

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

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

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

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

Alternative 2: 70.9% accurate, 0.4× 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^{-114}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \cdot y \leq 10^{-152} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-43}\right) \land x \cdot y \leq 5000:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{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) -5e-114)
   (* y (/ x a))
   (if (or (<= (* x y) 1e-152)
           (and (not (<= (* x y) 5e-43)) (<= (* x y) 5000.0)))
     (/ (* 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) <= -5e-114) {
		tmp = y * (x / a);
	} else if (((x * y) <= 1e-152) || (!((x * y) <= 5e-43) && ((x * y) <= 5000.0))) {
		tmp = (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) <= (-5d-114)) then
        tmp = y * (x / a)
    else if (((x * y) <= 1d-152) .or. (.not. ((x * y) <= 5d-43)) .and. ((x * y) <= 5000.0d0)) then
        tmp = (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) <= -5e-114) {
		tmp = y * (x / a);
	} else if (((x * y) <= 1e-152) || (!((x * y) <= 5e-43) && ((x * y) <= 5000.0))) {
		tmp = (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) <= -5e-114:
		tmp = y * (x / a)
	elif ((x * y) <= 1e-152) or (not ((x * y) <= 5e-43) and ((x * y) <= 5000.0)):
		tmp = (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) <= -5e-114)
		tmp = Float64(y * Float64(x / a));
	elseif ((Float64(x * y) <= 1e-152) || (!(Float64(x * y) <= 5e-43) && (Float64(x * y) <= 5000.0)))
		tmp = Float64(Float64(z * Float64(-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) <= -5e-114)
		tmp = y * (x / a);
	elseif (((x * y) <= 1e-152) || (~(((x * y) <= 5e-43)) && ((x * y) <= 5000.0)))
		tmp = (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], -5e-114], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], 1e-152], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e-43]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 5000.0]]], N[(N[(z * (-t)), $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 -5 \cdot 10^{-114}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

\mathbf{elif}\;x \cdot y \leq 10^{-152} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-43}\right) \land x \cdot y \leq 5000:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\

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


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

    1. Initial program 91.2%

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

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

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

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

    if -4.99999999999999989e-114 < (*.f64 x y) < 1.00000000000000007e-152 or 5.00000000000000019e-43 < (*.f64 x y) < 5e3

    1. Initial program 97.8%

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

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

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

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

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

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

    if 1.00000000000000007e-152 < (*.f64 x y) < 5.00000000000000019e-43 or 5e3 < (*.f64 x y)

    1. Initial program 91.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-114}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \cdot y \leq 10^{-152} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-43}\right) \land x \cdot y \leq 5000:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \end{array} \]

Alternative 3: 93.0% accurate, 0.4× speedup?

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

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


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

    1. Initial program 98.8%

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

    if 4.00000000000000026e260 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a)

    1. Initial program 74.1%

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

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

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

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

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

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

Alternative 4: 66.0% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := \left(-z\right) \cdot \frac{t}{a}\\ \mathbf{if}\;z \leq -1 \cdot 10^{+158}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -7 \cdot 10^{+122}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;z \leq -225 \lor \neg \left(z \leq 5.7 \cdot 10^{-21}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 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
 (let* ((t_1 (* (- z) (/ t a))))
   (if (<= z -1e+158)
     t_1
     (if (<= z -7e+122)
       (/ y (/ a x))
       (if (or (<= z -225.0) (not (<= z 5.7e-21))) t_1 (/ (* x y) a))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = -z * (t / a);
	double tmp;
	if (z <= -1e+158) {
		tmp = t_1;
	} else if (z <= -7e+122) {
		tmp = y / (a / x);
	} else if ((z <= -225.0) || !(z <= 5.7e-21)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = -z * (t / a)
    if (z <= (-1d+158)) then
        tmp = t_1
    else if (z <= (-7d+122)) then
        tmp = y / (a / x)
    else if ((z <= (-225.0d0)) .or. (.not. (z <= 5.7d-21))) then
        tmp = t_1
    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 t_1 = -z * (t / a);
	double tmp;
	if (z <= -1e+158) {
		tmp = t_1;
	} else if (z <= -7e+122) {
		tmp = y / (a / x);
	} else if ((z <= -225.0) || !(z <= 5.7e-21)) {
		tmp = t_1;
	} else {
		tmp = (x * y) / a;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = -z * (t / a)
	tmp = 0
	if z <= -1e+158:
		tmp = t_1
	elif z <= -7e+122:
		tmp = y / (a / x)
	elif (z <= -225.0) or not (z <= 5.7e-21):
		tmp = t_1
	else:
		tmp = (x * y) / a
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(-z) * Float64(t / a))
	tmp = 0.0
	if (z <= -1e+158)
		tmp = t_1;
	elseif (z <= -7e+122)
		tmp = Float64(y / Float64(a / x));
	elseif ((z <= -225.0) || !(z <= 5.7e-21))
		tmp = t_1;
	else
		tmp = Float64(Float64(x * 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)
	t_1 = -z * (t / a);
	tmp = 0.0;
	if (z <= -1e+158)
		tmp = t_1;
	elseif (z <= -7e+122)
		tmp = y / (a / x);
	elseif ((z <= -225.0) || ~((z <= 5.7e-21)))
		tmp = t_1;
	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_] := Block[{t$95$1 = N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e+158], t$95$1, If[LessEqual[z, -7e+122], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -225.0], N[Not[LessEqual[z, 5.7e-21]], $MachinePrecision]], t$95$1, N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot \frac{t}{a}\\
\mathbf{if}\;z \leq -1 \cdot 10^{+158}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -7 \cdot 10^{+122}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;z \leq -225 \lor \neg \left(z \leq 5.7 \cdot 10^{-21}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.99999999999999953e157 or -7.00000000000000028e122 < z < -225 or 5.6999999999999996e-21 < z

    1. Initial program 90.9%

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999953e157 < z < -7.00000000000000028e122

    1. Initial program 99.8%

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

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

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

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

    if -225 < z < 5.6999999999999996e-21

    1. Initial program 96.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+158}:\\ \;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\ \mathbf{elif}\;z \leq -7 \cdot 10^{+122}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;z \leq -225 \lor \neg \left(z \leq 5.7 \cdot 10^{-21}\right):\\ \;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \end{array} \]

Alternative 5: 67.1% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := \left(-t\right) \cdot \frac{z}{a}\\ \mathbf{if}\;z \leq -9.8 \cdot 10^{+157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{+122}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;z \leq -0.41 \lor \neg \left(z \leq 2.55 \cdot 10^{-104}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 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
 (let* ((t_1 (* (- t) (/ z a))))
   (if (<= z -9.8e+157)
     t_1
     (if (<= z -2.2e+122)
       (/ y (/ a x))
       (if (or (<= z -0.41) (not (<= z 2.55e-104))) t_1 (/ (* x y) a))))))
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 tmp;
	if (z <= -9.8e+157) {
		tmp = t_1;
	} else if (z <= -2.2e+122) {
		tmp = y / (a / x);
	} else if ((z <= -0.41) || !(z <= 2.55e-104)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = -t * (z / a)
    if (z <= (-9.8d+157)) then
        tmp = t_1
    else if (z <= (-2.2d+122)) then
        tmp = y / (a / x)
    else if ((z <= (-0.41d0)) .or. (.not. (z <= 2.55d-104))) then
        tmp = t_1
    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 t_1 = -t * (z / a);
	double tmp;
	if (z <= -9.8e+157) {
		tmp = t_1;
	} else if (z <= -2.2e+122) {
		tmp = y / (a / x);
	} else if ((z <= -0.41) || !(z <= 2.55e-104)) {
		tmp = t_1;
	} else {
		tmp = (x * y) / a;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = -t * (z / a)
	tmp = 0
	if z <= -9.8e+157:
		tmp = t_1
	elif z <= -2.2e+122:
		tmp = y / (a / x)
	elif (z <= -0.41) or not (z <= 2.55e-104):
		tmp = t_1
	else:
		tmp = (x * y) / a
	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(z / a))
	tmp = 0.0
	if (z <= -9.8e+157)
		tmp = t_1;
	elseif (z <= -2.2e+122)
		tmp = Float64(y / Float64(a / x));
	elseif ((z <= -0.41) || !(z <= 2.55e-104))
		tmp = t_1;
	else
		tmp = Float64(Float64(x * 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)
	t_1 = -t * (z / a);
	tmp = 0.0;
	if (z <= -9.8e+157)
		tmp = t_1;
	elseif (z <= -2.2e+122)
		tmp = y / (a / x);
	elseif ((z <= -0.41) || ~((z <= 2.55e-104)))
		tmp = t_1;
	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_] := Block[{t$95$1 = N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.8e+157], t$95$1, If[LessEqual[z, -2.2e+122], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -0.41], N[Not[LessEqual[z, 2.55e-104]], $MachinePrecision]], t$95$1, N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot \frac{z}{a}\\
\mathbf{if}\;z \leq -9.8 \cdot 10^{+157}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.2 \cdot 10^{+122}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;z \leq -0.41 \lor \neg \left(z \leq 2.55 \cdot 10^{-104}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.8000000000000003e157 or -2.1999999999999999e122 < z < -0.409999999999999976 or 2.54999999999999996e-104 < z

    1. Initial program 92.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-z}{\frac{a}{t}}} \]
      6. associate-/r/65.1%

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

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

    if -9.8000000000000003e157 < z < -2.1999999999999999e122

    1. Initial program 99.8%

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

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

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

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

    if -0.409999999999999976 < z < 2.54999999999999996e-104

    1. Initial program 96.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.8 \cdot 10^{+157}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{+122}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;z \leq -0.41 \lor \neg \left(z \leq 2.55 \cdot 10^{-104}\right):\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \end{array} \]

Alternative 6: 67.2% 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}\;z \leq -1.2 \cdot 10^{+158}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;z \leq -355:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.44 \cdot 10^{-98}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) \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 (/ t (/ (- a) z))))
   (if (<= z -1.2e+158)
     t_1
     (if (<= z -7.5e+122)
       (/ y (/ a x))
       (if (<= z -355.0)
         t_1
         (if (<= z 1.44e-98) (/ (* x y) 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 = t / (-a / z);
	double tmp;
	if (z <= -1.2e+158) {
		tmp = t_1;
	} else if (z <= -7.5e+122) {
		tmp = y / (a / x);
	} else if (z <= -355.0) {
		tmp = t_1;
	} else if (z <= 1.44e-98) {
		tmp = (x * y) / a;
	} else {
		tmp = -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 = t / (-a / z)
    if (z <= (-1.2d+158)) then
        tmp = t_1
    else if (z <= (-7.5d+122)) then
        tmp = y / (a / x)
    else if (z <= (-355.0d0)) then
        tmp = t_1
    else if (z <= 1.44d-98) then
        tmp = (x * y) / a
    else
        tmp = -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 = t / (-a / z);
	double tmp;
	if (z <= -1.2e+158) {
		tmp = t_1;
	} else if (z <= -7.5e+122) {
		tmp = y / (a / x);
	} else if (z <= -355.0) {
		tmp = t_1;
	} else if (z <= 1.44e-98) {
		tmp = (x * y) / a;
	} else {
		tmp = -t * (z / a);
	}
	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 z <= -1.2e+158:
		tmp = t_1
	elif z <= -7.5e+122:
		tmp = y / (a / x)
	elif z <= -355.0:
		tmp = t_1
	elif z <= 1.44e-98:
		tmp = (x * y) / a
	else:
		tmp = -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(t / Float64(Float64(-a) / z))
	tmp = 0.0
	if (z <= -1.2e+158)
		tmp = t_1;
	elseif (z <= -7.5e+122)
		tmp = Float64(y / Float64(a / x));
	elseif (z <= -355.0)
		tmp = t_1;
	elseif (z <= 1.44e-98)
		tmp = Float64(Float64(x * y) / a);
	else
		tmp = Float64(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 = t / (-a / z);
	tmp = 0.0;
	if (z <= -1.2e+158)
		tmp = t_1;
	elseif (z <= -7.5e+122)
		tmp = y / (a / x);
	elseif (z <= -355.0)
		tmp = t_1;
	elseif (z <= 1.44e-98)
		tmp = (x * y) / a;
	else
		tmp = -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[(t / N[((-a) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e+158], t$95$1, If[LessEqual[z, -7.5e+122], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -355.0], t$95$1, If[LessEqual[z, 1.44e-98], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[((-t) * N[(z / a), $MachinePrecision]), $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}}\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+158}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -7.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;z \leq -355:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.44 \cdot 10^{-98}:\\
\;\;\;\;\frac{x \cdot y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.20000000000000004e158 or -7.5000000000000002e122 < z < -355

    1. Initial program 88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{a}{-t}}} \]
      6. remove-double-neg74.3%

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

        \[\leadsto \frac{z}{-\color{blue}{\frac{-a}{-t}}} \]
      8. neg-mul-174.3%

        \[\leadsto \frac{z}{-\frac{\color{blue}{-1 \cdot a}}{-t}} \]
      9. neg-mul-174.3%

        \[\leadsto \frac{z}{-\frac{-1 \cdot a}{\color{blue}{-1 \cdot t}}} \]
      10. times-frac74.3%

        \[\leadsto \frac{z}{-\color{blue}{\frac{-1}{-1} \cdot \frac{a}{t}}} \]
      11. metadata-eval74.3%

        \[\leadsto \frac{z}{-\color{blue}{1} \cdot \frac{a}{t}} \]
      12. *-lft-identity74.3%

        \[\leadsto \frac{z}{-\color{blue}{\frac{a}{t}}} \]
      13. distribute-frac-neg74.3%

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

        \[\leadsto \color{blue}{\frac{z \cdot t}{-a}} \]
      15. *-commutative71.1%

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

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

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

    if -1.20000000000000004e158 < z < -7.5000000000000002e122

    1. Initial program 99.8%

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

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

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

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

    if -355 < z < 1.44e-98

    1. Initial program 96.1%

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

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

    if 1.44e-98 < z

    1. Initial program 94.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-z}{\frac{a}{t}}} \]
      6. associate-/r/58.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+158}:\\ \;\;\;\;\frac{t}{\frac{-a}{z}}\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{+122}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;z \leq -355:\\ \;\;\;\;\frac{t}{\frac{-a}{z}}\\ \mathbf{elif}\;z \leq 1.44 \cdot 10^{-98}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \end{array} \]

Alternative 7: 93.1% accurate, 0.7× 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^{+294}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot 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 (<= (* x y) -2e+294) (/ y (/ a x)) (/ (- (* x y) (* 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) <= -2e+294) {
		tmp = y / (a / x);
	} else {
		tmp = ((x * y) - (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) <= (-2d+294)) then
        tmp = y / (a / x)
    else
        tmp = ((x * y) - (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) <= -2e+294) {
		tmp = y / (a / x);
	} else {
		tmp = ((x * y) - (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) <= -2e+294:
		tmp = y / (a / x)
	else:
		tmp = ((x * y) - (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) <= -2e+294)
		tmp = Float64(y / Float64(a / x));
	else
		tmp = Float64(Float64(Float64(x * y) - Float64(z * 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) <= -2e+294)
		tmp = y / (a / x);
	else
		tmp = ((x * y) - (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[LessEqual[N[(x * y), $MachinePrecision], -2e+294], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $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 -2 \cdot 10^{+294}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

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


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

    1. Initial program 69.6%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    4. Simplified95.7%

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

    if -2.00000000000000013e294 < (*.f64 x y)

    1. Initial program 96.2%

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

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

Alternative 8: 51.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}\;z \leq -0.007:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 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 (<= z -0.007) (* x (/ y 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 (z <= -0.007) {
		tmp = x * (y / 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 (z <= (-0.007d0)) then
        tmp = x * (y / 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 (z <= -0.007) {
		tmp = x * (y / 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 z <= -0.007:
		tmp = x * (y / 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 (z <= -0.007)
		tmp = Float64(x * Float64(y / a));
	else
		tmp = Float64(Float64(x * 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 (z <= -0.007)
		tmp = x * (y / 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[z, -0.007], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.007:\\
\;\;\;\;x \cdot \frac{y}{a}\\

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


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

    1. Initial program 90.0%

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

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

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

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

    if -0.00700000000000000015 < z

    1. Initial program 95.3%

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

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

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

Alternative 9: 52.0% 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 93.9%

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

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

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

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

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

Developer target: 90.9% 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 2023195 
(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))