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

Percentage Accurate: 91.5% → 94.3%
Time: 11.0s
Alternatives: 5
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 5 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.5% 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.3% accurate, 0.6× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \leq 2 \cdot 10^{+29}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}} - \frac{t}{\frac{a\_m}{z}}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= a_m 2e+29)
    (/ (- (* x y) (* z t)) a_m)
    (- (/ x (/ a_m y)) (/ t (/ a_m z))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 2e+29) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = (x / (a_m / y)) - (t / (a_m / z));
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if (a_m <= 2d+29) then
        tmp = ((x * y) - (z * t)) / a_m
    else
        tmp = (x / (a_m / y)) - (t / (a_m / z))
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (a_m <= 2e+29) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = (x / (a_m / y)) - (t / (a_m / z));
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if a_m <= 2e+29:
		tmp = ((x * y) - (z * t)) / a_m
	else:
		tmp = (x / (a_m / y)) - (t / (a_m / z))
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (a_m <= 2e+29)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = Float64(Float64(x / Float64(a_m / y)) - Float64(t / Float64(a_m / z)));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if (a_m <= 2e+29)
		tmp = ((x * y) - (z * t)) / a_m;
	else
		tmp = (x / (a_m / y)) - (t / (a_m / z));
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 2e+29], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 2 \cdot 10^{+29}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 1.99999999999999983e29

    1. Initial program 91.0%

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

    if 1.99999999999999983e29 < a

    1. Initial program 78.9%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y - z \cdot t}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(x \cdot y - z \cdot t\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{a}\right), \color{blue}{\left(x \cdot y - z \cdot t\right)}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \left(\color{blue}{x \cdot y} - z \cdot t\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(\left(x \cdot y\right), \color{blue}{\left(z \cdot t\right)}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{z} \cdot t\right)\right)\right) \]
      7. *-lowering-*.f6478.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
    4. Applied egg-rr78.9%

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(x \cdot y - z \cdot t\right)} \]
    5. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{1}{a} \cdot \left(x \cdot y + \color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right)}\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{a} + \color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right) \cdot \frac{1}{a}} \]
      3. div-invN/A

        \[\leadsto \frac{x \cdot y}{a} + \color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right)} \cdot \frac{1}{a} \]
      4. associate-*l/N/A

        \[\leadsto \frac{x}{a} \cdot y + \color{blue}{\left(\mathsf{neg}\left(z \cdot t\right)\right)} \cdot \frac{1}{a} \]
      5. remove-double-divN/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{1}{\frac{1}{\mathsf{neg}\left(z \cdot t\right)}} \cdot \frac{\color{blue}{1}}{a} \]
      6. metadata-evalN/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{1}{\frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(z \cdot t\right)}} \cdot \frac{1}{a} \]
      7. *-commutativeN/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{1}{\frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(t \cdot z\right)}} \cdot \frac{1}{a} \]
      8. frac-2negN/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{1}{\frac{-1}{t \cdot z}} \cdot \frac{1}{a} \]
      9. associate-*l/N/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{1 \cdot \frac{1}{a}}{\color{blue}{\frac{-1}{t \cdot z}}} \]
      10. div-invN/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{\frac{1}{a}}{\frac{\color{blue}{-1}}{t \cdot z}} \]
      11. div-invN/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{\frac{1}{a}}{-1 \cdot \color{blue}{\frac{1}{t \cdot z}}} \]
      12. mul-1-negN/A

        \[\leadsto \frac{x}{a} \cdot y + \frac{\frac{1}{a}}{\mathsf{neg}\left(\frac{1}{t \cdot z}\right)} \]
      13. distribute-frac-neg2N/A

        \[\leadsto \frac{x}{a} \cdot y + \left(\mathsf{neg}\left(\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}\right)\right) \]
      14. unsub-negN/A

        \[\leadsto \frac{x}{a} \cdot y - \color{blue}{\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}} \]
      15. --lowering--.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, y\right)\right), \left(\frac{z}{a} \cdot \color{blue}{t}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, y\right)\right), \left(t \cdot \color{blue}{\frac{z}{a}}\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, y\right)\right), \left(t \cdot \frac{1}{\color{blue}{\frac{a}{z}}}\right)\right) \]
      4. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, y\right)\right), \left(\frac{t}{\color{blue}{\frac{a}{z}}}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, y\right)\right), \mathsf{/.f64}\left(t, \color{blue}{\left(\frac{a}{z}\right)}\right)\right) \]
      6. /-lowering-/.f6490.7%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, y\right)\right), \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(a, \color{blue}{z}\right)\right)\right) \]
    8. Applied egg-rr90.7%

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

Alternative 2: 94.8% accurate, 0.4× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\frac{t}{\frac{a\_m}{0 - z}}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+228}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{\frac{a\_m}{t}}{z}}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= (* z t) (- INFINITY))
    (/ t (/ a_m (- 0.0 z)))
    (if (<= (* z t) 2e+228)
      (/ (- (* x y) (* z t)) a_m)
      (/ -1.0 (/ (/ a_m t) z))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((z * t) <= -((double) INFINITY)) {
		tmp = t / (a_m / (0.0 - z));
	} else if ((z * t) <= 2e+228) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = -1.0 / ((a_m / t) / z);
	}
	return a_s * tmp;
}
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((z * t) <= -Double.POSITIVE_INFINITY) {
		tmp = t / (a_m / (0.0 - z));
	} else if ((z * t) <= 2e+228) {
		tmp = ((x * y) - (z * t)) / a_m;
	} else {
		tmp = -1.0 / ((a_m / t) / z);
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if (z * t) <= -math.inf:
		tmp = t / (a_m / (0.0 - z))
	elif (z * t) <= 2e+228:
		tmp = ((x * y) - (z * t)) / a_m
	else:
		tmp = -1.0 / ((a_m / t) / z)
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (Float64(z * t) <= Float64(-Inf))
		tmp = Float64(t / Float64(a_m / Float64(0.0 - z)));
	elseif (Float64(z * t) <= 2e+228)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = Float64(-1.0 / Float64(Float64(a_m / t) / z));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if ((z * t) <= -Inf)
		tmp = t / (a_m / (0.0 - z));
	elseif ((z * t) <= 2e+228)
		tmp = ((x * y) - (z * t)) / a_m;
	else
		tmp = -1.0 / ((a_m / t) / z);
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[(t / N[(a$95$m / N[(0.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+228], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(-1.0 / N[(N[(a$95$m / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{t}{\frac{a\_m}{0 - z}}\\

\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+228}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\

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


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

    1. Initial program 66.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y - z \cdot t}}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{a}{x \cdot y - z \cdot t}\right)}\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \color{blue}{\left(x \cdot y - z \cdot t\right)}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\left(x \cdot y\right), \color{blue}{\left(z \cdot t\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{z} \cdot t\right)\right)\right)\right) \]
      6. *-lowering-*.f6466.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(z, \color{blue}{t}\right)\right)\right)\right) \]
    4. Applied egg-rr66.6%

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{a}{t \cdot z}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{a}{t \cdot z}\right)\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{\frac{a}{t}}{z}\right)\right)\right) \]
      3. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\frac{a}{t}\right)}{\color{blue}{z}}\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{a}{t}}{z}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-1 \cdot \frac{a}{t}\right), \color{blue}{z}\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{-1 \cdot a}{t}\right), z\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-1 \cdot a\right), t\right), z\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(a\right)\right), t\right), z\right)\right) \]
      9. neg-lowering-neg.f6495.1%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(a\right), t\right), z\right)\right) \]
    7. Simplified95.1%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{-a}{t}}{z}}} \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\frac{\mathsf{neg}\left(a\right)}{\color{blue}{z \cdot t}}} \]
      2. neg-mul-1N/A

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

        \[\leadsto \frac{1}{\frac{-1}{z \cdot t} \cdot \color{blue}{a}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{-1}{t \cdot z} \cdot a} \]
      5. associate-/l/N/A

        \[\leadsto \frac{\frac{1}{a}}{\color{blue}{\frac{-1}{t \cdot z}}} \]
      6. div-invN/A

        \[\leadsto \frac{\frac{1}{a}}{-1 \cdot \color{blue}{\frac{1}{t \cdot z}}} \]
      7. mul-1-negN/A

        \[\leadsto \frac{\frac{1}{a}}{\mathsf{neg}\left(\frac{1}{t \cdot z}\right)} \]
      8. distribute-frac-neg2N/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}\right) \]
      9. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}\right)\right) \]
      10. frac-2negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{\mathsf{neg}\left(\frac{1}{t \cdot z}\right)}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{-1 \cdot \frac{1}{t \cdot z}}\right)\right) \]
      12. div-invN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{\frac{-1}{t \cdot z}}\right)\right) \]
      13. distribute-frac-negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{\frac{1}{a}}{\frac{-1}{t \cdot z}}\right)\right)\right) \]
      14. associate-/l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1}{t \cdot z} \cdot a}\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1}{z \cdot t} \cdot a}\right)\right)\right) \]
      16. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1 \cdot a}{z \cdot t}}\right)\right)\right) \]
      17. neg-mul-1N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{\mathsf{neg}\left(a\right)}{z \cdot t}}\right)\right)\right) \]
      18. associate-/l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{\frac{\mathsf{neg}\left(a\right)}{t}}{z}}\right)\right)\right) \]
      19. clear-numN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{z}{\frac{\mathsf{neg}\left(a\right)}{t}}\right)\right)\right) \]
      20. distribute-frac-neg2N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{z}{\mathsf{neg}\left(\frac{\mathsf{neg}\left(a\right)}{t}\right)}\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(z, \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(a\right)}{t}\right)\right)\right)\right) \]
    9. Applied egg-rr95.2%

      \[\leadsto \color{blue}{-\frac{z}{\frac{a}{t}}} \]
    10. Step-by-step derivation
      1. associate-/r/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{z}{a} \cdot t\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(t \cdot \frac{z}{a}\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(t \cdot \frac{1}{\frac{a}{z}}\right)\right) \]
      4. un-div-invN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{t}{\frac{a}{z}}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(t, \left(\frac{a}{z}\right)\right)\right) \]
      6. /-lowering-/.f6495.2%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(t, \mathsf{/.f64}\left(a, z\right)\right)\right) \]
    11. Applied egg-rr95.2%

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

    if -inf.0 < (*.f64 z t) < 1.9999999999999998e228

    1. Initial program 93.0%

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

    if 1.9999999999999998e228 < (*.f64 z t)

    1. Initial program 65.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y - z \cdot t}}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{a}{x \cdot y - z \cdot t}\right)}\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \color{blue}{\left(x \cdot y - z \cdot t\right)}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\left(x \cdot y\right), \color{blue}{\left(z \cdot t\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{z} \cdot t\right)\right)\right)\right) \]
      6. *-lowering-*.f6465.7%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(z, \color{blue}{t}\right)\right)\right)\right) \]
    4. Applied egg-rr65.7%

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{a}{t \cdot z}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{a}{t \cdot z}\right)\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{\frac{a}{t}}{z}\right)\right)\right) \]
      3. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\frac{a}{t}\right)}{\color{blue}{z}}\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{a}{t}}{z}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-1 \cdot \frac{a}{t}\right), \color{blue}{z}\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{-1 \cdot a}{t}\right), z\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-1 \cdot a\right), t\right), z\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(a\right)\right), t\right), z\right)\right) \]
      9. neg-lowering-neg.f6499.8%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(a\right), t\right), z\right)\right) \]
    7. Simplified99.8%

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

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

Alternative 3: 71.2% accurate, 0.4× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+90}:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+117}:\\ \;\;\;\;\frac{t}{\frac{a\_m}{0 - z}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= (* x y) -1e+90)
    (/ x (/ a_m y))
    (if (<= (* x y) 2e+117) (/ t (/ a_m (- 0.0 z))) (* y (/ x a_m))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+90) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 2e+117) {
		tmp = t / (a_m / (0.0 - z));
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if ((x * y) <= (-1d+90)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 2d+117) then
        tmp = t / (a_m / (0.0d0 - z))
    else
        tmp = y * (x / a_m)
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+90) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 2e+117) {
		tmp = t / (a_m / (0.0 - z));
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if (x * y) <= -1e+90:
		tmp = x / (a_m / y)
	elif (x * y) <= 2e+117:
		tmp = t / (a_m / (0.0 - z))
	else:
		tmp = y * (x / a_m)
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (Float64(x * y) <= -1e+90)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 2e+117)
		tmp = Float64(t / Float64(a_m / Float64(0.0 - z)));
	else
		tmp = Float64(y * Float64(x / a_m));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if ((x * y) <= -1e+90)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 2e+117)
		tmp = t / (a_m / (0.0 - z));
	else
		tmp = y * (x / a_m);
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+90], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+117], N[(t / N[(a$95$m / N[(0.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+90}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+117}:\\
\;\;\;\;\frac{t}{\frac{a\_m}{0 - z}}\\

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


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

    1. Initial program 79.6%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot y\right), \color{blue}{a}\right) \]
      2. *-lowering-*.f6464.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), a\right) \]
    5. Simplified64.5%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y}}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{1}{\frac{\frac{a}{x}}{\color{blue}{y}}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{1}{\frac{a}{x}} \cdot \color{blue}{y} \]
      4. clear-numN/A

        \[\leadsto \frac{x}{a} \cdot y \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{a}\right), \color{blue}{y}\right) \]
      6. /-lowering-/.f6477.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, a\right), y\right) \]
    7. Applied egg-rr77.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      3. clear-numN/A

        \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{a}{y}}} \]
      4. un-div-invN/A

        \[\leadsto \frac{x}{\color{blue}{\frac{a}{y}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{a}{y}\right)}\right) \]
      6. /-lowering-/.f6474.6%

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, \color{blue}{y}\right)\right) \]
    9. Applied egg-rr74.6%

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

    if -9.99999999999999966e89 < (*.f64 x y) < 2.0000000000000001e117

    1. Initial program 92.5%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y - z \cdot t}}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{a}{x \cdot y - z \cdot t}\right)}\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \color{blue}{\left(x \cdot y - z \cdot t\right)}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\left(x \cdot y\right), \color{blue}{\left(z \cdot t\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{z} \cdot t\right)\right)\right)\right) \]
      6. *-lowering-*.f6492.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(z, \color{blue}{t}\right)\right)\right)\right) \]
    4. Applied egg-rr92.5%

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{a}{t \cdot z}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{a}{t \cdot z}\right)\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{\frac{a}{t}}{z}\right)\right)\right) \]
      3. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\frac{a}{t}\right)}{\color{blue}{z}}\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{a}{t}}{z}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-1 \cdot \frac{a}{t}\right), \color{blue}{z}\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{-1 \cdot a}{t}\right), z\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-1 \cdot a\right), t\right), z\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(a\right)\right), t\right), z\right)\right) \]
      9. neg-lowering-neg.f6475.2%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(a\right), t\right), z\right)\right) \]
    7. Simplified75.2%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{-a}{t}}{z}}} \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\frac{\mathsf{neg}\left(a\right)}{\color{blue}{z \cdot t}}} \]
      2. neg-mul-1N/A

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

        \[\leadsto \frac{1}{\frac{-1}{z \cdot t} \cdot \color{blue}{a}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{-1}{t \cdot z} \cdot a} \]
      5. associate-/l/N/A

        \[\leadsto \frac{\frac{1}{a}}{\color{blue}{\frac{-1}{t \cdot z}}} \]
      6. div-invN/A

        \[\leadsto \frac{\frac{1}{a}}{-1 \cdot \color{blue}{\frac{1}{t \cdot z}}} \]
      7. mul-1-negN/A

        \[\leadsto \frac{\frac{1}{a}}{\mathsf{neg}\left(\frac{1}{t \cdot z}\right)} \]
      8. distribute-frac-neg2N/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}\right) \]
      9. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}\right)\right) \]
      10. frac-2negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{\mathsf{neg}\left(\frac{1}{t \cdot z}\right)}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{-1 \cdot \frac{1}{t \cdot z}}\right)\right) \]
      12. div-invN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{\frac{-1}{t \cdot z}}\right)\right) \]
      13. distribute-frac-negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{\frac{1}{a}}{\frac{-1}{t \cdot z}}\right)\right)\right) \]
      14. associate-/l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1}{t \cdot z} \cdot a}\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1}{z \cdot t} \cdot a}\right)\right)\right) \]
      16. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1 \cdot a}{z \cdot t}}\right)\right)\right) \]
      17. neg-mul-1N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{\mathsf{neg}\left(a\right)}{z \cdot t}}\right)\right)\right) \]
      18. associate-/l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{\frac{\mathsf{neg}\left(a\right)}{t}}{z}}\right)\right)\right) \]
      19. clear-numN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{z}{\frac{\mathsf{neg}\left(a\right)}{t}}\right)\right)\right) \]
      20. distribute-frac-neg2N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{z}{\mathsf{neg}\left(\frac{\mathsf{neg}\left(a\right)}{t}\right)}\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(z, \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(a\right)}{t}\right)\right)\right)\right) \]
    9. Applied egg-rr75.2%

      \[\leadsto \color{blue}{-\frac{z}{\frac{a}{t}}} \]
    10. Step-by-step derivation
      1. associate-/r/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{z}{a} \cdot t\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(t \cdot \frac{z}{a}\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(t \cdot \frac{1}{\frac{a}{z}}\right)\right) \]
      4. un-div-invN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{t}{\frac{a}{z}}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(t, \left(\frac{a}{z}\right)\right)\right) \]
      6. /-lowering-/.f6473.9%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(t, \mathsf{/.f64}\left(a, z\right)\right)\right) \]
    11. Applied egg-rr73.9%

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

    if 2.0000000000000001e117 < (*.f64 x y)

    1. Initial program 83.6%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot y\right), \color{blue}{a}\right) \]
      2. *-lowering-*.f6478.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), a\right) \]
    5. Simplified78.3%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y}}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{1}{\frac{\frac{a}{x}}{\color{blue}{y}}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{1}{\frac{a}{x}} \cdot \color{blue}{y} \]
      4. clear-numN/A

        \[\leadsto \frac{x}{a} \cdot y \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{a}\right), \color{blue}{y}\right) \]
      6. /-lowering-/.f6489.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, a\right), y\right) \]
    7. Applied egg-rr89.6%

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

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

Alternative 4: 72.4% accurate, 0.4× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+90}:\\ \;\;\;\;\frac{x}{\frac{a\_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 10^{+38}:\\ \;\;\;\;0 - z \cdot \frac{t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= (* x y) -1e+90)
    (/ x (/ a_m y))
    (if (<= (* x y) 1e+38) (- 0.0 (* z (/ t a_m))) (* y (/ x a_m))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+90) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e+38) {
		tmp = 0.0 - (z * (t / a_m));
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if ((x * y) <= (-1d+90)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 1d+38) then
        tmp = 0.0d0 - (z * (t / a_m))
    else
        tmp = y * (x / a_m)
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((x * y) <= -1e+90) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 1e+38) {
		tmp = 0.0 - (z * (t / a_m));
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if (x * y) <= -1e+90:
		tmp = x / (a_m / y)
	elif (x * y) <= 1e+38:
		tmp = 0.0 - (z * (t / a_m))
	else:
		tmp = y * (x / a_m)
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (Float64(x * y) <= -1e+90)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 1e+38)
		tmp = Float64(0.0 - Float64(z * Float64(t / a_m)));
	else
		tmp = Float64(y * Float64(x / a_m));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if ((x * y) <= -1e+90)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 1e+38)
		tmp = 0.0 - (z * (t / a_m));
	else
		tmp = y * (x / a_m);
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+90], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+38], N[(0.0 - N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+90}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\

\mathbf{elif}\;x \cdot y \leq 10^{+38}:\\
\;\;\;\;0 - z \cdot \frac{t}{a\_m}\\

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


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

    1. Initial program 79.6%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot y\right), \color{blue}{a}\right) \]
      2. *-lowering-*.f6464.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), a\right) \]
    5. Simplified64.5%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y}}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{1}{\frac{\frac{a}{x}}{\color{blue}{y}}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{1}{\frac{a}{x}} \cdot \color{blue}{y} \]
      4. clear-numN/A

        \[\leadsto \frac{x}{a} \cdot y \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{a}\right), \color{blue}{y}\right) \]
      6. /-lowering-/.f6477.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, a\right), y\right) \]
    7. Applied egg-rr77.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      3. clear-numN/A

        \[\leadsto x \cdot \frac{1}{\color{blue}{\frac{a}{y}}} \]
      4. un-div-invN/A

        \[\leadsto \frac{x}{\color{blue}{\frac{a}{y}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{a}{y}\right)}\right) \]
      6. /-lowering-/.f6474.6%

        \[\leadsto \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(a, \color{blue}{y}\right)\right) \]
    9. Applied egg-rr74.6%

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

    if -9.99999999999999966e89 < (*.f64 x y) < 9.99999999999999977e37

    1. Initial program 92.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y - z \cdot t}}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{a}{x \cdot y - z \cdot t}\right)}\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \color{blue}{\left(x \cdot y - z \cdot t\right)}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\left(x \cdot y\right), \color{blue}{\left(z \cdot t\right)}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \left(\color{blue}{z} \cdot t\right)\right)\right)\right) \]
      6. *-lowering-*.f6492.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, y\right), \mathsf{*.f64}\left(z, \color{blue}{t}\right)\right)\right)\right) \]
    4. Applied egg-rr92.5%

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(-1 \cdot \frac{a}{t \cdot z}\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{a}{t \cdot z}\right)\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\mathsf{neg}\left(\frac{\frac{a}{t}}{z}\right)\right)\right) \]
      3. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\frac{a}{t}\right)}{\color{blue}{z}}\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{-1 \cdot \frac{a}{t}}{z}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-1 \cdot \frac{a}{t}\right), \color{blue}{z}\right)\right) \]
      6. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{-1 \cdot a}{t}\right), z\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-1 \cdot a\right), t\right), z\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\mathsf{neg}\left(a\right)\right), t\right), z\right)\right) \]
      9. neg-lowering-neg.f6477.8%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{neg.f64}\left(a\right), t\right), z\right)\right) \]
    7. Simplified77.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{-a}{t}}{z}}} \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{1}{\frac{\mathsf{neg}\left(a\right)}{\color{blue}{z \cdot t}}} \]
      2. neg-mul-1N/A

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

        \[\leadsto \frac{1}{\frac{-1}{z \cdot t} \cdot \color{blue}{a}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{-1}{t \cdot z} \cdot a} \]
      5. associate-/l/N/A

        \[\leadsto \frac{\frac{1}{a}}{\color{blue}{\frac{-1}{t \cdot z}}} \]
      6. div-invN/A

        \[\leadsto \frac{\frac{1}{a}}{-1 \cdot \color{blue}{\frac{1}{t \cdot z}}} \]
      7. mul-1-negN/A

        \[\leadsto \frac{\frac{1}{a}}{\mathsf{neg}\left(\frac{1}{t \cdot z}\right)} \]
      8. distribute-frac-neg2N/A

        \[\leadsto \mathsf{neg}\left(\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}\right) \]
      9. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\frac{1}{a}}{\frac{1}{t \cdot z}}\right)\right) \]
      10. frac-2negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{\mathsf{neg}\left(\frac{1}{t \cdot z}\right)}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{-1 \cdot \frac{1}{t \cdot z}}\right)\right) \]
      12. div-invN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{\mathsf{neg}\left(\frac{1}{a}\right)}{\frac{-1}{t \cdot z}}\right)\right) \]
      13. distribute-frac-negN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{\frac{1}{a}}{\frac{-1}{t \cdot z}}\right)\right)\right) \]
      14. associate-/l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1}{t \cdot z} \cdot a}\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1}{z \cdot t} \cdot a}\right)\right)\right) \]
      16. associate-*l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{-1 \cdot a}{z \cdot t}}\right)\right)\right) \]
      17. neg-mul-1N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{\mathsf{neg}\left(a\right)}{z \cdot t}}\right)\right)\right) \]
      18. associate-/l/N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{1}{\frac{\frac{\mathsf{neg}\left(a\right)}{t}}{z}}\right)\right)\right) \]
      19. clear-numN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\mathsf{neg}\left(\frac{z}{\frac{\mathsf{neg}\left(a\right)}{t}}\right)\right)\right) \]
      20. distribute-frac-neg2N/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{z}{\mathsf{neg}\left(\frac{\mathsf{neg}\left(a\right)}{t}\right)}\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(z, \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(a\right)}{t}\right)\right)\right)\right) \]
    9. Applied egg-rr77.8%

      \[\leadsto \color{blue}{-\frac{z}{\frac{a}{t}}} \]
    10. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(z \cdot \frac{1}{\frac{a}{t}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(z \cdot \frac{t}{a}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\frac{t}{a} \cdot z\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\left(\frac{t}{a}\right), z\right)\right) \]
      5. /-lowering-/.f6479.1%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(t, a\right), z\right)\right) \]
    11. Applied egg-rr79.1%

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

    if 9.99999999999999977e37 < (*.f64 x y)

    1. Initial program 85.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot y\right), \color{blue}{a}\right) \]
      2. *-lowering-*.f6473.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), a\right) \]
    5. Simplified73.5%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y}}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{1}{\frac{\frac{a}{x}}{\color{blue}{y}}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{1}{\frac{a}{x}} \cdot \color{blue}{y} \]
      4. clear-numN/A

        \[\leadsto \frac{x}{a} \cdot y \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{a}\right), \color{blue}{y}\right) \]
      6. /-lowering-/.f6479.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, a\right), y\right) \]
    7. Applied egg-rr79.1%

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

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

Alternative 5: 51.1% accurate, 1.8× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \left(y \cdot \frac{x}{a\_m}\right) \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* y (/ x a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (y * (x / a_m));
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    code = a_s * (y * (x / a_m))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (y * (x / a_m));
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
[x, y, z, t, a_m] = sort([x, y, z, t, a_m])
def code(a_s, x, y, z, t, a_m):
	return a_s * (y * (x / a_m))
a\_m = abs(a)
a\_s = copysign(1.0, a)
x, y, z, t, a_m = sort([x, y, z, t, a_m])
function code(a_s, x, y, z, t, a_m)
	return Float64(a_s * Float64(y * Float64(x / a_m)))
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp = code(a_s, x, y, z, t, a_m)
	tmp = a_s * (y * (x / a_m));
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(y \cdot \frac{x}{a\_m}\right)
\end{array}
Derivation
  1. Initial program 88.0%

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

    \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
  4. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(x \cdot y\right), \color{blue}{a}\right) \]
    2. *-lowering-*.f6445.7%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), a\right) \]
  5. Simplified45.7%

    \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
  6. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{x \cdot y}}} \]
    2. associate-/r*N/A

      \[\leadsto \frac{1}{\frac{\frac{a}{x}}{\color{blue}{y}}} \]
    3. associate-/r/N/A

      \[\leadsto \frac{1}{\frac{a}{x}} \cdot \color{blue}{y} \]
    4. clear-numN/A

      \[\leadsto \frac{x}{a} \cdot y \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{a}\right), \color{blue}{y}\right) \]
    6. /-lowering-/.f6448.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, a\right), y\right) \]
  7. Applied egg-rr48.9%

    \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
  8. Final simplification48.9%

    \[\leadsto y \cdot \frac{x}{a} \]
  9. Add Preprocessing

Developer Target 1: 91.5% 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 2024138 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))

  (/ (- (* x y) (* z t)) a))