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

Percentage Accurate: 91.6% → 97.0%
Time: 8.1s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 91.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot y - z \cdot t}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a):
	return ((x * y) - (z * t)) / a
function code(x, y, z, t, a)
	return Float64(Float64(Float64(x * y) - Float64(z * t)) / a)
end
function tmp = code(x, y, z, t, a)
	tmp = ((x * y) - (z * t)) / a;
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}

Alternative 1: 97.0% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+261}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;t_1 \leq 4 \cdot 10^{+305}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-t, z, x \cdot y\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{a}, \frac{-z}{\frac{a}{t}}\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))))
   (if (<= t_1 -5e+261)
     (- (/ x (/ a y)) (/ z (/ a t)))
     (if (<= t_1 4e+305)
       (/ (fma (- t) z (* x y)) a)
       (fma 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 t_1 = (x * y) - (z * t);
	double tmp;
	if (t_1 <= -5e+261) {
		tmp = (x / (a / y)) - (z / (a / t));
	} else if (t_1 <= 4e+305) {
		tmp = fma(-t, z, (x * y)) / a;
	} else {
		tmp = fma(y, (x / a), (-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 <= -5e+261)
		tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t)));
	elseif (t_1 <= 4e+305)
		tmp = Float64(fma(Float64(-t), z, Float64(x * y)) / a);
	else
		tmp = fma(y, Float64(x / a), 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, -5e+261], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+305], N[(N[((-t) * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(y * N[(x / a), $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 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+261}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

    if -5.0000000000000001e261 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.9999999999999998e305

    1. Initial program 98.5%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv98.5%

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

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

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

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

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

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

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

    if 3.9999999999999998e305 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 69.5%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} - \frac{z \cdot t}{a} \]
      3. *-un-lft-identity66.2%

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

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

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

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

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

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

Alternative 2: 96.8% accurate, 0.1× speedup?

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

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


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

    1. Initial program 68.4%

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

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

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

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

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

    if -5.0000000000000001e261 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.9999999999999998e305

    1. Initial program 98.5%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv98.5%

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

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

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

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

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

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

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

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

Alternative 3: 96.8% accurate, 0.3× speedup?

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

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


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

    1. Initial program 68.4%

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

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

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

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

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

    if -5.0000000000000001e261 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.9999999999999998e305

    1. Initial program 98.5%

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

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

Alternative 4: 66.4% 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}{a} \cdot \left(-z\right)\\ t_2 := y \cdot \frac{x}{a}\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+162}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+151}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{+34}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-159}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.9 \cdot 10^{+25}:\\ \;\;\;\;\frac{-t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (/ t a) (- z))) (t_2 (* y (/ x a))))
   (if (<= x -1.25e+162)
     (/ y (/ a x))
     (if (<= x -6e+151)
       t_1
       (if (<= x -1.55e+34)
         t_2
         (if (<= x -9e-159) t_1 (if (<= x 2.9e+25) (/ (- t) (/ a z)) t_2)))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (t / a) * -z;
	double t_2 = y * (x / a);
	double tmp;
	if (x <= -1.25e+162) {
		tmp = y / (a / x);
	} else if (x <= -6e+151) {
		tmp = t_1;
	} else if (x <= -1.55e+34) {
		tmp = t_2;
	} else if (x <= -9e-159) {
		tmp = t_1;
	} else if (x <= 2.9e+25) {
		tmp = -t / (a / z);
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (t / a) * -z
    t_2 = y * (x / a)
    if (x <= (-1.25d+162)) then
        tmp = y / (a / x)
    else if (x <= (-6d+151)) then
        tmp = t_1
    else if (x <= (-1.55d+34)) then
        tmp = t_2
    else if (x <= (-9d-159)) then
        tmp = t_1
    else if (x <= 2.9d+25) then
        tmp = -t / (a / z)
    else
        tmp = t_2
    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 t_2 = y * (x / a);
	double tmp;
	if (x <= -1.25e+162) {
		tmp = y / (a / x);
	} else if (x <= -6e+151) {
		tmp = t_1;
	} else if (x <= -1.55e+34) {
		tmp = t_2;
	} else if (x <= -9e-159) {
		tmp = t_1;
	} else if (x <= 2.9e+25) {
		tmp = -t / (a / z);
	} else {
		tmp = t_2;
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = (t / a) * -z
	t_2 = y * (x / a)
	tmp = 0
	if x <= -1.25e+162:
		tmp = y / (a / x)
	elif x <= -6e+151:
		tmp = t_1
	elif x <= -1.55e+34:
		tmp = t_2
	elif x <= -9e-159:
		tmp = t_1
	elif x <= 2.9e+25:
		tmp = -t / (a / z)
	else:
		tmp = t_2
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(t / a) * Float64(-z))
	t_2 = Float64(y * Float64(x / a))
	tmp = 0.0
	if (x <= -1.25e+162)
		tmp = Float64(y / Float64(a / x));
	elseif (x <= -6e+151)
		tmp = t_1;
	elseif (x <= -1.55e+34)
		tmp = t_2;
	elseif (x <= -9e-159)
		tmp = t_1;
	elseif (x <= 2.9e+25)
		tmp = Float64(Float64(-t) / Float64(a / z));
	else
		tmp = t_2;
	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;
	t_2 = y * (x / a);
	tmp = 0.0;
	if (x <= -1.25e+162)
		tmp = y / (a / x);
	elseif (x <= -6e+151)
		tmp = t_1;
	elseif (x <= -1.55e+34)
		tmp = t_2;
	elseif (x <= -9e-159)
		tmp = t_1;
	elseif (x <= 2.9e+25)
		tmp = -t / (a / z);
	else
		tmp = t_2;
	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[(t / a), $MachinePrecision] * (-z)), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.25e+162], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6e+151], t$95$1, If[LessEqual[x, -1.55e+34], t$95$2, If[LessEqual[x, -9e-159], t$95$1, If[LessEqual[x, 2.9e+25], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{t}{a} \cdot \left(-z\right)\\
t_2 := y \cdot \frac{x}{a}\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+162}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+151}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1.55 \cdot 10^{+34}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -9 \cdot 10^{-159}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.9 \cdot 10^{+25}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.2499999999999999e162

    1. Initial program 75.5%

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

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

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

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

    if -1.2499999999999999e162 < x < -5.9999999999999998e151 or -1.54999999999999989e34 < x < -8.99999999999999977e-159

    1. Initial program 96.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-t}{\frac{a}{z}}} \]
    5. Step-by-step derivation
      1. frac-2neg74.1%

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

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

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

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

    if -5.9999999999999998e151 < x < -1.54999999999999989e34 or 2.8999999999999999e25 < x

    1. Initial program 87.1%

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

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

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

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

    if -8.99999999999999977e-159 < x < 2.8999999999999999e25

    1. Initial program 94.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{+162}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+151}:\\ \;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{+34}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-159}:\\ \;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq 2.9 \cdot 10^{+25}:\\ \;\;\;\;\frac{-t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \]

Alternative 5: 66.4% 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{z \cdot \left(-t\right)}{a}\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{+162}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -3.85 \cdot 10^{+146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{+34}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{1}{a}\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 (/ (* z (- t)) a)))
   (if (<= x -1.8e+162)
     (/ y (/ a x))
     (if (<= x -3.85e+146)
       t_1
       (if (<= x -3.5e+34)
         (* y (/ x a))
         (if (<= x 3.3e+25) t_1 (* y (* x (/ 1.0 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 (x <= -1.8e+162) {
		tmp = y / (a / x);
	} else if (x <= -3.85e+146) {
		tmp = t_1;
	} else if (x <= -3.5e+34) {
		tmp = y * (x / a);
	} else if (x <= 3.3e+25) {
		tmp = t_1;
	} else {
		tmp = y * (x * (1.0 / 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 (x <= (-1.8d+162)) then
        tmp = y / (a / x)
    else if (x <= (-3.85d+146)) then
        tmp = t_1
    else if (x <= (-3.5d+34)) then
        tmp = y * (x / a)
    else if (x <= 3.3d+25) then
        tmp = t_1
    else
        tmp = y * (x * (1.0d0 / 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 (x <= -1.8e+162) {
		tmp = y / (a / x);
	} else if (x <= -3.85e+146) {
		tmp = t_1;
	} else if (x <= -3.5e+34) {
		tmp = y * (x / a);
	} else if (x <= 3.3e+25) {
		tmp = t_1;
	} else {
		tmp = y * (x * (1.0 / 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 x <= -1.8e+162:
		tmp = y / (a / x)
	elif x <= -3.85e+146:
		tmp = t_1
	elif x <= -3.5e+34:
		tmp = y * (x / a)
	elif x <= 3.3e+25:
		tmp = t_1
	else:
		tmp = y * (x * (1.0 / a))
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(z * Float64(-t)) / a)
	tmp = 0.0
	if (x <= -1.8e+162)
		tmp = Float64(y / Float64(a / x));
	elseif (x <= -3.85e+146)
		tmp = t_1;
	elseif (x <= -3.5e+34)
		tmp = Float64(y * Float64(x / a));
	elseif (x <= 3.3e+25)
		tmp = t_1;
	else
		tmp = Float64(y * Float64(x * Float64(1.0 / 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 (x <= -1.8e+162)
		tmp = y / (a / x);
	elseif (x <= -3.85e+146)
		tmp = t_1;
	elseif (x <= -3.5e+34)
		tmp = y * (x / a);
	elseif (x <= 3.3e+25)
		tmp = t_1;
	else
		tmp = y * (x * (1.0 / a));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[x, -1.8e+162], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.85e+146], t$95$1, If[LessEqual[x, -3.5e+34], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e+25], t$95$1, N[(y * N[(x * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{z \cdot \left(-t\right)}{a}\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+162}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;x \leq -3.85 \cdot 10^{+146}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -3.5 \cdot 10^{+34}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

\mathbf{elif}\;x \leq 3.3 \cdot 10^{+25}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{1}{a}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.79999999999999997e162

    1. Initial program 75.5%

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

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

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

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

    if -1.79999999999999997e162 < x < -3.8500000000000001e146 or -3.49999999999999998e34 < x < 3.3000000000000001e25

    1. Initial program 94.5%

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

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

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

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

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

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

    if -3.8500000000000001e146 < x < -3.49999999999999998e34

    1. Initial program 82.9%

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

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

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

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

    if 3.3000000000000001e25 < x

    1. Initial program 89.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity64.8%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{\frac{a}{y}} \]
      2. div-inv64.9%

        \[\leadsto \frac{1 \cdot x}{\color{blue}{a \cdot \frac{1}{y}}} \]
      3. frac-times59.7%

        \[\leadsto \color{blue}{\frac{1}{a} \cdot \frac{x}{\frac{1}{y}}} \]
      4. associate-/r/59.7%

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

        \[\leadsto \frac{1}{a} \cdot \left(\color{blue}{x} \cdot y\right) \]
      6. associate-*r*70.0%

        \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot x\right) \cdot y} \]
    8. Applied egg-rr70.0%

      \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot x\right) \cdot y} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+162}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -3.85 \cdot 10^{+146}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{+34}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+25}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{1}{a}\right)\\ \end{array} \]

Alternative 6: 65.7% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+34}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-8} \lor \neg \left(x \leq -9.5 \cdot 10^{-50}\right) \land x \leq 3.6 \cdot 10^{+40}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -2.1e+34)
   (/ y (/ a x))
   (if (or (<= x -9e-8) (and (not (<= x -9.5e-50)) (<= x 3.6e+40)))
     (* (- t) (/ z a))
     (* y (/ x a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -2.1e+34) {
		tmp = y / (a / x);
	} else if ((x <= -9e-8) || (!(x <= -9.5e-50) && (x <= 3.6e+40))) {
		tmp = -t * (z / a);
	} else {
		tmp = y * (x / a);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (x <= (-2.1d+34)) then
        tmp = y / (a / x)
    else if ((x <= (-9d-8)) .or. (.not. (x <= (-9.5d-50))) .and. (x <= 3.6d+40)) then
        tmp = -t * (z / a)
    else
        tmp = y * (x / a)
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -2.1e+34) {
		tmp = y / (a / x);
	} else if ((x <= -9e-8) || (!(x <= -9.5e-50) && (x <= 3.6e+40))) {
		tmp = -t * (z / a);
	} else {
		tmp = y * (x / a);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if x <= -2.1e+34:
		tmp = y / (a / x)
	elif (x <= -9e-8) or (not (x <= -9.5e-50) and (x <= 3.6e+40)):
		tmp = -t * (z / a)
	else:
		tmp = y * (x / a)
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -2.1e+34)
		tmp = Float64(y / Float64(a / x));
	elseif ((x <= -9e-8) || (!(x <= -9.5e-50) && (x <= 3.6e+40)))
		tmp = Float64(Float64(-t) * Float64(z / a));
	else
		tmp = Float64(y * Float64(x / a));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -2.1e+34)
		tmp = y / (a / x);
	elseif ((x <= -9e-8) || (~((x <= -9.5e-50)) && (x <= 3.6e+40)))
		tmp = -t * (z / a);
	else
		tmp = y * (x / a);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.1e+34], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -9e-8], And[N[Not[LessEqual[x, -9.5e-50]], $MachinePrecision], LessEqual[x, 3.6e+40]]], N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+34}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;x \leq -9 \cdot 10^{-8} \lor \neg \left(x \leq -9.5 \cdot 10^{-50}\right) \land x \leq 3.6 \cdot 10^{+40}:\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.10000000000000017e34

    1. Initial program 78.0%

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

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

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

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

    if -2.10000000000000017e34 < x < -8.99999999999999986e-8 or -9.4999999999999993e-50 < x < 3.59999999999999996e40

    1. Initial program 95.7%

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

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

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

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

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

        \[\leadsto -\color{blue}{t \cdot \frac{z}{a}} \]
      5. distribute-lft-neg-in72.9%

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

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

    if -8.99999999999999986e-8 < x < -9.4999999999999993e-50 or 3.59999999999999996e40 < x

    1. Initial program 87.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+34}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-8} \lor \neg \left(x \leq -9.5 \cdot 10^{-50}\right) \land x \leq 3.6 \cdot 10^{+40}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \]

Alternative 7: 66.1% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+162}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+151}:\\ \;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{+35} \lor \neg \left(x \leq 3.5 \cdot 10^{+38}\right):\\ \;\;\;\;y \cdot \frac{x}{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
 (if (<= x -1.8e+162)
   (/ y (/ a x))
   (if (<= x -6e+151)
     (* (/ t a) (- z))
     (if (or (<= x -3.6e+35) (not (<= x 3.5e+38)))
       (* 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 (x <= -1.8e+162) {
		tmp = y / (a / x);
	} else if (x <= -6e+151) {
		tmp = (t / a) * -z;
	} else if ((x <= -3.6e+35) || !(x <= 3.5e+38)) {
		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 (x <= (-1.8d+162)) then
        tmp = y / (a / x)
    else if (x <= (-6d+151)) then
        tmp = (t / a) * -z
    else if ((x <= (-3.6d+35)) .or. (.not. (x <= 3.5d+38))) 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 (x <= -1.8e+162) {
		tmp = y / (a / x);
	} else if (x <= -6e+151) {
		tmp = (t / a) * -z;
	} else if ((x <= -3.6e+35) || !(x <= 3.5e+38)) {
		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 x <= -1.8e+162:
		tmp = y / (a / x)
	elif x <= -6e+151:
		tmp = (t / a) * -z
	elif (x <= -3.6e+35) or not (x <= 3.5e+38):
		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 (x <= -1.8e+162)
		tmp = Float64(y / Float64(a / x));
	elseif (x <= -6e+151)
		tmp = Float64(Float64(t / a) * Float64(-z));
	elseif ((x <= -3.6e+35) || !(x <= 3.5e+38))
		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 (x <= -1.8e+162)
		tmp = y / (a / x);
	elseif (x <= -6e+151)
		tmp = (t / a) * -z;
	elseif ((x <= -3.6e+35) || ~((x <= 3.5e+38)))
		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[x, -1.8e+162], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6e+151], N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision], If[Or[LessEqual[x, -3.6e+35], N[Not[LessEqual[x, 3.5e+38]], $MachinePrecision]], 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}\;x \leq -1.8 \cdot 10^{+162}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+151}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\

\mathbf{elif}\;x \leq -3.6 \cdot 10^{+35} \lor \neg \left(x \leq 3.5 \cdot 10^{+38}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.79999999999999997e162

    1. Initial program 75.5%

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

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

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

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

    if -1.79999999999999997e162 < x < -5.9999999999999998e151

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{t}{a}} \cdot \left(-z\right) \]
    6. Applied egg-rr28.0%

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

    if -5.9999999999999998e151 < x < -3.6e35 or 3.50000000000000002e38 < x

    1. Initial program 86.2%

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

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

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

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

    if -3.6e35 < x < 3.50000000000000002e38

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+162}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+151}:\\ \;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{+35} \lor \neg \left(x \leq 3.5 \cdot 10^{+38}\right):\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \end{array} \]

Alternative 8: 66.4% accurate, 0.6× speedup?

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

\mathbf{elif}\;x \leq -8 \cdot 10^{+145} \lor \neg \left(x \leq -8.6 \cdot 10^{+36}\right) \land x \leq 3.8 \cdot 10^{+25}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.2499999999999999e162

    1. Initial program 75.5%

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

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

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

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

    if -1.2499999999999999e162 < x < -7.9999999999999999e145 or -8.6000000000000001e36 < x < 3.8e25

    1. Initial program 93.9%

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

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

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

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

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

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

    if -7.9999999999999999e145 < x < -8.6000000000000001e36 or 3.8e25 < x

    1. Initial program 88.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{+162}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;x \leq -8 \cdot 10^{+145} \lor \neg \left(x \leq -8.6 \cdot 10^{+36}\right) \land x \leq 3.8 \cdot 10^{+25}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \]

Alternative 9: 93.6% 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 \left(x \cdot \frac{1}{a}\right)\\ \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 (/ 1.0 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 * (1.0 / 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 * (1.0 / 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 * (1.0 / 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 * Float64(1.0 / 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 * (1.0 / 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 * N[(1.0 / a), $MachinePrecision]), $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 \left(x \cdot \frac{1}{a}\right)\\

\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 55.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity99.6%

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

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

        \[\leadsto \color{blue}{\frac{1}{a} \cdot \frac{x}{\frac{1}{y}}} \]
      4. associate-/r/55.9%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(\frac{x}{1} \cdot y\right)} \]
      5. /-rgt-identity55.9%

        \[\leadsto \frac{1}{a} \cdot \left(\color{blue}{x} \cdot y\right) \]
      6. associate-*r*99.8%

        \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot x\right) \cdot y} \]
    8. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot x\right) \cdot y} \]

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

    1. Initial program 92.9%

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

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

Alternative 10: 50.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}\;a \leq 1.25 \cdot 10^{-68}:\\ \;\;\;\;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 (<= a 1.25e-68) (* 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 (a <= 1.25e-68) {
		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 (a <= 1.25d-68) 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 (a <= 1.25e-68) {
		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 a <= 1.25e-68:
		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 (a <= 1.25e-68)
		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 (a <= 1.25e-68)
		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[a, 1.25e-68], 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}\;a \leq 1.25 \cdot 10^{-68}:\\
\;\;\;\;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 a < 1.24999999999999993e-68

    1. Initial program 87.0%

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

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

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

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

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

    if 1.24999999999999993e-68 < a

    1. Initial program 96.3%

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

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

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

Alternative 11: 50.9% 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 89.8%

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

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

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

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

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

Alternative 12: 51.0% accurate, 1.8× speedup?

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

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

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

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

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

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

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

Developer target: 91.7% 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 2023263 
(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))