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

Percentage Accurate: 91.8% → 93.6%
Time: 11.5s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 91.8% accurate, 1.0× speedup?

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

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

Alternative 1: 93.6% 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])\\ \\ \begin{array}{l} t_1 := \frac{x \cdot y - z \cdot t}{a\_m}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 2 \cdot 10^{+296}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{a\_m}{\frac{x \cdot y}{z} - t}}\\ \end{array} \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
 (let* ((t_1 (/ (- (* x y) (* z t)) a_m)))
   (* a_s (if (<= t_1 2e+296) t_1 (/ z (/ a_m (- (/ (* x y) z) t)))))))
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 t_1 = ((x * y) - (z * t)) / a_m;
	double tmp;
	if (t_1 <= 2e+296) {
		tmp = t_1;
	} else {
		tmp = z / (a_m / (((x * y) / z) - t));
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = ((x * y) - (z * t)) / a_m
    if (t_1 <= 2d+296) then
        tmp = t_1
    else
        tmp = z / (a_m / (((x * y) / z) - t))
    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 t_1 = ((x * y) - (z * t)) / a_m;
	double tmp;
	if (t_1 <= 2e+296) {
		tmp = t_1;
	} else {
		tmp = z / (a_m / (((x * y) / z) - t));
	}
	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):
	t_1 = ((x * y) - (z * t)) / a_m
	tmp = 0
	if t_1 <= 2e+296:
		tmp = t_1
	else:
		tmp = z / (a_m / (((x * y) / z) - t))
	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)
	t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m)
	tmp = 0.0
	if (t_1 <= 2e+296)
		tmp = t_1;
	else
		tmp = Float64(z / Float64(a_m / Float64(Float64(Float64(x * y) / z) - t)));
	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)
	t_1 = ((x * y) - (z * t)) / a_m;
	tmp = 0.0;
	if (t_1 <= 2e+296)
		tmp = t_1;
	else
		tmp = z / (a_m / (((x * y) / z) - t));
	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_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 2e+296], t$95$1, N[(z / N[(a$95$m / N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $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])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 97.0%

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

    if 1.99999999999999996e296 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a)

    1. Initial program 74.0%

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(x \cdot y\right), z\right), t\right)\right), a\right) \]
      4. *-lowering-*.f6474.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), z\right), t\right)\right), a\right) \]
    5. Simplified74.2%

      \[\leadsto \frac{\color{blue}{z \cdot \left(\frac{x \cdot y}{z} - t\right)}}{a} \]
    6. Step-by-step derivation
      1. associate-/l*N/A

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(x \cdot y\right), z\right), t\right), a\right), z\right) \]
      7. *-lowering-*.f6482.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), z\right), t\right), a\right), z\right) \]
    7. Applied egg-rr82.3%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(x \cdot y\right), z\right), t\right)\right)\right) \]
      8. *-lowering-*.f6482.4%

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

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

Alternative 2: 93.3% 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])\\ \\ \begin{array}{l} t_1 := \frac{x \cdot y - z \cdot t}{a\_m}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 2 \cdot 10^{+288}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot y}{z} - t\right) \cdot \frac{z}{a\_m}\\ \end{array} \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
 (let* ((t_1 (/ (- (* x y) (* z t)) a_m)))
   (* a_s (if (<= t_1 2e+288) t_1 (* (- (/ (* x y) z) t) (/ z 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 t_1 = ((x * y) - (z * t)) / a_m;
	double tmp;
	if (t_1 <= 2e+288) {
		tmp = t_1;
	} else {
		tmp = (((x * y) / z) - t) * (z / 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) :: t_1
    real(8) :: tmp
    t_1 = ((x * y) - (z * t)) / a_m
    if (t_1 <= 2d+288) then
        tmp = t_1
    else
        tmp = (((x * y) / z) - t) * (z / 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 t_1 = ((x * y) - (z * t)) / a_m;
	double tmp;
	if (t_1 <= 2e+288) {
		tmp = t_1;
	} else {
		tmp = (((x * y) / z) - t) * (z / 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):
	t_1 = ((x * y) - (z * t)) / a_m
	tmp = 0
	if t_1 <= 2e+288:
		tmp = t_1
	else:
		tmp = (((x * y) / z) - t) * (z / 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)
	t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m)
	tmp = 0.0
	if (t_1 <= 2e+288)
		tmp = t_1;
	else
		tmp = Float64(Float64(Float64(Float64(x * y) / z) - t) * Float64(z / 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)
	t_1 = ((x * y) - (z * t)) / a_m;
	tmp = 0.0;
	if (t_1 <= 2e+288)
		tmp = t_1;
	else
		tmp = (((x * y) / z) - t) * (z / 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_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 2e+288], t$95$1, N[(N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $MachinePrecision] * N[(z / 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])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+288}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 97.0%

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

    if 2e288 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a)

    1. Initial program 74.0%

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(x \cdot y\right), z\right), t\right)\right), a\right) \]
      4. *-lowering-*.f6474.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(z, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), z\right), t\right)\right), a\right) \]
    5. Simplified74.2%

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

        \[\leadsto \frac{\left(\frac{x \cdot y}{z} - t\right) \cdot z}{a} \]
      2. associate-/l*N/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, y\right), z\right), t\right), \left(\frac{z}{a}\right)\right) \]
      7. /-lowering-/.f6484.3%

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

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

Alternative 3: 73.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}\;z \cdot t \leq -1 \cdot 10^{-68}:\\ \;\;\;\;\frac{z}{a\_m} \cdot \left(0 - t\right)\\ \mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-35}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{z \cdot t}{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 (<= (* z t) -1e-68)
    (* (/ z a_m) (- 0.0 t))
    (if (<= (* z t) 5e-35) (/ (* x y) a_m) (- 0.0 (/ (* z t) 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 ((z * t) <= -1e-68) {
		tmp = (z / a_m) * (0.0 - t);
	} else if ((z * t) <= 5e-35) {
		tmp = (x * y) / a_m;
	} else {
		tmp = 0.0 - ((z * t) / 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 ((z * t) <= (-1d-68)) then
        tmp = (z / a_m) * (0.0d0 - t)
    else if ((z * t) <= 5d-35) then
        tmp = (x * y) / a_m
    else
        tmp = 0.0d0 - ((z * t) / 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 ((z * t) <= -1e-68) {
		tmp = (z / a_m) * (0.0 - t);
	} else if ((z * t) <= 5e-35) {
		tmp = (x * y) / a_m;
	} else {
		tmp = 0.0 - ((z * t) / 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 (z * t) <= -1e-68:
		tmp = (z / a_m) * (0.0 - t)
	elif (z * t) <= 5e-35:
		tmp = (x * y) / a_m
	else:
		tmp = 0.0 - ((z * t) / 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(z * t) <= -1e-68)
		tmp = Float64(Float64(z / a_m) * Float64(0.0 - t));
	elseif (Float64(z * t) <= 5e-35)
		tmp = Float64(Float64(x * y) / a_m);
	else
		tmp = Float64(0.0 - Float64(Float64(z * t) / 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 ((z * t) <= -1e-68)
		tmp = (z / a_m) * (0.0 - t);
	elseif ((z * t) <= 5e-35)
		tmp = (x * y) / a_m;
	else
		tmp = 0.0 - ((z * t) / 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[(z * t), $MachinePrecision], -1e-68], N[(N[(z / a$95$m), $MachinePrecision] * N[(0.0 - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-35], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], N[(0.0 - N[(N[(z * t), $MachinePrecision] / 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}\;z \cdot t \leq -1 \cdot 10^{-68}:\\
\;\;\;\;\frac{z}{a\_m} \cdot \left(0 - t\right)\\

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

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


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

    1. Initial program 86.2%

      \[\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-*.f6486.1%

        \[\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-rr86.1%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(0, \color{blue}{\left(t \cdot z\right)}\right)\right) \]
      4. *-lowering-*.f6461.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    7. Simplified61.2%

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(0 - t \cdot z\right)} \]
    8. Step-by-step derivation
      1. sub0-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(z \cdot t\right), a\right)\right) \]
      8. *-lowering-*.f6461.2%

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

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

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

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

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

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

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

    if -1.00000000000000007e-68 < (*.f64 z t) < 4.99999999999999964e-35

    1. Initial program 97.4%

      \[\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-*.f6488.3%

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

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

    if 4.99999999999999964e-35 < (*.f64 z t)

    1. Initial program 90.2%

      \[\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-*.f6490.2%

        \[\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-rr90.2%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(0, \color{blue}{\left(t \cdot z\right)}\right)\right) \]
      4. *-lowering-*.f6480.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    7. Simplified80.8%

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(0 - t \cdot z\right)} \]
    8. Step-by-step derivation
      1. sub0-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(\left(z \cdot t\right), a\right)\right) \]
      8. *-lowering-*.f6480.8%

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

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

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

Alternative 4: 68.9% accurate, 0.5× 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])\\ \\ \begin{array}{l} t_1 := \frac{z}{a\_m} \cdot \left(0 - t\right)\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{+107}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-145}:\\ \;\;\;\;\frac{x \cdot y}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \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
 (let* ((t_1 (* (/ z a_m) (- 0.0 t))))
   (* a_s (if (<= z -3.4e+107) t_1 (if (<= z 1.6e-145) (/ (* x y) a_m) t_1)))))
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 t_1 = (z / a_m) * (0.0 - t);
	double tmp;
	if (z <= -3.4e+107) {
		tmp = t_1;
	} else if (z <= 1.6e-145) {
		tmp = (x * y) / a_m;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = (z / a_m) * (0.0d0 - t)
    if (z <= (-3.4d+107)) then
        tmp = t_1
    else if (z <= 1.6d-145) then
        tmp = (x * y) / a_m
    else
        tmp = t_1
    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 t_1 = (z / a_m) * (0.0 - t);
	double tmp;
	if (z <= -3.4e+107) {
		tmp = t_1;
	} else if (z <= 1.6e-145) {
		tmp = (x * y) / a_m;
	} else {
		tmp = t_1;
	}
	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):
	t_1 = (z / a_m) * (0.0 - t)
	tmp = 0
	if z <= -3.4e+107:
		tmp = t_1
	elif z <= 1.6e-145:
		tmp = (x * y) / a_m
	else:
		tmp = t_1
	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)
	t_1 = Float64(Float64(z / a_m) * Float64(0.0 - t))
	tmp = 0.0
	if (z <= -3.4e+107)
		tmp = t_1;
	elseif (z <= 1.6e-145)
		tmp = Float64(Float64(x * y) / a_m);
	else
		tmp = t_1;
	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)
	t_1 = (z / a_m) * (0.0 - t);
	tmp = 0.0;
	if (z <= -3.4e+107)
		tmp = t_1;
	elseif (z <= 1.6e-145)
		tmp = (x * y) / a_m;
	else
		tmp = t_1;
	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_] := Block[{t$95$1 = N[(N[(z / a$95$m), $MachinePrecision] * N[(0.0 - t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[z, -3.4e+107], t$95$1, If[LessEqual[z, 1.6e-145], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], t$95$1]]), $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])\\
\\
\begin{array}{l}
t_1 := \frac{z}{a\_m} \cdot \left(0 - t\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+107}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.6 \cdot 10^{-145}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.3999999999999997e107 or 1.60000000000000004e-145 < z

    1. Initial program 86.7%

      \[\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-*.f6486.6%

        \[\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-rr86.6%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(0, \color{blue}{\left(t \cdot z\right)}\right)\right) \]
      4. *-lowering-*.f6458.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    7. Simplified58.1%

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(0 - t \cdot z\right)} \]
    8. Step-by-step derivation
      1. sub0-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.3999999999999997e107 < z < 1.60000000000000004e-145

    1. Initial program 97.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-*.f6472.2%

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

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

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

Alternative 5: 93.5% 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}\;z \cdot t \leq -1 \cdot 10^{+234}:\\ \;\;\;\;0 - \frac{z}{\frac{a\_m}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{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 (<= (* z t) -1e+234)
    (- 0.0 (/ z (/ a_m t)))
    (/ (- (* x y) (* z t)) 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 ((z * t) <= -1e+234) {
		tmp = 0.0 - (z / (a_m / t));
	} else {
		tmp = ((x * y) - (z * t)) / 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 ((z * t) <= (-1d+234)) then
        tmp = 0.0d0 - (z / (a_m / t))
    else
        tmp = ((x * y) - (z * t)) / 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 ((z * t) <= -1e+234) {
		tmp = 0.0 - (z / (a_m / t));
	} else {
		tmp = ((x * y) - (z * t)) / 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 (z * t) <= -1e+234:
		tmp = 0.0 - (z / (a_m / t))
	else:
		tmp = ((x * y) - (z * t)) / 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(z * t) <= -1e+234)
		tmp = Float64(0.0 - Float64(z / Float64(a_m / t)));
	else
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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 ((z * t) <= -1e+234)
		tmp = 0.0 - (z / (a_m / t));
	else
		tmp = ((x * y) - (z * t)) / 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[(z * t), $MachinePrecision], -1e+234], N[(0.0 - N[(z / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $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 -1 \cdot 10^{+234}:\\
\;\;\;\;0 - \frac{z}{\frac{a\_m}{t}}\\

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


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

    1. Initial program 58.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. 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-*.f6458.6%

        \[\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-rr58.6%

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, a\right), \mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    7. Simplified58.6%

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(0 - t \cdot z\right)} \]
    8. Step-by-step derivation
      1. sub0-negN/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{z \cdot t}{a}} \]
    10. Step-by-step derivation
      1. distribute-neg-fracN/A

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

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

        \[\leadsto \frac{z \cdot \left(0 - t\right)}{a} \]
      4. associate-*r/N/A

        \[\leadsto z \cdot \color{blue}{\frac{0 - t}{a}} \]
      5. clear-numN/A

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

        \[\leadsto \frac{z}{\color{blue}{\frac{a}{0 - t}}} \]
      7. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(a, \color{blue}{\left(0 - t\right)}\right)\right) \]
      9. --lowering--.f6499.9%

        \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(0, \color{blue}{t}\right)\right)\right) \]
    11. Applied egg-rr99.9%

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

    if -1.00000000000000002e234 < (*.f64 z t)

    1. Initial program 94.9%

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

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

Alternative 6: 51.9% accurate, 0.9× 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 \leq -6 \cdot 10^{+54}:\\ \;\;\;\;x \cdot \frac{y}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{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 -6e+54) (* x (/ y a_m)) (/ (* x y) 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 <= -6e+54) {
		tmp = x * (y / a_m);
	} else {
		tmp = (x * y) / 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 <= (-6d+54)) then
        tmp = x * (y / a_m)
    else
        tmp = (x * y) / 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 <= -6e+54) {
		tmp = x * (y / a_m);
	} else {
		tmp = (x * y) / 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 <= -6e+54:
		tmp = x * (y / a_m)
	else:
		tmp = (x * y) / 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 (x <= -6e+54)
		tmp = Float64(x * Float64(y / a_m));
	else
		tmp = Float64(Float64(x * y) / 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 <= -6e+54)
		tmp = x * (y / a_m);
	else
		tmp = (x * y) / 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[x, -6e+54], N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a$95$m), $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 \leq -6 \cdot 10^{+54}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.9999999999999998e54

    1. Initial program 86.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-*.f6467.1%

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

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

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

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

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

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

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

    if -5.9999999999999998e54 < x

    1. Initial program 94.5%

      \[\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-*.f6453.5%

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

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

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

Alternative 7: 51.4% 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(x \cdot \frac{y}{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 (* x (/ y 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 * (x * (y / 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 * (x * (y / 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 * (x * (y / 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 * (x * (y / 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(x * Float64(y / 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 * (x * (y / 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[(x * N[(y / 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(x \cdot \frac{y}{a\_m}\right)
\end{array}
Derivation
  1. Initial program 92.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-*.f6456.5%

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

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

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

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

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

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

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

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

Alternative 8: 51.7% 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 92.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-*.f6456.5%

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

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

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

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

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

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

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

Developer Target 1: 92.0% 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 2024161 
(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))