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

Percentage Accurate: 91.5% → 96.5%
Time: 8.3s
Alternatives: 12
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 91.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: 96.5% accurate, 0.0× 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 := x \cdot y - z \cdot t\\ a_s \cdot \begin{array}{l} \mathbf{if}\;t_1 \leq -1 \cdot 10^{+270}:\\ \;\;\;\;\frac{x}{\sqrt{a_m}} \cdot \frac{y}{\sqrt{a_m}} - \frac{z}{\frac{a_m}{t}}\\ \mathbf{elif}\;t_1 \leq 10^{+304}:\\ \;\;\;\;\frac{t_1}{a_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{y}{t} - \frac{z}{x}}{\frac{a_m}{t}}\\ \end{array} \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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_s
    (if (<= t_1 -1e+270)
      (- (* (/ x (sqrt a_m)) (/ y (sqrt a_m))) (/ z (/ a_m t)))
      (if (<= t_1 1e+304)
        (/ t_1 a_m)
        (* x (/ (- (/ y t) (/ z x)) (/ a_m 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);
	double tmp;
	if (t_1 <= -1e+270) {
		tmp = ((x / sqrt(a_m)) * (y / sqrt(a_m))) - (z / (a_m / t));
	} else if (t_1 <= 1e+304) {
		tmp = t_1 / a_m;
	} else {
		tmp = x * (((y / t) - (z / x)) / (a_m / 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)
    if (t_1 <= (-1d+270)) then
        tmp = ((x / sqrt(a_m)) * (y / sqrt(a_m))) - (z / (a_m / t))
    else if (t_1 <= 1d+304) then
        tmp = t_1 / a_m
    else
        tmp = x * (((y / t) - (z / x)) / (a_m / 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);
	double tmp;
	if (t_1 <= -1e+270) {
		tmp = ((x / Math.sqrt(a_m)) * (y / Math.sqrt(a_m))) - (z / (a_m / t));
	} else if (t_1 <= 1e+304) {
		tmp = t_1 / a_m;
	} else {
		tmp = x * (((y / t) - (z / x)) / (a_m / 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)
	tmp = 0
	if t_1 <= -1e+270:
		tmp = ((x / math.sqrt(a_m)) * (y / math.sqrt(a_m))) - (z / (a_m / t))
	elif t_1 <= 1e+304:
		tmp = t_1 / a_m
	else:
		tmp = x * (((y / t) - (z / x)) / (a_m / 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(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_1 <= -1e+270)
		tmp = Float64(Float64(Float64(x / sqrt(a_m)) * Float64(y / sqrt(a_m))) - Float64(z / Float64(a_m / t)));
	elseif (t_1 <= 1e+304)
		tmp = Float64(t_1 / a_m);
	else
		tmp = Float64(x * Float64(Float64(Float64(y / t) - Float64(z / x)) / Float64(a_m / 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);
	tmp = 0.0;
	if (t_1 <= -1e+270)
		tmp = ((x / sqrt(a_m)) * (y / sqrt(a_m))) - (z / (a_m / t));
	elseif (t_1 <= 1e+304)
		tmp = t_1 / a_m;
	else
		tmp = x * (((y / t) - (z / x)) / (a_m / 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[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, -1e+270], N[(N[(N[(x / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] * N[(y / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+304], N[(t$95$1 / a$95$m), $MachinePrecision], N[(x * N[(N[(N[(y / t), $MachinePrecision] - N[(z / x), $MachinePrecision]), $MachinePrecision] / N[(a$95$m / 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 := x \cdot y - z \cdot t\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+270}:\\
\;\;\;\;\frac{x}{\sqrt{a_m}} \cdot \frac{y}{\sqrt{a_m}} - \frac{z}{\frac{a_m}{t}}\\

\mathbf{elif}\;t_1 \leq 10^{+304}:\\
\;\;\;\;\frac{t_1}{a_m}\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 96.6% accurate, 0.3× 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 := x \cdot y - z \cdot t\\ a_s \cdot \begin{array}{l} \mathbf{if}\;t_1 \leq -2 \cdot 10^{+297}:\\ \;\;\;\;\frac{x}{\frac{a_m}{y}} - \frac{z}{\frac{a_m}{t}}\\ \mathbf{elif}\;t_1 \leq 10^{+304}:\\ \;\;\;\;\frac{t_1}{a_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{y}{t} - \frac{z}{x}}{\frac{a_m}{t}}\\ \end{array} \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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_s
    (if (<= t_1 -2e+297)
      (- (/ x (/ a_m y)) (/ z (/ a_m t)))
      (if (<= t_1 1e+304)
        (/ t_1 a_m)
        (* x (/ (- (/ y t) (/ z x)) (/ a_m 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);
	double tmp;
	if (t_1 <= -2e+297) {
		tmp = (x / (a_m / y)) - (z / (a_m / t));
	} else if (t_1 <= 1e+304) {
		tmp = t_1 / a_m;
	} else {
		tmp = x * (((y / t) - (z / x)) / (a_m / 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)
    if (t_1 <= (-2d+297)) then
        tmp = (x / (a_m / y)) - (z / (a_m / t))
    else if (t_1 <= 1d+304) then
        tmp = t_1 / a_m
    else
        tmp = x * (((y / t) - (z / x)) / (a_m / 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);
	double tmp;
	if (t_1 <= -2e+297) {
		tmp = (x / (a_m / y)) - (z / (a_m / t));
	} else if (t_1 <= 1e+304) {
		tmp = t_1 / a_m;
	} else {
		tmp = x * (((y / t) - (z / x)) / (a_m / 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)
	tmp = 0
	if t_1 <= -2e+297:
		tmp = (x / (a_m / y)) - (z / (a_m / t))
	elif t_1 <= 1e+304:
		tmp = t_1 / a_m
	else:
		tmp = x * (((y / t) - (z / x)) / (a_m / 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(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_1 <= -2e+297)
		tmp = Float64(Float64(x / Float64(a_m / y)) - Float64(z / Float64(a_m / t)));
	elseif (t_1 <= 1e+304)
		tmp = Float64(t_1 / a_m);
	else
		tmp = Float64(x * Float64(Float64(Float64(y / t) - Float64(z / x)) / Float64(a_m / 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);
	tmp = 0.0;
	if (t_1 <= -2e+297)
		tmp = (x / (a_m / y)) - (z / (a_m / t));
	elseif (t_1 <= 1e+304)
		tmp = t_1 / a_m;
	else
		tmp = x * (((y / t) - (z / x)) / (a_m / 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[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, -2e+297], N[(N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+304], N[(t$95$1 / a$95$m), $MachinePrecision], N[(x * N[(N[(N[(y / t), $MachinePrecision] - N[(z / x), $MachinePrecision]), $MachinePrecision] / N[(a$95$m / 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 := x \cdot y - z \cdot t\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+297}:\\
\;\;\;\;\frac{x}{\frac{a_m}{y}} - \frac{z}{\frac{a_m}{t}}\\

\mathbf{elif}\;t_1 \leq 10^{+304}:\\
\;\;\;\;\frac{t_1}{a_m}\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 96.9% accurate, 0.3× 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 := x \cdot y - z \cdot t\\ a_s \cdot \begin{array}{l} \mathbf{if}\;t_1 \leq -2 \cdot 10^{+297} \lor \neg \left(t_1 \leq 5 \cdot 10^{+265}\right):\\ \;\;\;\;\frac{x}{\frac{a_m}{y}} - z \cdot \frac{t}{a_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{a_m}\\ \end{array} \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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_s
    (if (or (<= t_1 -2e+297) (not (<= t_1 5e+265)))
      (- (/ x (/ a_m y)) (* z (/ t a_m)))
      (/ t_1 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);
	double tmp;
	if ((t_1 <= -2e+297) || !(t_1 <= 5e+265)) {
		tmp = (x / (a_m / y)) - (z * (t / a_m));
	} else {
		tmp = t_1 / 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)
    if ((t_1 <= (-2d+297)) .or. (.not. (t_1 <= 5d+265))) then
        tmp = (x / (a_m / y)) - (z * (t / a_m))
    else
        tmp = t_1 / 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);
	double tmp;
	if ((t_1 <= -2e+297) || !(t_1 <= 5e+265)) {
		tmp = (x / (a_m / y)) - (z * (t / a_m));
	} else {
		tmp = t_1 / 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)
	tmp = 0
	if (t_1 <= -2e+297) or not (t_1 <= 5e+265):
		tmp = (x / (a_m / y)) - (z * (t / a_m))
	else:
		tmp = t_1 / 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(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= -2e+297) || !(t_1 <= 5e+265))
		tmp = Float64(Float64(x / Float64(a_m / y)) - Float64(z * Float64(t / a_m)));
	else
		tmp = Float64(t_1 / 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);
	tmp = 0.0;
	if ((t_1 <= -2e+297) || ~((t_1 <= 5e+265)))
		tmp = (x / (a_m / y)) - (z * (t / a_m));
	else
		tmp = t_1 / 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[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[Or[LessEqual[t$95$1, -2e+297], N[Not[LessEqual[t$95$1, 5e+265]], $MachinePrecision]], N[(N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / 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])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+297} \lor \neg \left(t_1 \leq 5 \cdot 10^{+265}\right):\\
\;\;\;\;\frac{x}{\frac{a_m}{y}} - z \cdot \frac{t}{a_m}\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 96.9% accurate, 0.3× 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}{\frac{a_m}{y}}\\ t_2 := x \cdot y - z \cdot t\\ a_s \cdot \begin{array}{l} \mathbf{if}\;t_2 \leq -2 \cdot 10^{+297}:\\ \;\;\;\;t_1 - \frac{z}{\frac{a_m}{t}}\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+265}:\\ \;\;\;\;\frac{t_2}{a_m}\\ \mathbf{else}:\\ \;\;\;\;t_1 - z \cdot \frac{t}{a_m}\\ \end{array} \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (/ a_m y))) (t_2 (- (* x y) (* z t))))
   (*
    a_s
    (if (<= t_2 -2e+297)
      (- t_1 (/ z (/ a_m t)))
      (if (<= t_2 5e+265) (/ t_2 a_m) (- t_1 (* 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 t_1 = x / (a_m / y);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -2e+297) {
		tmp = t_1 - (z / (a_m / t));
	} else if (t_2 <= 5e+265) {
		tmp = t_2 / a_m;
	} else {
		tmp = t_1 - (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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x / (a_m / y)
    t_2 = (x * y) - (z * t)
    if (t_2 <= (-2d+297)) then
        tmp = t_1 - (z / (a_m / t))
    else if (t_2 <= 5d+265) then
        tmp = t_2 / a_m
    else
        tmp = t_1 - (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 t_1 = x / (a_m / y);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -2e+297) {
		tmp = t_1 - (z / (a_m / t));
	} else if (t_2 <= 5e+265) {
		tmp = t_2 / a_m;
	} else {
		tmp = t_1 - (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):
	t_1 = x / (a_m / y)
	t_2 = (x * y) - (z * t)
	tmp = 0
	if t_2 <= -2e+297:
		tmp = t_1 - (z / (a_m / t))
	elif t_2 <= 5e+265:
		tmp = t_2 / a_m
	else:
		tmp = t_1 - (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)
	t_1 = Float64(x / Float64(a_m / y))
	t_2 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_2 <= -2e+297)
		tmp = Float64(t_1 - Float64(z / Float64(a_m / t)));
	elseif (t_2 <= 5e+265)
		tmp = Float64(t_2 / a_m);
	else
		tmp = Float64(t_1 - Float64(z * Float64(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)
	t_1 = x / (a_m / y);
	t_2 = (x * y) - (z * t);
	tmp = 0.0;
	if (t_2 <= -2e+297)
		tmp = t_1 - (z / (a_m / t));
	elseif (t_2 <= 5e+265)
		tmp = t_2 / a_m;
	else
		tmp = t_1 - (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_] := Block[{t$95$1 = N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$2, -2e+297], N[(t$95$1 - N[(z / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+265], N[(t$95$2 / a$95$m), $MachinePrecision], N[(t$95$1 - N[(z * N[(t / a$95$m), $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}{\frac{a_m}{y}}\\
t_2 := x \cdot y - z \cdot t\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;t_2 \leq -2 \cdot 10^{+297}:\\
\;\;\;\;t_1 - \frac{z}{\frac{a_m}{t}}\\

\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+265}:\\
\;\;\;\;\frac{t_2}{a_m}\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 72.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])\\ \\ \begin{array}{l} t_1 := \frac{-t}{\frac{a_m}{z}}\\ t_2 := y \cdot \frac{x}{a_m}\\ a_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+136}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-93}:\\ \;\;\;\;\frac{x \cdot y}{a_m}\\ \mathbf{elif}\;x \cdot y \leq 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (/ (- t) (/ a_m z))) (t_2 (* y (/ x a_m))))
   (*
    a_s
    (if (<= (* x y) -2e+136)
      t_2
      (if (<= (* x y) -5e+87)
        t_1
        (if (<= (* x y) -5e-93)
          (/ (* x y) a_m)
          (if (<= (* x y) 1e+14) t_1 t_2)))))))
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 = -t / (a_m / z);
	double t_2 = y * (x / a_m);
	double tmp;
	if ((x * y) <= -2e+136) {
		tmp = t_2;
	} else if ((x * y) <= -5e+87) {
		tmp = t_1;
	} else if ((x * y) <= -5e-93) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 1e+14) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = -t / (a_m / z)
    t_2 = y * (x / a_m)
    if ((x * y) <= (-2d+136)) then
        tmp = t_2
    else if ((x * y) <= (-5d+87)) then
        tmp = t_1
    else if ((x * y) <= (-5d-93)) then
        tmp = (x * y) / a_m
    else if ((x * y) <= 1d+14) then
        tmp = t_1
    else
        tmp = t_2
    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 = -t / (a_m / z);
	double t_2 = y * (x / a_m);
	double tmp;
	if ((x * y) <= -2e+136) {
		tmp = t_2;
	} else if ((x * y) <= -5e+87) {
		tmp = t_1;
	} else if ((x * y) <= -5e-93) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 1e+14) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = -t / (a_m / z)
	t_2 = y * (x / a_m)
	tmp = 0
	if (x * y) <= -2e+136:
		tmp = t_2
	elif (x * y) <= -5e+87:
		tmp = t_1
	elif (x * y) <= -5e-93:
		tmp = (x * y) / a_m
	elif (x * y) <= 1e+14:
		tmp = t_1
	else:
		tmp = t_2
	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(-t) / Float64(a_m / z))
	t_2 = Float64(y * Float64(x / a_m))
	tmp = 0.0
	if (Float64(x * y) <= -2e+136)
		tmp = t_2;
	elseif (Float64(x * y) <= -5e+87)
		tmp = t_1;
	elseif (Float64(x * y) <= -5e-93)
		tmp = Float64(Float64(x * y) / a_m);
	elseif (Float64(x * y) <= 1e+14)
		tmp = t_1;
	else
		tmp = t_2;
	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 = -t / (a_m / z);
	t_2 = y * (x / a_m);
	tmp = 0.0;
	if ((x * y) <= -2e+136)
		tmp = t_2;
	elseif ((x * y) <= -5e+87)
		tmp = t_1;
	elseif ((x * y) <= -5e-93)
		tmp = (x * y) / a_m;
	elseif ((x * y) <= 1e+14)
		tmp = t_1;
	else
		tmp = t_2;
	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[((-t) / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e+136], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -5e+87], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5e-93], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+14], t$95$1, t$95$2]]]]), $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{-t}{\frac{a_m}{z}}\\
t_2 := y \cdot \frac{x}{a_m}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+136}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+87}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-93}:\\
\;\;\;\;\frac{x \cdot y}{a_m}\\

\mathbf{elif}\;x \cdot y \leq 10^{+14}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 72.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])\\ \\ \begin{array}{l} t_1 := y \cdot \frac{x}{a_m}\\ a_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+87}:\\ \;\;\;\;\frac{-t}{\frac{a_m}{z}}\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-93}:\\ \;\;\;\;\frac{x \cdot y}{a_m}\\ \mathbf{elif}\;x \cdot y \leq 10^{+14}:\\ \;\;\;\;t \cdot \frac{-z}{a_m}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (* y (/ x a_m))))
   (*
    a_s
    (if (<= (* x y) -2e+136)
      t_1
      (if (<= (* x y) -5e+87)
        (/ (- t) (/ a_m z))
        (if (<= (* x y) -5e-93)
          (/ (* x y) a_m)
          (if (<= (* x y) 1e+14) (* t (/ (- z) 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 = y * (x / a_m);
	double tmp;
	if ((x * y) <= -2e+136) {
		tmp = t_1;
	} else if ((x * y) <= -5e+87) {
		tmp = -t / (a_m / z);
	} else if ((x * y) <= -5e-93) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 1e+14) {
		tmp = t * (-z / 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 = y * (x / a_m)
    if ((x * y) <= (-2d+136)) then
        tmp = t_1
    else if ((x * y) <= (-5d+87)) then
        tmp = -t / (a_m / z)
    else if ((x * y) <= (-5d-93)) then
        tmp = (x * y) / a_m
    else if ((x * y) <= 1d+14) then
        tmp = t * (-z / 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 = y * (x / a_m);
	double tmp;
	if ((x * y) <= -2e+136) {
		tmp = t_1;
	} else if ((x * y) <= -5e+87) {
		tmp = -t / (a_m / z);
	} else if ((x * y) <= -5e-93) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 1e+14) {
		tmp = t * (-z / 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 = y * (x / a_m)
	tmp = 0
	if (x * y) <= -2e+136:
		tmp = t_1
	elif (x * y) <= -5e+87:
		tmp = -t / (a_m / z)
	elif (x * y) <= -5e-93:
		tmp = (x * y) / a_m
	elif (x * y) <= 1e+14:
		tmp = t * (-z / 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(y * Float64(x / a_m))
	tmp = 0.0
	if (Float64(x * y) <= -2e+136)
		tmp = t_1;
	elseif (Float64(x * y) <= -5e+87)
		tmp = Float64(Float64(-t) / Float64(a_m / z));
	elseif (Float64(x * y) <= -5e-93)
		tmp = Float64(Float64(x * y) / a_m);
	elseif (Float64(x * y) <= 1e+14)
		tmp = Float64(t * Float64(Float64(-z) / 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 = y * (x / a_m);
	tmp = 0.0;
	if ((x * y) <= -2e+136)
		tmp = t_1;
	elseif ((x * y) <= -5e+87)
		tmp = -t / (a_m / z);
	elseif ((x * y) <= -5e-93)
		tmp = (x * y) / a_m;
	elseif ((x * y) <= 1e+14)
		tmp = t * (-z / 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[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e+136], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5e+87], N[((-t) / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-93], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+14], N[(t * N[((-z) / a$95$m), $MachinePrecision]), $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 := y \cdot \frac{x}{a_m}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+136}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-93}:\\
\;\;\;\;\frac{x \cdot y}{a_m}\\

\mathbf{elif}\;x \cdot y \leq 10^{+14}:\\
\;\;\;\;t \cdot \frac{-z}{a_m}\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 74.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])\\ \\ \begin{array}{l} t_1 := y \cdot \frac{x}{a_m}\\ a_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+87}:\\ \;\;\;\;\frac{-t}{\frac{a_m}{z}}\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-22}:\\ \;\;\;\;\frac{x \cdot y}{a_m}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a_m}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (* y (/ x a_m))))
   (*
    a_s
    (if (<= (* x y) -2e+136)
      t_1
      (if (<= (* x y) -5e+87)
        (/ (- t) (/ a_m z))
        (if (<= (* x y) -2e-22)
          (/ (* x y) a_m)
          (if (<= (* x y) 2e-5) (/ (* z (- t)) 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 = y * (x / a_m);
	double tmp;
	if ((x * y) <= -2e+136) {
		tmp = t_1;
	} else if ((x * y) <= -5e+87) {
		tmp = -t / (a_m / z);
	} else if ((x * y) <= -2e-22) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e-5) {
		tmp = (z * -t) / 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 = y * (x / a_m)
    if ((x * y) <= (-2d+136)) then
        tmp = t_1
    else if ((x * y) <= (-5d+87)) then
        tmp = -t / (a_m / z)
    else if ((x * y) <= (-2d-22)) then
        tmp = (x * y) / a_m
    else if ((x * y) <= 2d-5) then
        tmp = (z * -t) / 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 = y * (x / a_m);
	double tmp;
	if ((x * y) <= -2e+136) {
		tmp = t_1;
	} else if ((x * y) <= -5e+87) {
		tmp = -t / (a_m / z);
	} else if ((x * y) <= -2e-22) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e-5) {
		tmp = (z * -t) / 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 = y * (x / a_m)
	tmp = 0
	if (x * y) <= -2e+136:
		tmp = t_1
	elif (x * y) <= -5e+87:
		tmp = -t / (a_m / z)
	elif (x * y) <= -2e-22:
		tmp = (x * y) / a_m
	elif (x * y) <= 2e-5:
		tmp = (z * -t) / 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(y * Float64(x / a_m))
	tmp = 0.0
	if (Float64(x * y) <= -2e+136)
		tmp = t_1;
	elseif (Float64(x * y) <= -5e+87)
		tmp = Float64(Float64(-t) / Float64(a_m / z));
	elseif (Float64(x * y) <= -2e-22)
		tmp = Float64(Float64(x * y) / a_m);
	elseif (Float64(x * y) <= 2e-5)
		tmp = Float64(Float64(z * Float64(-t)) / 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 = y * (x / a_m);
	tmp = 0.0;
	if ((x * y) <= -2e+136)
		tmp = t_1;
	elseif ((x * y) <= -5e+87)
		tmp = -t / (a_m / z);
	elseif ((x * y) <= -2e-22)
		tmp = (x * y) / a_m;
	elseif ((x * y) <= 2e-5)
		tmp = (z * -t) / 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[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e+136], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5e+87], N[((-t) / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-22], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-5], N[(N[(z * (-t)), $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 := y \cdot \frac{x}{a_m}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+136}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-22}:\\
\;\;\;\;\frac{x \cdot y}{a_m}\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 74.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}\;x \cdot y \leq -2 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{x}{a_m}}{\frac{1}{y}}\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+87}:\\ \;\;\;\;\frac{-t}{\frac{a_m}{z}}\\ \mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-22}:\\ \;\;\;\;\frac{x \cdot y}{a_m}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{z \cdot \left(-t\right)}{a_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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) -2e+136)
    (/ (/ x a_m) (/ 1.0 y))
    (if (<= (* x y) -5e+87)
      (/ (- t) (/ a_m z))
      (if (<= (* x y) -2e-22)
        (/ (* x y) a_m)
        (if (<= (* x y) 2e-5) (/ (* 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) <= -2e+136) {
		tmp = (x / a_m) / (1.0 / y);
	} else if ((x * y) <= -5e+87) {
		tmp = -t / (a_m / z);
	} else if ((x * y) <= -2e-22) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e-5) {
		tmp = (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) <= (-2d+136)) then
        tmp = (x / a_m) / (1.0d0 / y)
    else if ((x * y) <= (-5d+87)) then
        tmp = -t / (a_m / z)
    else if ((x * y) <= (-2d-22)) then
        tmp = (x * y) / a_m
    else if ((x * y) <= 2d-5) then
        tmp = (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) <= -2e+136) {
		tmp = (x / a_m) / (1.0 / y);
	} else if ((x * y) <= -5e+87) {
		tmp = -t / (a_m / z);
	} else if ((x * y) <= -2e-22) {
		tmp = (x * y) / a_m;
	} else if ((x * y) <= 2e-5) {
		tmp = (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) <= -2e+136:
		tmp = (x / a_m) / (1.0 / y)
	elif (x * y) <= -5e+87:
		tmp = -t / (a_m / z)
	elif (x * y) <= -2e-22:
		tmp = (x * y) / a_m
	elif (x * y) <= 2e-5:
		tmp = (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) <= -2e+136)
		tmp = Float64(Float64(x / a_m) / Float64(1.0 / y));
	elseif (Float64(x * y) <= -5e+87)
		tmp = Float64(Float64(-t) / Float64(a_m / z));
	elseif (Float64(x * y) <= -2e-22)
		tmp = Float64(Float64(x * y) / a_m);
	elseif (Float64(x * y) <= 2e-5)
		tmp = Float64(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) <= -2e+136)
		tmp = (x / a_m) / (1.0 / y);
	elseif ((x * y) <= -5e+87)
		tmp = -t / (a_m / z);
	elseif ((x * y) <= -2e-22)
		tmp = (x * y) / a_m;
	elseif ((x * y) <= 2e-5)
		tmp = (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], -2e+136], N[(N[(x / a$95$m), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e+87], N[((-t) / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-22], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-5], N[(N[(z * (-t)), $MachinePrecision] / a$95$m), $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 -2 \cdot 10^{+136}:\\
\;\;\;\;\frac{\frac{x}{a_m}}{\frac{1}{y}}\\

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

\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-22}:\\
\;\;\;\;\frac{x \cdot y}{a_m}\\

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 9: 94.8% 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])\\ \\ a_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+297}:\\ \;\;\;\;\frac{x}{\frac{a_m}{y}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+230}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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) -2e+297)
    (/ x (/ a_m y))
    (if (<= (* x y) 5e+230) (/ (- (* x y) (* z t)) 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 * y) <= -2e+297) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 5e+230) {
		tmp = ((x * y) - (z * t)) / 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 * y) <= (-2d+297)) then
        tmp = x / (a_m / y)
    else if ((x * y) <= 5d+230) then
        tmp = ((x * y) - (z * t)) / 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 * y) <= -2e+297) {
		tmp = x / (a_m / y);
	} else if ((x * y) <= 5e+230) {
		tmp = ((x * y) - (z * t)) / 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 * y) <= -2e+297:
		tmp = x / (a_m / y)
	elif (x * y) <= 5e+230:
		tmp = ((x * y) - (z * t)) / 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 (Float64(x * y) <= -2e+297)
		tmp = Float64(x / Float64(a_m / y));
	elseif (Float64(x * y) <= 5e+230)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	else
		tmp = Float64(x * Float64(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 * y) <= -2e+297)
		tmp = x / (a_m / y);
	elseif ((x * y) <= 5e+230)
		tmp = ((x * y) - (z * t)) / 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[N[(x * y), $MachinePrecision], -2e+297], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+230], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+297}:\\
\;\;\;\;\frac{x}{\frac{a_m}{y}}\\

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 51.3% accurate, 1.3× 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}\;t \leq 1.1 \cdot 10^{-248}:\\ \;\;\;\;x \cdot \frac{y}{a_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (<= t 1.1e-248) (* x (/ y 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 (t <= 1.1e-248) {
		tmp = x * (y / 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 (t <= 1.1d-248) then
        tmp = x * (y / 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 (t <= 1.1e-248) {
		tmp = x * (y / 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 t <= 1.1e-248:
		tmp = x * (y / 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 (t <= 1.1e-248)
		tmp = Float64(x * Float64(y / 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 (t <= 1.1e-248)
		tmp = x * (y / 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[t, 1.1e-248], N[(x * N[(y / a$95$m), $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}\;t \leq 1.1 \cdot 10^{-248}:\\
\;\;\;\;x \cdot \frac{y}{a_m}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 51.3% accurate, 1.3× 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}\;t \leq 1.06 \cdot 10^{-209}:\\ \;\;\;\;\frac{x}{\frac{a_m}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a_m}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (<= t 1.06e-209) (/ x (/ a_m y)) (* 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 (t <= 1.06e-209) {
		tmp = x / (a_m / y);
	} 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 (t <= 1.06d-209) then
        tmp = x / (a_m / y)
    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 (t <= 1.06e-209) {
		tmp = x / (a_m / y);
	} 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 t <= 1.06e-209:
		tmp = x / (a_m / y)
	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 (t <= 1.06e-209)
		tmp = Float64(x / Float64(a_m / y));
	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 (t <= 1.06e-209)
		tmp = x / (a_m / y);
	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[t, 1.06e-209], N[(x / N[(a$95$m / y), $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}\;t \leq 1.06 \cdot 10^{-209}:\\
\;\;\;\;\frac{x}{\frac{a_m}{y}}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 12: 51.0% 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 1 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
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Developer target: 91.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
   (if (< z -2.468684968699548e+170)
     t_1
     (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = ((y / a) * x) - ((t / a) * z);
	double tmp;
	if (z < -2.468684968699548e+170) {
		tmp = t_1;
	} else if (z < 6.309831121978371e-71) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = ((y / a) * x) - ((t / a) * z)
    if (z < (-2.468684968699548d+170)) then
        tmp = t_1
    else if (z < 6.309831121978371d-71) then
        tmp = ((x * y) - (z * t)) / a
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = ((y / a) * x) - ((t / a) * z);
	double tmp;
	if (z < -2.468684968699548e+170) {
		tmp = t_1;
	} else if (z < 6.309831121978371e-71) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = ((y / a) * x) - ((t / a) * z)
	tmp = 0
	if z < -2.468684968699548e+170:
		tmp = t_1
	elif z < 6.309831121978371e-71:
		tmp = ((x * y) - (z * t)) / a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z))
	tmp = 0.0
	if (z < -2.468684968699548e+170)
		tmp = t_1;
	elseif (z < 6.309831121978371e-71)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = ((y / a) * x) - ((t / a) * z);
	tmp = 0.0;
	if (z < -2.468684968699548e+170)
		tmp = t_1;
	elseif (z < 6.309831121978371e-71)
		tmp = ((x * y) - (z * t)) / a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023347 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :herbie-target
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

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