Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I

Percentage Accurate: 90.8% → 93.9%
Time: 14.2s
Alternatives: 11
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
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 * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a):
	return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a)
	return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0))
end
function tmp = code(x, y, z, t, a)
	tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\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 11 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: 90.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
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 * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a):
	return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a)
	return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0))
end
function tmp = code(x, y, z, t, a)
	tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}

Alternative 1: 93.9% accurate, 0.1× 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;a\_m \cdot 2 \leq 4 \cdot 10^{+124}:\\ \;\;\;\;\frac{0.5}{\frac{a\_m}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a\_m \cdot 2} - \left(z \cdot 9\right) \cdot \frac{t}{a\_m \cdot 2}\\ \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.
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= (* a_m 2.0) 4e+124)
    (/ 0.5 (/ a_m (fma t (* z -9.0) (* x y))))
    (- (* x (/ y (* a_m 2.0))) (* (* z 9.0) (/ t (* a_m 2.0)))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((a_m * 2.0) <= 4e+124) {
		tmp = 0.5 / (a_m / fma(t, (z * -9.0), (x * y)));
	} else {
		tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
	}
	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])
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(a_m * 2.0) <= 4e+124)
		tmp = Float64(0.5 / Float64(a_m / fma(t, Float64(z * -9.0), Float64(x * y))));
	else
		tmp = Float64(Float64(x * Float64(y / Float64(a_m * 2.0))) - Float64(Float64(z * 9.0) * Float64(t / Float64(a_m * 2.0))));
	end
	return Float64(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.
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[(a$95$m * 2.0), $MachinePrecision], 4e+124], N[(0.5 / N[(a$95$m / N[(t * N[(z * -9.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(t / N[(a$95$m * 2.0), $MachinePrecision]), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \cdot 2 \leq 4 \cdot 10^{+124}:\\
\;\;\;\;\frac{0.5}{\frac{a\_m}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a 2) < 3.99999999999999979e124

    1. Initial program 88.8%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num88.7%

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

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}^{-1}} \]
      3. *-commutative88.7%

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

        \[\leadsto {\color{blue}{\left(2 \cdot \frac{a}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}}^{-1} \]
      5. fma-neg88.7%

        \[\leadsto {\left(2 \cdot \frac{a}{\color{blue}{\mathsf{fma}\left(x, y, -\left(z \cdot 9\right) \cdot t\right)}}\right)}^{-1} \]
      6. *-commutative88.7%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, -\color{blue}{t \cdot \left(z \cdot 9\right)}\right)}\right)}^{-1} \]
      7. distribute-rgt-neg-in88.7%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, \color{blue}{t \cdot \left(-z \cdot 9\right)}\right)}\right)}^{-1} \]
      8. distribute-rgt-neg-in88.7%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \color{blue}{\left(z \cdot \left(-9\right)\right)}\right)}\right)}^{-1} \]
      9. metadata-eval88.7%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot \color{blue}{-9}\right)\right)}\right)}^{-1} \]
    4. Applied egg-rr88.7%

      \[\leadsto \color{blue}{{\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-188.7%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}}} \]
      3. metadata-eval88.7%

        \[\leadsto \frac{\color{blue}{0.5}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}} \]
      4. fma-define88.7%

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

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

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

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

    if 3.99999999999999979e124 < (*.f64 a 2)

    1. Initial program 69.7%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub69.7%

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

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

        \[\leadsto x \cdot \frac{y}{a \cdot 2} - \color{blue}{\left(z \cdot 9\right) \cdot \frac{t}{a \cdot 2}} \]
    4. Applied egg-rr86.3%

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

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

Alternative 2: 93.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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ \begin{array}{l} t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+291} \lor \neg \left(t\_1 \leq \infty\right):\\ \;\;\;\;x \cdot \frac{y}{a\_m \cdot 2} - \left(z \cdot 9\right) \cdot \frac{t}{a\_m \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{a\_m \cdot 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.
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) (* t (* z 9.0)))))
   (*
    a_s
    (if (or (<= t_1 -5e+291) (not (<= t_1 INFINITY)))
      (- (* x (/ y (* a_m 2.0))) (* (* z 9.0) (/ t (* a_m 2.0))))
      (/ t_1 (* a_m 2.0))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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) - (t * (z * 9.0));
	double tmp;
	if ((t_1 <= -5e+291) || !(t_1 <= ((double) INFINITY))) {
		tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
	} else {
		tmp = t_1 / (a_m * 2.0);
	}
	return a_s * tmp;
}
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
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) - (t * (z * 9.0));
	double tmp;
	if ((t_1 <= -5e+291) || !(t_1 <= Double.POSITIVE_INFINITY)) {
		tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
	} else {
		tmp = t_1 / (a_m * 2.0);
	}
	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])
[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) - (t * (z * 9.0))
	tmp = 0
	if (t_1 <= -5e+291) or not (t_1 <= math.inf):
		tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)))
	else:
		tmp = t_1 / (a_m * 2.0)
	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])
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(t * Float64(z * 9.0)))
	tmp = 0.0
	if ((t_1 <= -5e+291) || !(t_1 <= Inf))
		tmp = Float64(Float64(x * Float64(y / Float64(a_m * 2.0))) - Float64(Float64(z * 9.0) * Float64(t / Float64(a_m * 2.0))));
	else
		tmp = Float64(t_1 / Float64(a_m * 2.0));
	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])){:}
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) - (t * (z * 9.0));
	tmp = 0.0;
	if ((t_1 <= -5e+291) || ~((t_1 <= Inf)))
		tmp = (x * (y / (a_m * 2.0))) - ((z * 9.0) * (t / (a_m * 2.0)));
	else
		tmp = t_1 / (a_m * 2.0);
	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.
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[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[Or[LessEqual[t$95$1, -5e+291], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(N[(x * N[(y / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(t / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(a$95$m * 2.0), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+291} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;x \cdot \frac{y}{a\_m \cdot 2} - \left(z \cdot 9\right) \cdot \frac{t}{a\_m \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a\_m \cdot 2}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -5.0000000000000001e291 or +inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))

    1. Initial program 56.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub50.0%

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

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

        \[\leadsto x \cdot \frac{y}{a \cdot 2} - \color{blue}{\left(z \cdot 9\right) \cdot \frac{t}{a \cdot 2}} \]
    4. Applied egg-rr84.7%

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

    if -5.0000000000000001e291 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < +inf.0

    1. Initial program 92.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification91.0%

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

Alternative 3: 72.4% 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ \begin{array}{l} t_1 := x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\ t_2 := \frac{x \cdot y}{a\_m \cdot 2}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\ \;\;\;\;z \cdot \frac{-4.5}{\frac{a\_m}{t}}\\ \mathbf{elif}\;x \cdot y \leq -200000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\ \;\;\;\;t\_2\\ \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.
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 (* 0.5 (/ y a_m)))) (t_2 (/ (* x y) (* a_m 2.0))))
   (*
    a_s
    (if (<= (* x y) -2e+94)
      t_1
      (if (<= (* x y) -1e+57)
        (* z (/ -4.5 (/ a_m t)))
        (if (<= (* x y) -200000000000.0)
          t_2
          (if (<= (* x y) 2e-124)
            (* t (/ -4.5 (/ a_m z)))
            (if (<= (* x y) 5e+240) t_2 t_1))))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * (0.5 * (y / a_m));
	double t_2 = (x * y) / (a_m * 2.0);
	double tmp;
	if ((x * y) <= -2e+94) {
		tmp = t_1;
	} else if ((x * y) <= -1e+57) {
		tmp = z * (-4.5 / (a_m / t));
	} else if ((x * y) <= -200000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 2e-124) {
		tmp = t * (-4.5 / (a_m / z));
	} else if ((x * y) <= 5e+240) {
		tmp = t_2;
	} 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.
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 * (0.5d0 * (y / a_m))
    t_2 = (x * y) / (a_m * 2.0d0)
    if ((x * y) <= (-2d+94)) then
        tmp = t_1
    else if ((x * y) <= (-1d+57)) then
        tmp = z * ((-4.5d0) / (a_m / t))
    else if ((x * y) <= (-200000000000.0d0)) then
        tmp = t_2
    else if ((x * y) <= 2d-124) then
        tmp = t * ((-4.5d0) / (a_m / z))
    else if ((x * y) <= 5d+240) then
        tmp = t_2
    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;
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 * (0.5 * (y / a_m));
	double t_2 = (x * y) / (a_m * 2.0);
	double tmp;
	if ((x * y) <= -2e+94) {
		tmp = t_1;
	} else if ((x * y) <= -1e+57) {
		tmp = z * (-4.5 / (a_m / t));
	} else if ((x * y) <= -200000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 2e-124) {
		tmp = t * (-4.5 / (a_m / z));
	} else if ((x * y) <= 5e+240) {
		tmp = t_2;
	} 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])
[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 * (0.5 * (y / a_m))
	t_2 = (x * y) / (a_m * 2.0)
	tmp = 0
	if (x * y) <= -2e+94:
		tmp = t_1
	elif (x * y) <= -1e+57:
		tmp = z * (-4.5 / (a_m / t))
	elif (x * y) <= -200000000000.0:
		tmp = t_2
	elif (x * y) <= 2e-124:
		tmp = t * (-4.5 / (a_m / z))
	elif (x * y) <= 5e+240:
		tmp = t_2
	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])
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(0.5 * Float64(y / a_m)))
	t_2 = Float64(Float64(x * y) / Float64(a_m * 2.0))
	tmp = 0.0
	if (Float64(x * y) <= -2e+94)
		tmp = t_1;
	elseif (Float64(x * y) <= -1e+57)
		tmp = Float64(z * Float64(-4.5 / Float64(a_m / t)));
	elseif (Float64(x * y) <= -200000000000.0)
		tmp = t_2;
	elseif (Float64(x * y) <= 2e-124)
		tmp = Float64(t * Float64(-4.5 / Float64(a_m / z)));
	elseif (Float64(x * y) <= 5e+240)
		tmp = t_2;
	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])){:}
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 * (0.5 * (y / a_m));
	t_2 = (x * y) / (a_m * 2.0);
	tmp = 0.0;
	if ((x * y) <= -2e+94)
		tmp = t_1;
	elseif ((x * y) <= -1e+57)
		tmp = z * (-4.5 / (a_m / t));
	elseif ((x * y) <= -200000000000.0)
		tmp = t_2;
	elseif ((x * y) <= 2e-124)
		tmp = t * (-4.5 / (a_m / z));
	elseif ((x * y) <= 5e+240)
		tmp = t_2;
	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.
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[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e+94], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1e+57], N[(z * N[(-4.5 / N[(a$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -200000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2e-124], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+240], t$95$2, 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\
t_2 := \frac{x \cdot y}{a\_m \cdot 2}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \cdot y \leq -200000000000:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2e94 or 5.0000000000000003e240 < (*.f64 x y)

    1. Initial program 72.8%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 72.9%

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. *-commutative72.9%

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{a} \cdot 0.5\right)} \]
    5. Simplified93.4%

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

    if -2e94 < (*.f64 x y) < -1.00000000000000005e57

    1. Initial program 82.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 73.4%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. associate-/l*82.4%

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

      \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
    6. Step-by-step derivation
      1. *-commutative82.4%

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

        \[\leadsto \color{blue}{\frac{t \cdot z}{a}} \cdot -4.5 \]
      3. metadata-eval73.4%

        \[\leadsto \frac{t \cdot z}{a} \cdot \color{blue}{\frac{-9}{2}} \]
      4. times-frac73.3%

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

        \[\leadsto \frac{\color{blue}{t \cdot \left(z \cdot -9\right)}}{a \cdot 2} \]
      6. *-commutative64.9%

        \[\leadsto \frac{t \cdot \color{blue}{\left(-9 \cdot z\right)}}{a \cdot 2} \]
      7. associate-*l*73.6%

        \[\leadsto \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a \cdot 2} \]
      8. clear-num73.7%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\color{blue}{t \cdot \left(-9 \cdot z\right)}}} \]
      10. *-commutative64.9%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\color{blue}{\left(t \cdot z\right) \cdot -9}}} \]
      12. times-frac73.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{t \cdot z} \cdot \frac{2}{-9}}} \]
      13. metadata-eval73.3%

        \[\leadsto \frac{1}{\frac{a}{t \cdot z} \cdot \color{blue}{-0.2222222222222222}} \]
    7. Applied egg-rr73.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{t \cdot z} \cdot -0.2222222222222222}} \]
    8. Step-by-step derivation
      1. *-commutative73.3%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{-0.2222222222222222}}{\frac{a}{t \cdot z}}} \]
      3. metadata-eval73.3%

        \[\leadsto \frac{\color{blue}{-4.5}}{\frac{a}{t \cdot z}} \]
    9. Simplified73.3%

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

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

        \[\leadsto \color{blue}{\frac{-4.5}{\frac{a}{t}} \cdot z} \]
    11. Applied egg-rr73.8%

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

    if -1.00000000000000005e57 < (*.f64 x y) < -2e11 or 1.99999999999999987e-124 < (*.f64 x y) < 5.0000000000000003e240

    1. Initial program 94.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 74.3%

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

    if -2e11 < (*.f64 x y) < 1.99999999999999987e-124

    1. Initial program 90.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 77.0%

      \[\leadsto \frac{\color{blue}{-9 \cdot \left(t \cdot z\right)}}{a \cdot 2} \]
    4. Step-by-step derivation
      1. associate-*r*76.9%

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

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

      \[\leadsto \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. associate-*l*76.9%

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

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

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

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

        \[\leadsto \color{blue}{\left(t \cdot \frac{z}{a}\right)} \cdot \frac{-9}{2} \]
      6. metadata-eval77.2%

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

        \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
      8. *-commutative77.2%

        \[\leadsto -4.5 \cdot \color{blue}{\left(\frac{z}{a} \cdot t\right)} \]
      9. associate-*r*77.3%

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

      \[\leadsto \color{blue}{\left(-4.5 \cdot \frac{z}{a}\right) \cdot t} \]
    8. Step-by-step derivation
      1. clear-num77.0%

        \[\leadsto \left(-4.5 \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) \cdot t \]
      2. un-div-inv77.1%

        \[\leadsto \color{blue}{\frac{-4.5}{\frac{a}{z}}} \cdot t \]
    9. Applied egg-rr77.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\ \;\;\;\;z \cdot \frac{-4.5}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y \leq -200000000000:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ \begin{array}{l} t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+92}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{+44}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a\_m}\\ \mathbf{elif}\;x \leq -0.088:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\ \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.
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 (* (* 0.5 y) (/ x a_m))))
   (*
    a_s
    (if (<= x -5.5e+92)
      t_1
      (if (<= x -1.3e+44)
        (* -4.5 (/ (* t z) a_m))
        (if (<= x -0.088)
          t_1
          (if (<= x 1.25e-226)
            (* t (* -4.5 (/ z a_m)))
            (* x (* 0.5 (/ y a_m))))))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 = (0.5 * y) * (x / a_m);
	double tmp;
	if (x <= -5.5e+92) {
		tmp = t_1;
	} else if (x <= -1.3e+44) {
		tmp = -4.5 * ((t * z) / a_m);
	} else if (x <= -0.088) {
		tmp = t_1;
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 * (z / a_m));
	} else {
		tmp = x * (0.5 * (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.
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 = (0.5d0 * y) * (x / a_m)
    if (x <= (-5.5d+92)) then
        tmp = t_1
    else if (x <= (-1.3d+44)) then
        tmp = (-4.5d0) * ((t * z) / a_m)
    else if (x <= (-0.088d0)) then
        tmp = t_1
    else if (x <= 1.25d-226) then
        tmp = t * ((-4.5d0) * (z / a_m))
    else
        tmp = x * (0.5d0 * (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;
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 = (0.5 * y) * (x / a_m);
	double tmp;
	if (x <= -5.5e+92) {
		tmp = t_1;
	} else if (x <= -1.3e+44) {
		tmp = -4.5 * ((t * z) / a_m);
	} else if (x <= -0.088) {
		tmp = t_1;
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 * (z / a_m));
	} else {
		tmp = x * (0.5 * (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])
[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 = (0.5 * y) * (x / a_m)
	tmp = 0
	if x <= -5.5e+92:
		tmp = t_1
	elif x <= -1.3e+44:
		tmp = -4.5 * ((t * z) / a_m)
	elif x <= -0.088:
		tmp = t_1
	elif x <= 1.25e-226:
		tmp = t * (-4.5 * (z / a_m))
	else:
		tmp = x * (0.5 * (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])
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(0.5 * y) * Float64(x / a_m))
	tmp = 0.0
	if (x <= -5.5e+92)
		tmp = t_1;
	elseif (x <= -1.3e+44)
		tmp = Float64(-4.5 * Float64(Float64(t * z) / a_m));
	elseif (x <= -0.088)
		tmp = t_1;
	elseif (x <= 1.25e-226)
		tmp = Float64(t * Float64(-4.5 * Float64(z / a_m)));
	else
		tmp = Float64(x * Float64(0.5 * 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])){:}
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 = (0.5 * y) * (x / a_m);
	tmp = 0.0;
	if (x <= -5.5e+92)
		tmp = t_1;
	elseif (x <= -1.3e+44)
		tmp = -4.5 * ((t * z) / a_m);
	elseif (x <= -0.088)
		tmp = t_1;
	elseif (x <= 1.25e-226)
		tmp = t * (-4.5 * (z / a_m));
	else
		tmp = x * (0.5 * (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.
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[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[x, -5.5e+92], t$95$1, If[LessEqual[x, -1.3e+44], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.088], t$95$1, If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{+44}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a\_m}\\

\mathbf{elif}\;x \leq -0.088:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -5.50000000000000053e92 or -1.3e44 < x < -0.087999999999999995

    1. Initial program 84.7%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num84.5%

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

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}^{-1}} \]
      3. *-commutative84.5%

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

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

        \[\leadsto {\left(2 \cdot \frac{a}{\color{blue}{\mathsf{fma}\left(x, y, -\left(z \cdot 9\right) \cdot t\right)}}\right)}^{-1} \]
      6. *-commutative84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, -\color{blue}{t \cdot \left(z \cdot 9\right)}\right)}\right)}^{-1} \]
      7. distribute-rgt-neg-in84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, \color{blue}{t \cdot \left(-z \cdot 9\right)}\right)}\right)}^{-1} \]
      8. distribute-rgt-neg-in84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \color{blue}{\left(z \cdot \left(-9\right)\right)}\right)}\right)}^{-1} \]
      9. metadata-eval84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot \color{blue}{-9}\right)\right)}\right)}^{-1} \]
    4. Applied egg-rr84.5%

      \[\leadsto \color{blue}{{\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-184.5%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}}} \]
      3. metadata-eval84.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}} \]
      4. fma-define84.5%

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

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

        \[\leadsto \frac{0.5}{\frac{a}{\color{blue}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    6. Simplified86.5%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    7. Taylor expanded in t around 0 78.9%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    9. Simplified90.1%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    10. Step-by-step derivation
      1. associate-/r/90.0%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{x}} \cdot y} \]
      2. *-commutative90.0%

        \[\leadsto \color{blue}{y \cdot \frac{0.5}{\frac{a}{x}}} \]
      3. div-inv90.0%

        \[\leadsto y \cdot \color{blue}{\left(0.5 \cdot \frac{1}{\frac{a}{x}}\right)} \]
      4. clear-num90.0%

        \[\leadsto y \cdot \left(0.5 \cdot \color{blue}{\frac{x}{a}}\right) \]
    11. Applied egg-rr90.0%

      \[\leadsto \color{blue}{y \cdot \left(0.5 \cdot \frac{x}{a}\right)} \]
    12. Step-by-step derivation
      1. associate-*r*90.0%

        \[\leadsto \color{blue}{\left(y \cdot 0.5\right) \cdot \frac{x}{a}} \]
    13. Simplified90.0%

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

    if -5.50000000000000053e92 < x < -1.3e44

    1. Initial program 100.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 67.3%

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

    if -0.087999999999999995 < x < 1.2499999999999999e-226

    1. Initial program 88.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 63.5%

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

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

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

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

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

    if 1.2499999999999999e-226 < x

    1. Initial program 83.3%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 56.0%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{a} \cdot 0.5\right)} \]
    5. Simplified60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+92}:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{+44}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \leq -0.088:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 65.7% 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ \begin{array}{l} t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+43}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a\_m}\\ \mathbf{elif}\;x \leq -0.00062:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\ \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.
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 (* (* 0.5 y) (/ x a_m))))
   (*
    a_s
    (if (<= x -4.8e+92)
      t_1
      (if (<= x -6e+43)
        (* -4.5 (/ (* t z) a_m))
        (if (<= x -0.00062)
          t_1
          (if (<= x 1.25e-226)
            (* t (/ -4.5 (/ a_m z)))
            (* x (* 0.5 (/ y a_m))))))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 = (0.5 * y) * (x / a_m);
	double tmp;
	if (x <= -4.8e+92) {
		tmp = t_1;
	} else if (x <= -6e+43) {
		tmp = -4.5 * ((t * z) / a_m);
	} else if (x <= -0.00062) {
		tmp = t_1;
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 / (a_m / z));
	} else {
		tmp = x * (0.5 * (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.
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 = (0.5d0 * y) * (x / a_m)
    if (x <= (-4.8d+92)) then
        tmp = t_1
    else if (x <= (-6d+43)) then
        tmp = (-4.5d0) * ((t * z) / a_m)
    else if (x <= (-0.00062d0)) then
        tmp = t_1
    else if (x <= 1.25d-226) then
        tmp = t * ((-4.5d0) / (a_m / z))
    else
        tmp = x * (0.5d0 * (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;
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 = (0.5 * y) * (x / a_m);
	double tmp;
	if (x <= -4.8e+92) {
		tmp = t_1;
	} else if (x <= -6e+43) {
		tmp = -4.5 * ((t * z) / a_m);
	} else if (x <= -0.00062) {
		tmp = t_1;
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 / (a_m / z));
	} else {
		tmp = x * (0.5 * (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])
[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 = (0.5 * y) * (x / a_m)
	tmp = 0
	if x <= -4.8e+92:
		tmp = t_1
	elif x <= -6e+43:
		tmp = -4.5 * ((t * z) / a_m)
	elif x <= -0.00062:
		tmp = t_1
	elif x <= 1.25e-226:
		tmp = t * (-4.5 / (a_m / z))
	else:
		tmp = x * (0.5 * (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])
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(0.5 * y) * Float64(x / a_m))
	tmp = 0.0
	if (x <= -4.8e+92)
		tmp = t_1;
	elseif (x <= -6e+43)
		tmp = Float64(-4.5 * Float64(Float64(t * z) / a_m));
	elseif (x <= -0.00062)
		tmp = t_1;
	elseif (x <= 1.25e-226)
		tmp = Float64(t * Float64(-4.5 / Float64(a_m / z)));
	else
		tmp = Float64(x * Float64(0.5 * 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])){:}
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 = (0.5 * y) * (x / a_m);
	tmp = 0.0;
	if (x <= -4.8e+92)
		tmp = t_1;
	elseif (x <= -6e+43)
		tmp = -4.5 * ((t * z) / a_m);
	elseif (x <= -0.00062)
		tmp = t_1;
	elseif (x <= 1.25e-226)
		tmp = t * (-4.5 / (a_m / z));
	else
		tmp = x * (0.5 * (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.
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[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[x, -4.8e+92], t$95$1, If[LessEqual[x, -6e+43], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.00062], t$95$1, If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -6 \cdot 10^{+43}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a\_m}\\

\mathbf{elif}\;x \leq -0.00062:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.80000000000000009e92 or -6.00000000000000033e43 < x < -6.2e-4

    1. Initial program 84.7%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num84.5%

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

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}^{-1}} \]
      3. *-commutative84.5%

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

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

        \[\leadsto {\left(2 \cdot \frac{a}{\color{blue}{\mathsf{fma}\left(x, y, -\left(z \cdot 9\right) \cdot t\right)}}\right)}^{-1} \]
      6. *-commutative84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, -\color{blue}{t \cdot \left(z \cdot 9\right)}\right)}\right)}^{-1} \]
      7. distribute-rgt-neg-in84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, \color{blue}{t \cdot \left(-z \cdot 9\right)}\right)}\right)}^{-1} \]
      8. distribute-rgt-neg-in84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \color{blue}{\left(z \cdot \left(-9\right)\right)}\right)}\right)}^{-1} \]
      9. metadata-eval84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot \color{blue}{-9}\right)\right)}\right)}^{-1} \]
    4. Applied egg-rr84.5%

      \[\leadsto \color{blue}{{\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-184.5%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}}} \]
      3. metadata-eval84.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}} \]
      4. fma-define84.5%

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

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

        \[\leadsto \frac{0.5}{\frac{a}{\color{blue}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    6. Simplified86.5%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    7. Taylor expanded in t around 0 78.9%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    9. Simplified90.1%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    10. Step-by-step derivation
      1. associate-/r/90.0%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{x}} \cdot y} \]
      2. *-commutative90.0%

        \[\leadsto \color{blue}{y \cdot \frac{0.5}{\frac{a}{x}}} \]
      3. div-inv90.0%

        \[\leadsto y \cdot \color{blue}{\left(0.5 \cdot \frac{1}{\frac{a}{x}}\right)} \]
      4. clear-num90.0%

        \[\leadsto y \cdot \left(0.5 \cdot \color{blue}{\frac{x}{a}}\right) \]
    11. Applied egg-rr90.0%

      \[\leadsto \color{blue}{y \cdot \left(0.5 \cdot \frac{x}{a}\right)} \]
    12. Step-by-step derivation
      1. associate-*r*90.0%

        \[\leadsto \color{blue}{\left(y \cdot 0.5\right) \cdot \frac{x}{a}} \]
    13. Simplified90.0%

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

    if -4.80000000000000009e92 < x < -6.00000000000000033e43

    1. Initial program 100.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 67.3%

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

    if -6.2e-4 < x < 1.2499999999999999e-226

    1. Initial program 88.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 63.4%

      \[\leadsto \frac{\color{blue}{-9 \cdot \left(t \cdot z\right)}}{a \cdot 2} \]
    4. Step-by-step derivation
      1. associate-*r*63.4%

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

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

      \[\leadsto \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. associate-*l*63.4%

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

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

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

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

        \[\leadsto \color{blue}{\left(t \cdot \frac{z}{a}\right)} \cdot \frac{-9}{2} \]
      6. metadata-eval68.3%

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

        \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
      8. *-commutative68.3%

        \[\leadsto -4.5 \cdot \color{blue}{\left(\frac{z}{a} \cdot t\right)} \]
      9. associate-*r*68.4%

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

      \[\leadsto \color{blue}{\left(-4.5 \cdot \frac{z}{a}\right) \cdot t} \]
    8. Step-by-step derivation
      1. clear-num68.1%

        \[\leadsto \left(-4.5 \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) \cdot t \]
      2. un-div-inv68.2%

        \[\leadsto \color{blue}{\frac{-4.5}{\frac{a}{z}}} \cdot t \]
    9. Applied egg-rr68.2%

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

    if 1.2499999999999999e-226 < x

    1. Initial program 83.3%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 56.0%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{a} \cdot 0.5\right)} \]
    5. Simplified60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{+43}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \leq -0.00062:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 65.7% 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ \begin{array}{l} t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{+44}:\\ \;\;\;\;\frac{-4.5}{\frac{a\_m}{t \cdot z}}\\ \mathbf{elif}\;x \leq -0.19:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\ \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.
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 (* (* 0.5 y) (/ x a_m))))
   (*
    a_s
    (if (<= x -4.8e+92)
      t_1
      (if (<= x -1.05e+44)
        (/ -4.5 (/ a_m (* t z)))
        (if (<= x -0.19)
          t_1
          (if (<= x 1.25e-226)
            (* t (/ -4.5 (/ a_m z)))
            (* x (* 0.5 (/ y a_m))))))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 = (0.5 * y) * (x / a_m);
	double tmp;
	if (x <= -4.8e+92) {
		tmp = t_1;
	} else if (x <= -1.05e+44) {
		tmp = -4.5 / (a_m / (t * z));
	} else if (x <= -0.19) {
		tmp = t_1;
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 / (a_m / z));
	} else {
		tmp = x * (0.5 * (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.
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 = (0.5d0 * y) * (x / a_m)
    if (x <= (-4.8d+92)) then
        tmp = t_1
    else if (x <= (-1.05d+44)) then
        tmp = (-4.5d0) / (a_m / (t * z))
    else if (x <= (-0.19d0)) then
        tmp = t_1
    else if (x <= 1.25d-226) then
        tmp = t * ((-4.5d0) / (a_m / z))
    else
        tmp = x * (0.5d0 * (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;
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 = (0.5 * y) * (x / a_m);
	double tmp;
	if (x <= -4.8e+92) {
		tmp = t_1;
	} else if (x <= -1.05e+44) {
		tmp = -4.5 / (a_m / (t * z));
	} else if (x <= -0.19) {
		tmp = t_1;
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 / (a_m / z));
	} else {
		tmp = x * (0.5 * (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])
[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 = (0.5 * y) * (x / a_m)
	tmp = 0
	if x <= -4.8e+92:
		tmp = t_1
	elif x <= -1.05e+44:
		tmp = -4.5 / (a_m / (t * z))
	elif x <= -0.19:
		tmp = t_1
	elif x <= 1.25e-226:
		tmp = t * (-4.5 / (a_m / z))
	else:
		tmp = x * (0.5 * (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])
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(0.5 * y) * Float64(x / a_m))
	tmp = 0.0
	if (x <= -4.8e+92)
		tmp = t_1;
	elseif (x <= -1.05e+44)
		tmp = Float64(-4.5 / Float64(a_m / Float64(t * z)));
	elseif (x <= -0.19)
		tmp = t_1;
	elseif (x <= 1.25e-226)
		tmp = Float64(t * Float64(-4.5 / Float64(a_m / z)));
	else
		tmp = Float64(x * Float64(0.5 * 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])){:}
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 = (0.5 * y) * (x / a_m);
	tmp = 0.0;
	if (x <= -4.8e+92)
		tmp = t_1;
	elseif (x <= -1.05e+44)
		tmp = -4.5 / (a_m / (t * z));
	elseif (x <= -0.19)
		tmp = t_1;
	elseif (x <= 1.25e-226)
		tmp = t * (-4.5 / (a_m / z));
	else
		tmp = x * (0.5 * (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.
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[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[x, -4.8e+92], t$95$1, If[LessEqual[x, -1.05e+44], N[(-4.5 / N[(a$95$m / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.19], t$95$1, If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -1.05 \cdot 10^{+44}:\\
\;\;\;\;\frac{-4.5}{\frac{a\_m}{t \cdot z}}\\

\mathbf{elif}\;x \leq -0.19:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.80000000000000009e92 or -1.04999999999999993e44 < x < -0.19

    1. Initial program 84.7%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num84.5%

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

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}^{-1}} \]
      3. *-commutative84.5%

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

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

        \[\leadsto {\left(2 \cdot \frac{a}{\color{blue}{\mathsf{fma}\left(x, y, -\left(z \cdot 9\right) \cdot t\right)}}\right)}^{-1} \]
      6. *-commutative84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, -\color{blue}{t \cdot \left(z \cdot 9\right)}\right)}\right)}^{-1} \]
      7. distribute-rgt-neg-in84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, \color{blue}{t \cdot \left(-z \cdot 9\right)}\right)}\right)}^{-1} \]
      8. distribute-rgt-neg-in84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \color{blue}{\left(z \cdot \left(-9\right)\right)}\right)}\right)}^{-1} \]
      9. metadata-eval84.5%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot \color{blue}{-9}\right)\right)}\right)}^{-1} \]
    4. Applied egg-rr84.5%

      \[\leadsto \color{blue}{{\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-184.5%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}}} \]
      3. metadata-eval84.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}} \]
      4. fma-define84.5%

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

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

        \[\leadsto \frac{0.5}{\frac{a}{\color{blue}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    6. Simplified86.5%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    7. Taylor expanded in t around 0 78.9%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    9. Simplified90.1%

      \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    10. Step-by-step derivation
      1. associate-/r/90.0%

        \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{x}} \cdot y} \]
      2. *-commutative90.0%

        \[\leadsto \color{blue}{y \cdot \frac{0.5}{\frac{a}{x}}} \]
      3. div-inv90.0%

        \[\leadsto y \cdot \color{blue}{\left(0.5 \cdot \frac{1}{\frac{a}{x}}\right)} \]
      4. clear-num90.0%

        \[\leadsto y \cdot \left(0.5 \cdot \color{blue}{\frac{x}{a}}\right) \]
    11. Applied egg-rr90.0%

      \[\leadsto \color{blue}{y \cdot \left(0.5 \cdot \frac{x}{a}\right)} \]
    12. Step-by-step derivation
      1. associate-*r*90.0%

        \[\leadsto \color{blue}{\left(y \cdot 0.5\right) \cdot \frac{x}{a}} \]
    13. Simplified90.0%

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

    if -4.80000000000000009e92 < x < -1.04999999999999993e44

    1. Initial program 100.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 67.3%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. associate-/l*56.8%

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

      \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
    6. Step-by-step derivation
      1. *-commutative56.8%

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

        \[\leadsto \color{blue}{\frac{t \cdot z}{a}} \cdot -4.5 \]
      3. metadata-eval67.3%

        \[\leadsto \frac{t \cdot z}{a} \cdot \color{blue}{\frac{-9}{2}} \]
      4. times-frac67.3%

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

        \[\leadsto \frac{\color{blue}{t \cdot \left(z \cdot -9\right)}}{a \cdot 2} \]
      6. *-commutative67.6%

        \[\leadsto \frac{t \cdot \color{blue}{\left(-9 \cdot z\right)}}{a \cdot 2} \]
      7. associate-*l*67.5%

        \[\leadsto \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a \cdot 2} \]
      8. clear-num67.6%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\color{blue}{t \cdot \left(-9 \cdot z\right)}}} \]
      10. *-commutative67.5%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\color{blue}{\left(t \cdot z\right) \cdot -9}}} \]
      12. times-frac67.5%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{t \cdot z} \cdot \frac{2}{-9}}} \]
      13. metadata-eval67.5%

        \[\leadsto \frac{1}{\frac{a}{t \cdot z} \cdot \color{blue}{-0.2222222222222222}} \]
    7. Applied egg-rr67.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{t \cdot z} \cdot -0.2222222222222222}} \]
    8. Step-by-step derivation
      1. *-commutative67.5%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{-0.2222222222222222}}{\frac{a}{t \cdot z}}} \]
      3. metadata-eval67.5%

        \[\leadsto \frac{\color{blue}{-4.5}}{\frac{a}{t \cdot z}} \]
    9. Simplified67.5%

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

    if -0.19 < x < 1.2499999999999999e-226

    1. Initial program 88.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 63.4%

      \[\leadsto \frac{\color{blue}{-9 \cdot \left(t \cdot z\right)}}{a \cdot 2} \]
    4. Step-by-step derivation
      1. associate-*r*63.4%

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

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

      \[\leadsto \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. associate-*l*63.4%

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

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

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

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

        \[\leadsto \color{blue}{\left(t \cdot \frac{z}{a}\right)} \cdot \frac{-9}{2} \]
      6. metadata-eval68.3%

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

        \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
      8. *-commutative68.3%

        \[\leadsto -4.5 \cdot \color{blue}{\left(\frac{z}{a} \cdot t\right)} \]
      9. associate-*r*68.4%

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

      \[\leadsto \color{blue}{\left(-4.5 \cdot \frac{z}{a}\right) \cdot t} \]
    8. Step-by-step derivation
      1. clear-num68.1%

        \[\leadsto \left(-4.5 \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) \cdot t \]
      2. un-div-inv68.2%

        \[\leadsto \color{blue}{\frac{-4.5}{\frac{a}{z}}} \cdot t \]
    9. Applied egg-rr68.2%

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

    if 1.2499999999999999e-226 < x

    1. Initial program 83.3%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 56.0%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{a} \cdot 0.5\right)} \]
    5. Simplified60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{+44}:\\ \;\;\;\;\frac{-4.5}{\frac{a}{t \cdot z}}\\ \mathbf{elif}\;x \leq -0.19:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 65.7% 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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\ \;\;\;\;\frac{0.5}{\frac{\frac{a\_m}{x}}{y}}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{+44}:\\ \;\;\;\;\frac{-4.5}{\frac{a\_m}{t \cdot z}}\\ \mathbf{elif}\;x \leq -0.0026:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\ \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.
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 -4.8e+92)
    (/ 0.5 (/ (/ a_m x) y))
    (if (<= x -1.25e+44)
      (/ -4.5 (/ a_m (* t z)))
      (if (<= x -0.0026)
        (* (* 0.5 y) (/ x a_m))
        (if (<= x 1.25e-226)
          (* t (/ -4.5 (/ a_m z)))
          (* x (* 0.5 (/ y a_m)))))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 <= -4.8e+92) {
		tmp = 0.5 / ((a_m / x) / y);
	} else if (x <= -1.25e+44) {
		tmp = -4.5 / (a_m / (t * z));
	} else if (x <= -0.0026) {
		tmp = (0.5 * y) * (x / a_m);
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 / (a_m / z));
	} else {
		tmp = x * (0.5 * (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.
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 <= (-4.8d+92)) then
        tmp = 0.5d0 / ((a_m / x) / y)
    else if (x <= (-1.25d+44)) then
        tmp = (-4.5d0) / (a_m / (t * z))
    else if (x <= (-0.0026d0)) then
        tmp = (0.5d0 * y) * (x / a_m)
    else if (x <= 1.25d-226) then
        tmp = t * ((-4.5d0) / (a_m / z))
    else
        tmp = x * (0.5d0 * (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;
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 <= -4.8e+92) {
		tmp = 0.5 / ((a_m / x) / y);
	} else if (x <= -1.25e+44) {
		tmp = -4.5 / (a_m / (t * z));
	} else if (x <= -0.0026) {
		tmp = (0.5 * y) * (x / a_m);
	} else if (x <= 1.25e-226) {
		tmp = t * (-4.5 / (a_m / z));
	} else {
		tmp = x * (0.5 * (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])
[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 <= -4.8e+92:
		tmp = 0.5 / ((a_m / x) / y)
	elif x <= -1.25e+44:
		tmp = -4.5 / (a_m / (t * z))
	elif x <= -0.0026:
		tmp = (0.5 * y) * (x / a_m)
	elif x <= 1.25e-226:
		tmp = t * (-4.5 / (a_m / z))
	else:
		tmp = x * (0.5 * (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])
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 <= -4.8e+92)
		tmp = Float64(0.5 / Float64(Float64(a_m / x) / y));
	elseif (x <= -1.25e+44)
		tmp = Float64(-4.5 / Float64(a_m / Float64(t * z)));
	elseif (x <= -0.0026)
		tmp = Float64(Float64(0.5 * y) * Float64(x / a_m));
	elseif (x <= 1.25e-226)
		tmp = Float64(t * Float64(-4.5 / Float64(a_m / z)));
	else
		tmp = Float64(x * Float64(0.5 * 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])){:}
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 <= -4.8e+92)
		tmp = 0.5 / ((a_m / x) / y);
	elseif (x <= -1.25e+44)
		tmp = -4.5 / (a_m / (t * z));
	elseif (x <= -0.0026)
		tmp = (0.5 * y) * (x / a_m);
	elseif (x <= 1.25e-226)
		tmp = t * (-4.5 / (a_m / z));
	else
		tmp = x * (0.5 * (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.
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, -4.8e+92], N[(0.5 / N[(N[(a$95$m / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.25e+44], N[(-4.5 / N[(a$95$m / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.0026], N[(N[(0.5 * y), $MachinePrecision] * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e-226], N[(t * N[(-4.5 / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{a\_m}{x}}{y}}\\

\mathbf{elif}\;x \leq -1.25 \cdot 10^{+44}:\\
\;\;\;\;\frac{-4.5}{\frac{a\_m}{t \cdot z}}\\

\mathbf{elif}\;x \leq -0.0026:\\
\;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a\_m}\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;t \cdot \frac{-4.5}{\frac{a\_m}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -4.80000000000000009e92

    1. Initial program 84.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num84.3%

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

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}^{-1}} \]
      3. *-commutative84.3%

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

        \[\leadsto {\color{blue}{\left(2 \cdot \frac{a}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}}^{-1} \]
      5. fma-neg84.3%

        \[\leadsto {\left(2 \cdot \frac{a}{\color{blue}{\mathsf{fma}\left(x, y, -\left(z \cdot 9\right) \cdot t\right)}}\right)}^{-1} \]
      6. *-commutative84.3%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, -\color{blue}{t \cdot \left(z \cdot 9\right)}\right)}\right)}^{-1} \]
      7. distribute-rgt-neg-in84.3%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, \color{blue}{t \cdot \left(-z \cdot 9\right)}\right)}\right)}^{-1} \]
      8. distribute-rgt-neg-in84.3%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \color{blue}{\left(z \cdot \left(-9\right)\right)}\right)}\right)}^{-1} \]
      9. metadata-eval84.3%

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

      \[\leadsto \color{blue}{{\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-184.3%

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

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

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

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

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

        \[\leadsto \frac{0.5}{\frac{a}{\color{blue}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    6. Simplified86.7%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    7. Taylor expanded in t around 0 77.8%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    9. Simplified88.6%

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

    if -4.80000000000000009e92 < x < -1.2499999999999999e44

    1. Initial program 100.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 67.3%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. associate-/l*56.8%

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

      \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
    6. Step-by-step derivation
      1. *-commutative56.8%

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

        \[\leadsto \color{blue}{\frac{t \cdot z}{a}} \cdot -4.5 \]
      3. metadata-eval67.3%

        \[\leadsto \frac{t \cdot z}{a} \cdot \color{blue}{\frac{-9}{2}} \]
      4. times-frac67.3%

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

        \[\leadsto \frac{\color{blue}{t \cdot \left(z \cdot -9\right)}}{a \cdot 2} \]
      6. *-commutative67.6%

        \[\leadsto \frac{t \cdot \color{blue}{\left(-9 \cdot z\right)}}{a \cdot 2} \]
      7. associate-*l*67.5%

        \[\leadsto \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a \cdot 2} \]
      8. clear-num67.6%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\color{blue}{t \cdot \left(-9 \cdot z\right)}}} \]
      10. *-commutative67.5%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\color{blue}{\left(t \cdot z\right) \cdot -9}}} \]
      12. times-frac67.5%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{t \cdot z} \cdot \frac{2}{-9}}} \]
      13. metadata-eval67.5%

        \[\leadsto \frac{1}{\frac{a}{t \cdot z} \cdot \color{blue}{-0.2222222222222222}} \]
    7. Applied egg-rr67.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{t \cdot z} \cdot -0.2222222222222222}} \]
    8. Step-by-step derivation
      1. *-commutative67.5%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{-0.2222222222222222}}{\frac{a}{t \cdot z}}} \]
      3. metadata-eval67.5%

        \[\leadsto \frac{\color{blue}{-4.5}}{\frac{a}{t \cdot z}} \]
    9. Simplified67.5%

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

    if -1.2499999999999999e44 < x < -0.0025999999999999999

    1. Initial program 85.8%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num85.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}}} \]
      2. inv-pow85.6%

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}^{-1}} \]
      3. *-commutative85.6%

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

        \[\leadsto {\color{blue}{\left(2 \cdot \frac{a}{x \cdot y - \left(z \cdot 9\right) \cdot t}\right)}}^{-1} \]
      5. fma-neg85.6%

        \[\leadsto {\left(2 \cdot \frac{a}{\color{blue}{\mathsf{fma}\left(x, y, -\left(z \cdot 9\right) \cdot t\right)}}\right)}^{-1} \]
      6. *-commutative85.6%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, -\color{blue}{t \cdot \left(z \cdot 9\right)}\right)}\right)}^{-1} \]
      7. distribute-rgt-neg-in85.6%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, \color{blue}{t \cdot \left(-z \cdot 9\right)}\right)}\right)}^{-1} \]
      8. distribute-rgt-neg-in85.6%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \color{blue}{\left(z \cdot \left(-9\right)\right)}\right)}\right)}^{-1} \]
      9. metadata-eval85.6%

        \[\leadsto {\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot \color{blue}{-9}\right)\right)}\right)}^{-1} \]
    4. Applied egg-rr85.6%

      \[\leadsto \color{blue}{{\left(2 \cdot \frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-185.6%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}}} \]
      3. metadata-eval85.6%

        \[\leadsto \frac{\color{blue}{0.5}}{\frac{a}{\mathsf{fma}\left(x, y, t \cdot \left(z \cdot -9\right)\right)}} \]
      4. fma-define85.6%

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{\mathsf{fma}\left(t, z \cdot -9, x \cdot y\right)}}} \]
    7. Taylor expanded in t around 0 85.6%

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

        \[\leadsto \frac{0.5}{\color{blue}{\frac{\frac{a}{x}}{y}}} \]
    9. Simplified99.6%

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{a}{x}} \cdot y} \]
      2. *-commutative99.8%

        \[\leadsto \color{blue}{y \cdot \frac{0.5}{\frac{a}{x}}} \]
      3. div-inv99.8%

        \[\leadsto y \cdot \color{blue}{\left(0.5 \cdot \frac{1}{\frac{a}{x}}\right)} \]
      4. clear-num99.6%

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

      \[\leadsto \color{blue}{y \cdot \left(0.5 \cdot \frac{x}{a}\right)} \]
    12. Step-by-step derivation
      1. associate-*r*99.6%

        \[\leadsto \color{blue}{\left(y \cdot 0.5\right) \cdot \frac{x}{a}} \]
    13. Simplified99.6%

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

    if -0.0025999999999999999 < x < 1.2499999999999999e-226

    1. Initial program 88.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 63.4%

      \[\leadsto \frac{\color{blue}{-9 \cdot \left(t \cdot z\right)}}{a \cdot 2} \]
    4. Step-by-step derivation
      1. associate-*r*63.4%

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

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

      \[\leadsto \frac{\color{blue}{\left(t \cdot -9\right) \cdot z}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. associate-*l*63.4%

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

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

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

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

        \[\leadsto \color{blue}{\left(t \cdot \frac{z}{a}\right)} \cdot \frac{-9}{2} \]
      6. metadata-eval68.3%

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

        \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
      8. *-commutative68.3%

        \[\leadsto -4.5 \cdot \color{blue}{\left(\frac{z}{a} \cdot t\right)} \]
      9. associate-*r*68.4%

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

      \[\leadsto \color{blue}{\left(-4.5 \cdot \frac{z}{a}\right) \cdot t} \]
    8. Step-by-step derivation
      1. clear-num68.1%

        \[\leadsto \left(-4.5 \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) \cdot t \]
      2. un-div-inv68.2%

        \[\leadsto \color{blue}{\frac{-4.5}{\frac{a}{z}}} \cdot t \]
    9. Applied egg-rr68.2%

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

    if 1.2499999999999999e-226 < x

    1. Initial program 83.3%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 56.0%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{a} \cdot 0.5\right)} \]
    5. Simplified60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+92}:\\ \;\;\;\;\frac{0.5}{\frac{\frac{a}{x}}{y}}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{+44}:\\ \;\;\;\;\frac{-4.5}{\frac{a}{t \cdot z}}\\ \mathbf{elif}\;x \leq -0.0026:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-226}:\\ \;\;\;\;t \cdot \frac{-4.5}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 94.7% 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])\\\\ [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 -5 \cdot 10^{+265} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+248}\right):\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a\_m \cdot 2}\\ \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.
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 (or (<= (* x y) -5e+265) (not (<= (* x y) 5e+248)))
    (* x (* 0.5 (/ y a_m)))
    (/ (- (* x y) (* t (* z 9.0))) (* a_m 2.0)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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) <= -5e+265) || !((x * y) <= 5e+248)) {
		tmp = x * (0.5 * (y / a_m));
	} else {
		tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0);
	}
	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.
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) <= (-5d+265)) .or. (.not. ((x * y) <= 5d+248))) then
        tmp = x * (0.5d0 * (y / a_m))
    else
        tmp = ((x * y) - (t * (z * 9.0d0))) / (a_m * 2.0d0)
    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;
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) <= -5e+265) || !((x * y) <= 5e+248)) {
		tmp = x * (0.5 * (y / a_m));
	} else {
		tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0);
	}
	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])
[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) <= -5e+265) or not ((x * y) <= 5e+248):
		tmp = x * (0.5 * (y / a_m))
	else:
		tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0)
	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])
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) <= -5e+265) || !(Float64(x * y) <= 5e+248))
		tmp = Float64(x * Float64(0.5 * Float64(y / a_m)));
	else
		tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a_m * 2.0));
	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])){:}
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) <= -5e+265) || ~(((x * y) <= 5e+248)))
		tmp = x * (0.5 * (y / a_m));
	else
		tmp = ((x * y) - (t * (z * 9.0))) / (a_m * 2.0);
	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.
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[Or[LessEqual[N[(x * y), $MachinePrecision], -5e+265], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+248]], $MachinePrecision]], N[(x * N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * 2.0), $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])\\\\
[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 -5 \cdot 10^{+265} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+248}\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5.0000000000000002e265 or 4.9999999999999996e248 < (*.f64 x y)

    1. Initial program 62.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 66.6%

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. *-commutative66.6%

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{a} \cdot 0.5\right)} \]
    5. Simplified98.1%

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

    if -5.0000000000000002e265 < (*.f64 x y) < 4.9999999999999996e248

    1. Initial program 92.1%

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

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

Alternative 9: 68.4% accurate, 0.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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -2.05 \cdot 10^{-117} \lor \neg \left(y \leq 1.7 \cdot 10^{+54}\right):\\ \;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\\ \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.
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 (or (<= y -2.05e-117) (not (<= y 1.7e+54)))
    (* x (* 0.5 (/ y a_m)))
    (* t (* -4.5 (/ z a_m))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 ((y <= -2.05e-117) || !(y <= 1.7e+54)) {
		tmp = x * (0.5 * (y / a_m));
	} else {
		tmp = t * (-4.5 * (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.
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 ((y <= (-2.05d-117)) .or. (.not. (y <= 1.7d+54))) then
        tmp = x * (0.5d0 * (y / a_m))
    else
        tmp = t * ((-4.5d0) * (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;
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 ((y <= -2.05e-117) || !(y <= 1.7e+54)) {
		tmp = x * (0.5 * (y / a_m));
	} else {
		tmp = t * (-4.5 * (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])
[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 (y <= -2.05e-117) or not (y <= 1.7e+54):
		tmp = x * (0.5 * (y / a_m))
	else:
		tmp = t * (-4.5 * (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])
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 ((y <= -2.05e-117) || !(y <= 1.7e+54))
		tmp = Float64(x * Float64(0.5 * Float64(y / a_m)));
	else
		tmp = Float64(t * Float64(-4.5 * 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])){:}
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 ((y <= -2.05e-117) || ~((y <= 1.7e+54)))
		tmp = x * (0.5 * (y / a_m));
	else
		tmp = t * (-4.5 * (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.
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[Or[LessEqual[y, -2.05e-117], N[Not[LessEqual[y, 1.7e+54]], $MachinePrecision]], N[(x * N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(-4.5 * N[(z / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-117} \lor \neg \left(y \leq 1.7 \cdot 10^{+54}\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a\_m}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.05000000000000016e-117 or 1.7e54 < y

    1. Initial program 81.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 60.8%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{a} \cdot 0.5\right)} \]
    5. Simplified70.7%

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

    if -2.05000000000000016e-117 < y < 1.7e54

    1. Initial program 91.8%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 64.7%

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

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

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

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

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

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

Alternative 10: 51.4% accurate, 1.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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \left(-4.5 \cdot \left(t \cdot \frac{z}{a\_m}\right)\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.
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 (* -4.5 (* t (/ z a_m)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * (-4.5 * (t * (z / 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.
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 * ((-4.5d0) * (t * (z / 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;
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 * (-4.5 * (t * (z / 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])
[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 * (-4.5 * (t * (z / 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])
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(-4.5 * Float64(t * Float64(z / 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])){:}
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 * (-4.5 * (t * (z / 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.
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[(-4.5 * N[(t * N[(z / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(-4.5 \cdot \left(t \cdot \frac{z}{a\_m}\right)\right)
\end{array}
Derivation
  1. Initial program 86.0%

    \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 42.8%

    \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
  4. Step-by-step derivation
    1. associate-/l*46.2%

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

    \[\leadsto \color{blue}{-4.5 \cdot \left(t \cdot \frac{z}{a}\right)} \]
  6. Final simplification46.2%

    \[\leadsto -4.5 \cdot \left(t \cdot \frac{z}{a}\right) \]
  7. Add Preprocessing

Alternative 11: 51.4% accurate, 1.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])\\\\ [x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\ \\ a\_s \cdot \left(t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\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.
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 (* t (* -4.5 (/ z a_m)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * (t * (-4.5 * (z / 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.
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 * (t * ((-4.5d0) * (z / 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;
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 * (t * (-4.5 * (z / 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])
[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 * (t * (-4.5 * (z / 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])
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(t * Float64(-4.5 * Float64(z / 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])){:}
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 * (t * (-4.5 * (z / 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.
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[(t * N[(-4.5 * N[(z / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\right)
\end{array}
Derivation
  1. Initial program 86.0%

    \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 42.8%

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

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

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

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

    \[\leadsto \color{blue}{t \cdot \left(\frac{z}{a} \cdot -4.5\right)} \]
  6. Final simplification46.2%

    \[\leadsto t \cdot \left(-4.5 \cdot \frac{z}{a}\right) \]
  7. Add Preprocessing

Developer target: 94.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a < -2.090464557976709 \cdot 10^{+86}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a < 2.144030707833976 \cdot 10^{+99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (< a -2.090464557976709e+86)
   (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z))))
   (if (< a 2.144030707833976e+99)
     (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
     (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a < -2.090464557976709e+86) {
		tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
	} else if (a < 2.144030707833976e+99) {
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
	} else {
		tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
	}
	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) :: tmp
    if (a < (-2.090464557976709d+86)) then
        tmp = (0.5d0 * ((y * x) / a)) - (4.5d0 * (t / (a / z)))
    else if (a < 2.144030707833976d+99) then
        tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
    else
        tmp = ((y / a) * (x * 0.5d0)) - ((t / a) * (z * 4.5d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a < -2.090464557976709e+86) {
		tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
	} else if (a < 2.144030707833976e+99) {
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
	} else {
		tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a < -2.090464557976709e+86:
		tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)))
	elif a < 2.144030707833976e+99:
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0)
	else:
		tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a < -2.090464557976709e+86)
		tmp = Float64(Float64(0.5 * Float64(Float64(y * x) / a)) - Float64(4.5 * Float64(t / Float64(a / z))));
	elseif (a < 2.144030707833976e+99)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(Float64(y / a) * Float64(x * 0.5)) - Float64(Float64(t / a) * Float64(z * 4.5)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a < -2.090464557976709e+86)
		tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
	elseif (a < 2.144030707833976e+99)
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
	else
		tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Less[a, -2.090464557976709e+86], N[(N[(0.5 * N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[a, 2.144030707833976e+99], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a < -2.090464557976709 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;a < 2.144030707833976 \cdot 10^{+99}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024041 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"
  :precision binary64

  :herbie-target
  (if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

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