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

Percentage Accurate: 91.2% → 95.8%
Time: 7.4s
Alternatives: 8
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 8 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: 95.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 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\ \mathbf{elif}\;t_1 \leq 10^{+125}:\\ \;\;\;\;\frac{t_1}{a}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, \frac{y}{\frac{a}{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\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))))
   (if (<= t_1 (- INFINITY))
     (- (/ x (/ a y)) (* t (/ z a)))
     (if (<= t_1 1e+125)
       (/ t_1 a)
       (if (<= t_1 INFINITY)
         (fma -1.0 (/ t (/ a z)) (/ y (/ a x)))
         (/ (- 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);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = (x / (a / y)) - (t * (z / a));
	} else if (t_1 <= 1e+125) {
		tmp = t_1 / a;
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = fma(-1.0, (t / (a / z)), (y / (a / x)));
	} else {
		tmp = -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(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(Float64(x / Float64(a / y)) - Float64(t * Float64(z / a)));
	elseif (t_1 <= 1e+125)
		tmp = Float64(t_1 / a);
	elseif (t_1 <= Inf)
		tmp = fma(-1.0, Float64(t / Float64(a / z)), Float64(y / Float64(a / x)));
	else
		tmp = Float64(Float64(-z) / Float64(a / t));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+125], N[(t$95$1 / a), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z) / N[(a / t), $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 -\infty:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\

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

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

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


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

    1. Initial program 51.1%

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

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

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999992e124

    1. Initial program 99.2%

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

    if 9.9999999999999992e124 < (-.f64 (*.f64 x y) (*.f64 z t)) < +inf.0

    1. Initial program 89.8%

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

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

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

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

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

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

    if +inf.0 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.3% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := \frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\ t_2 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 10^{+85}:\\ \;\;\;\;\frac{t_2}{a}\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\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 (/ a y)) (* t (/ z a)))) (t_2 (- (* x y) (* z t))))
   (if (<= t_2 (- INFINITY))
     t_1
     (if (<= t_2 1e+85)
       (/ t_2 a)
       (if (<= t_2 INFINITY) t_1 (/ (- 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 / (a / y)) - (t * (z / a));
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_2 <= 1e+85) {
		tmp = t_2 / a;
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = -z / (a / t);
	}
	return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x / (a / y)) - (t * (z / a));
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_2 <= 1e+85) {
		tmp = t_2 / a;
	} else if (t_2 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = -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 / (a / y)) - (t * (z / a))
	t_2 = (x * y) - (z * t)
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1
	elif t_2 <= 1e+85:
		tmp = t_2 / a
	elif t_2 <= math.inf:
		tmp = t_1
	else:
		tmp = -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(x / Float64(a / y)) - Float64(t * Float64(z / a)))
	t_2 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_2 <= 1e+85)
		tmp = Float64(t_2 / a);
	elseif (t_2 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(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 / (a / y)) - (t * (z / a));
	t_2 = (x * y) - (z * t);
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1;
	elseif (t_2 <= 1e+85)
		tmp = t_2 / a;
	elseif (t_2 <= Inf)
		tmp = t_1;
	else
		tmp = -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[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+85], N[(t$95$2 / a), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$1, N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_2 \leq 10^{+85}:\\
\;\;\;\;\frac{t_2}{a}\\

\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 79.4%

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

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

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e85

    1. Initial program 99.1%

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

    if +inf.0 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 93.2% 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 -\infty:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \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) (- INFINITY)) (* y (/ x a)) (/ (- (* 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) <= -((double) INFINITY)) {
		tmp = y * (x / a);
	} else {
		tmp = ((x * y) - (z * t)) / a;
	}
	return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -Double.POSITIVE_INFINITY) {
		tmp = y * (x / a);
	} 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) <= -math.inf:
		tmp = y * (x / a)
	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) <= Float64(-Inf))
		tmp = Float64(y * Float64(x / a));
	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) <= -Inf)
		tmp = y * (x / a);
	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], (-Infinity)], N[(y * N[(x / a), $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 -\infty:\\
\;\;\;\;y \cdot \frac{x}{a}\\

\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) < -inf.0

    1. Initial program 36.8%

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

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

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

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

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

    1. Initial program 94.8%

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

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

Alternative 4: 67.3% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{-140} \lor \neg \left(t \leq 8.9 \cdot 10^{+83}\right):\\ \;\;\;\;\frac{-z}{\frac{a}{t}}\\ \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 (or (<= t -6.2e-140) (not (<= t 8.9e+83)))
   (/ (- z) (/ a t))
   (* y (/ x a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((t <= -6.2e-140) || !(t <= 8.9e+83)) {
		tmp = -z / (a / t);
	} 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 ((t <= (-6.2d-140)) .or. (.not. (t <= 8.9d+83))) then
        tmp = -z / (a / t)
    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 ((t <= -6.2e-140) || !(t <= 8.9e+83)) {
		tmp = -z / (a / t);
	} 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 (t <= -6.2e-140) or not (t <= 8.9e+83):
		tmp = -z / (a / t)
	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 ((t <= -6.2e-140) || !(t <= 8.9e+83))
		tmp = Float64(Float64(-z) / Float64(a / t));
	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 ((t <= -6.2e-140) || ~((t <= 8.9e+83)))
		tmp = -z / (a / t);
	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[Or[LessEqual[t, -6.2e-140], N[Not[LessEqual[t, 8.9e+83]], $MachinePrecision]], N[((-z) / N[(a / t), $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}\;t \leq -6.2 \cdot 10^{-140} \lor \neg \left(t \leq 8.9 \cdot 10^{+83}\right):\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.1999999999999998e-140 or 8.90000000000000045e83 < t

    1. Initial program 90.2%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{t \cdot z}{a}} \]
      2. *-commutative61.8%

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

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

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

    if -6.1999999999999998e-140 < t < 8.90000000000000045e83

    1. Initial program 94.2%

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

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

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

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

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

Alternative 5: 67.5% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -9.8 \cdot 10^{-142}:\\ \;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\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
 (if (<= t -9.8e-142)
   (* z (- (/ t a)))
   (if (<= t 8.5e+83) (* y (/ x a)) (/ (- z) (/ a t)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -9.8e-142) {
		tmp = z * -(t / a);
	} else if (t <= 8.5e+83) {
		tmp = y * (x / a);
	} else {
		tmp = -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) :: tmp
    if (t <= (-9.8d-142)) then
        tmp = z * -(t / a)
    else if (t <= 8.5d+83) then
        tmp = y * (x / a)
    else
        tmp = -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 tmp;
	if (t <= -9.8e-142) {
		tmp = z * -(t / a);
	} else if (t <= 8.5e+83) {
		tmp = y * (x / a);
	} else {
		tmp = -z / (a / t);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if t <= -9.8e-142:
		tmp = z * -(t / a)
	elif t <= 8.5e+83:
		tmp = y * (x / a)
	else:
		tmp = -z / (a / t)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= -9.8e-142)
		tmp = Float64(z * Float64(-Float64(t / a)));
	elseif (t <= 8.5e+83)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(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)
	tmp = 0.0;
	if (t <= -9.8e-142)
		tmp = z * -(t / a);
	elseif (t <= 8.5e+83)
		tmp = y * (x / a);
	else
		tmp = -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_] := If[LessEqual[t, -9.8e-142], N[(z * (-N[(t / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[t, 8.5e+83], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.8 \cdot 10^{-142}:\\
\;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -9.8000000000000007e-142

    1. Initial program 90.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.8000000000000007e-142 < t < 8.4999999999999995e83

    1. Initial program 94.1%

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

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

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

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

    if 8.4999999999999995e83 < t

    1. Initial program 90.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9.8 \cdot 10^{-142}:\\ \;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-z}{\frac{a}{t}}\\ \end{array} \]

Alternative 6: 66.9% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{-140}:\\ \;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;-t \cdot \frac{z}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= t -6.2e-140)
   (* z (- (/ t a)))
   (if (<= t 3.6e+83) (* y (/ x a)) (- (* t (/ z a))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -6.2e-140) {
		tmp = z * -(t / a);
	} else if (t <= 3.6e+83) {
		tmp = y * (x / 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) :: tmp
    if (t <= (-6.2d-140)) then
        tmp = z * -(t / a)
    else if (t <= 3.6d+83) then
        tmp = y * (x / 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 tmp;
	if (t <= -6.2e-140) {
		tmp = z * -(t / a);
	} else if (t <= 3.6e+83) {
		tmp = y * (x / 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):
	tmp = 0
	if t <= -6.2e-140:
		tmp = z * -(t / a)
	elif t <= 3.6e+83:
		tmp = y * (x / 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)
	tmp = 0.0
	if (t <= -6.2e-140)
		tmp = Float64(z * Float64(-Float64(t / a)));
	elseif (t <= 3.6e+83)
		tmp = Float64(y * Float64(x / 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)
	tmp = 0.0;
	if (t <= -6.2e-140)
		tmp = z * -(t / a);
	elseif (t <= 3.6e+83)
		tmp = y * (x / 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_] := If[LessEqual[t, -6.2e-140], N[(z * (-N[(t / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[t, 3.6e+83], N[(y * N[(x / a), $MachinePrecision]), $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}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-140}:\\
\;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.1999999999999998e-140

    1. Initial program 90.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.1999999999999998e-140 < t < 3.5999999999999997e83

    1. Initial program 94.2%

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

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

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

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

    if 3.5999999999999997e83 < t

    1. Initial program 90.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{-140}:\\ \;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;-t \cdot \frac{z}{a}\\ \end{array} \]

Alternative 7: 50.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 -4.6 \cdot 10^{+67}:\\ \;\;\;\;y \cdot \frac{x}{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 -4.6e+67) (* y (/ x a)) (/ (* x y) a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.6e+67) {
		tmp = y * (x / a);
	} else {
		tmp = (x * y) / a;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z <= (-4.6d+67)) then
        tmp = y * (x / a)
    else
        tmp = (x * y) / a
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.6e+67) {
		tmp = y * (x / a);
	} else {
		tmp = (x * y) / a;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -4.6e+67:
		tmp = y * (x / a)
	else:
		tmp = (x * y) / a
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -4.6e+67)
		tmp = Float64(y * Float64(x / 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 <= -4.6e+67)
		tmp = y * (x / a);
	else
		tmp = (x * y) / a;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.6e+67], N[(y * N[(x / 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 -4.6 \cdot 10^{+67}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


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

    1. Initial program 74.1%

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

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

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

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

    if -4.5999999999999997e67 < z

    1. Initial program 94.7%

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

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

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

Alternative 8: 51.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 92.0%

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

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

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

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

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

Developer target: 91.5% 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 2023238 
(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))