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

Percentage Accurate: 91.6% → 94.7%
Time: 8.8s
Alternatives: 9
Speedup: 0.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 91.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: 94.7% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{a} - t \cdot \frac{z}{x \cdot a}\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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) (* t (/ z (* y a)))))
   (if (<= (* x y) 5e+146)
     (/ (fma x y (* t (- z))) a)
     (* x (- (/ y a) (* t (/ z (* x a))))))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -((double) INFINITY)) {
		tmp = y * ((x / a) - (t * (z / (y * a))));
	} else if ((x * y) <= 5e+146) {
		tmp = fma(x, y, (t * -z)) / a;
	} else {
		tmp = x * ((y / a) - (t * (z / (x * a))));
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(x * y) <= Float64(-Inf))
		tmp = Float64(y * Float64(Float64(x / a) - Float64(t * Float64(z / Float64(y * a)))));
	elseif (Float64(x * y) <= 5e+146)
		tmp = Float64(fma(x, y, Float64(t * Float64(-z))) / a);
	else
		tmp = Float64(x * Float64(Float64(y / a) - Float64(t * Float64(z / Float64(x * a)))));
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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[(N[(x / a), $MachinePrecision] - N[(t * N[(z / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+146], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(N[(y / a), $MachinePrecision] - N[(t * N[(z / N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\

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

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


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

    1. Initial program 49.2%

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

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

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

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

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

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

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

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

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

    if 4.9999999999999999e146 < (*.f64 x y)

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

Alternative 2: 94.8% accurate, 0.3× speedup?

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

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


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

    1. Initial program 74.7%

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

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

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

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

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

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

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

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

    1. Initial program 98.3%

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

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

Alternative 3: 94.7% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\frac{x \cdot y - t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{a} - t \cdot \frac{z}{x \cdot a}\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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) (* t (/ z (* y a)))))
   (if (<= (* x y) 5e+146)
     (/ (- (* x y) (* t z)) a)
     (* x (- (/ y a) (* t (/ z (* x a))))))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -((double) INFINITY)) {
		tmp = y * ((x / a) - (t * (z / (y * a))));
	} else if ((x * y) <= 5e+146) {
		tmp = ((x * y) - (t * z)) / a;
	} else {
		tmp = x * ((y / a) - (t * (z / (x * a))));
	}
	return tmp;
}
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
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) - (t * (z / (y * a))));
	} else if ((x * y) <= 5e+146) {
		tmp = ((x * y) - (t * z)) / a;
	} else {
		tmp = x * ((y / a) - (t * (z / (x * a))));
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	tmp = 0
	if (x * y) <= -math.inf:
		tmp = y * ((x / a) - (t * (z / (y * a))))
	elif (x * y) <= 5e+146:
		tmp = ((x * y) - (t * z)) / a
	else:
		tmp = x * ((y / a) - (t * (z / (x * a))))
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(x * y) <= Float64(-Inf))
		tmp = Float64(y * Float64(Float64(x / a) - Float64(t * Float64(z / Float64(y * a)))));
	elseif (Float64(x * y) <= 5e+146)
		tmp = Float64(Float64(Float64(x * y) - Float64(t * z)) / a);
	else
		tmp = Float64(x * Float64(Float64(y / a) - Float64(t * Float64(z / Float64(x * a)))));
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((x * y) <= -Inf)
		tmp = y * ((x / a) - (t * (z / (y * a))));
	elseif ((x * y) <= 5e+146)
		tmp = ((x * y) - (t * z)) / a;
	else
		tmp = x * ((y / a) - (t * (z / (x * a))));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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[(N[(x / a), $MachinePrecision] - N[(t * N[(z / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+146], N[(N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(N[(y / a), $MachinePrecision] - N[(t * N[(z / N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\

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

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


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

    1. Initial program 49.2%

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

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

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

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

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

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

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

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

    1. Initial program 98.3%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing

    if 4.9999999999999999e146 < (*.f64 x y)

    1. Initial program 85.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\frac{x \cdot y - t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{a} - t \cdot \frac{z}{x \cdot a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 74.2% accurate, 0.4× speedup?

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

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\

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


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

    1. Initial program 84.7%

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

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

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

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

    if -4.99999999999999989e37 < (*.f64 x y) < 5e-32

    1. Initial program 98.2%

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

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

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

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

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

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

    if 5e-32 < (*.f64 x y)

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+37}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-32}:\\ \;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.0% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 84.7%

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

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

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

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

    if -4.99999999999999989e37 < (*.f64 x y) < 5e-32

    1. Initial program 98.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. *-commutative82.0%

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

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

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

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

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

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

    if 5e-32 < (*.f64 x y)

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 73.4% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 84.7%

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

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

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

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

    if -4.99999999999999989e37 < (*.f64 x y) < 5e-32

    1. Initial program 98.2%

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

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

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

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

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

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

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

    if 5e-32 < (*.f64 x y)

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 93.5% accurate, 0.6× speedup?

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

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


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

    1. Initial program 49.2%

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

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

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

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

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

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

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

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

    1. Initial program 96.2%

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

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

Alternative 8: 51.2% accurate, 0.9× speedup?

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

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


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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

    if -2.25e61 < z

    1. Initial program 95.1%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 51.4% accurate, 1.8× speedup?

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
  6. Add Preprocessing

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

  :alt
  (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))