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

Percentage Accurate: 91.1% → 96.9%
Time: 12.8s
Alternatives: 16
Speedup: 0.6×

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 16 alternatives:

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

Initial Program: 91.1% 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: 96.9% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{+292}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{y}{\frac{a}{x}}, -4.5 \cdot \left(z \cdot \frac{t}{a}\right)\right)\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+259}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4.5, t \cdot \frac{z}{a}, \left(0.5 \cdot y\right) \cdot \frac{x}{a}\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* t (* z 9.0)))))
   (if (<= t_1 -2e+292)
     (fma 0.5 (/ y (/ a x)) (* -4.5 (* z (/ t a))))
     (if (<= t_1 2e+259)
       (* (fma x y (* z (* t -9.0))) (/ 0.5 a))
       (fma -4.5 (* t (/ z a)) (* (* 0.5 y) (/ x a)))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (t * (z * 9.0));
	double tmp;
	if (t_1 <= -2e+292) {
		tmp = fma(0.5, (y / (a / x)), (-4.5 * (z * (t / a))));
	} else if (t_1 <= 2e+259) {
		tmp = fma(x, y, (z * (t * -9.0))) * (0.5 / a);
	} else {
		tmp = fma(-4.5, (t * (z / a)), ((0.5 * y) * (x / a)));
	}
	return tmp;
}
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(t * Float64(z * 9.0)))
	tmp = 0.0
	if (t_1 <= -2e+292)
		tmp = fma(0.5, Float64(y / Float64(a / x)), Float64(-4.5 * Float64(z * Float64(t / a))));
	elseif (t_1 <= 2e+259)
		tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a));
	else
		tmp = fma(-4.5, Float64(t * Float64(z / a)), Float64(Float64(0.5 * y) * Float64(x / a)));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+292], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision] + N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+259], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot \left(z \cdot 9\right)\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{y}{\frac{a}{x}}, -4.5 \cdot \left(z \cdot \frac{t}{a}\right)\right)\\

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+259}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\

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


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

    1. Initial program 60.1%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*60.1%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 57.2%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    5. Step-by-step derivation
      1. +-commutative57.2%

        \[\leadsto \color{blue}{0.5 \cdot \frac{y \cdot x}{a} + -4.5 \cdot \frac{t \cdot z}{a}} \]
      2. fma-def57.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{y \cdot x}{a}, -4.5 \cdot \frac{t \cdot z}{a}\right)} \]
      3. associate-/l*78.0%

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{\frac{y}{\frac{a}{x}}}, -4.5 \cdot \frac{t \cdot z}{a}\right) \]
      4. associate-/l*91.2%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{y}{\frac{a}{x}}, -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\right) \]
      5. associate-/r/88.4%

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

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

    if -2e292 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2e259

    1. Initial program 98.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*98.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv98.5%

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

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

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

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

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

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

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

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

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

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

    if 2e259 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))

    1. Initial program 68.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*68.0%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv68.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    7. Step-by-step derivation
      1. fma-def65.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-4.5, \frac{t \cdot z}{a}, 0.5 \cdot \frac{y \cdot x}{a}\right)} \]
      2. *-commutative65.2%

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{\color{blue}{z \cdot t}}{a}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      3. associate-*l/73.4%

        \[\leadsto \mathsf{fma}\left(-4.5, \color{blue}{\frac{z}{a} \cdot t}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      4. associate-*r/91.7%

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, 0.5 \cdot \color{blue}{\left(y \cdot \frac{x}{a}\right)}\right) \]
      5. associate-*l*91.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - t \cdot \left(z \cdot 9\right) \leq -2 \cdot 10^{+292}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{y}{\frac{a}{x}}, -4.5 \cdot \left(z \cdot \frac{t}{a}\right)\right)\\ \mathbf{elif}\;x \cdot y - t \cdot \left(z \cdot 9\right) \leq 2 \cdot 10^{+259}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4.5, t \cdot \frac{z}{a}, \left(0.5 \cdot y\right) \cdot \frac{x}{a}\right)\\ \end{array} \]

Alternative 2: 93.2% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -100000000:\\ \;\;\;\;\mathsf{fma}\left(-4.5, t \cdot \frac{z}{a}, \left(0.5 \cdot y\right) \cdot \frac{x}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* a 2.0) -100000000.0)
   (fma -4.5 (* t (/ z a)) (* (* 0.5 y) (/ x a)))
   (* (fma x y (* z (* t -9.0))) (/ 0.5 a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a * 2.0) <= -100000000.0) {
		tmp = fma(-4.5, (t * (z / a)), ((0.5 * y) * (x / a)));
	} else {
		tmp = fma(x, y, (z * (t * -9.0))) * (0.5 / a);
	}
	return tmp;
}
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(a * 2.0) <= -100000000.0)
		tmp = fma(-4.5, Float64(t * Float64(z / a)), Float64(Float64(0.5 * y) * Float64(x / a)));
	else
		tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -100000000.0], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -100000000:\\
\;\;\;\;\mathsf{fma}\left(-4.5, t \cdot \frac{z}{a}, \left(0.5 \cdot y\right) \cdot \frac{x}{a}\right)\\

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


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

    1. Initial program 74.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*74.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    7. Step-by-step derivation
      1. fma-def74.9%

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

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{\color{blue}{z \cdot t}}{a}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      3. associate-*l/82.0%

        \[\leadsto \mathsf{fma}\left(-4.5, \color{blue}{\frac{z}{a} \cdot t}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      4. associate-*r/97.1%

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, 0.5 \cdot \color{blue}{\left(y \cdot \frac{x}{a}\right)}\right) \]
      5. associate-*l*97.1%

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

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, \color{blue}{\frac{x}{a} \cdot \left(0.5 \cdot y\right)}\right) \]
    8. Simplified97.1%

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

    if -1e8 < (*.f64 a 2)

    1. Initial program 95.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -100000000:\\ \;\;\;\;\mathsf{fma}\left(-4.5, t \cdot \frac{z}{a}, \left(0.5 \cdot y\right) \cdot \frac{x}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \end{array} \]

Alternative 3: 93.3% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -1 \cdot 10^{-39}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{0.5 \cdot y}{a}, \left(-4.5 \cdot t\right) \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* a 2.0) -1e-39)
   (fma x (/ (* 0.5 y) a) (* (* -4.5 t) (/ z a)))
   (* (fma x y (* z (* t -9.0))) (/ 0.5 a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a * 2.0) <= -1e-39) {
		tmp = fma(x, ((0.5 * y) / a), ((-4.5 * t) * (z / a)));
	} else {
		tmp = fma(x, y, (z * (t * -9.0))) * (0.5 / a);
	}
	return tmp;
}
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(a * 2.0) <= -1e-39)
		tmp = fma(x, Float64(Float64(0.5 * y) / a), Float64(Float64(-4.5 * t) * Float64(z / a)));
	else
		tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -1e-39], N[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision] + N[(N[(-4.5 * t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -1 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{0.5 \cdot y}{a}, \left(-4.5 \cdot t\right) \cdot \frac{z}{a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a 2) < -9.99999999999999929e-40

    1. Initial program 76.3%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*76.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    7. Step-by-step derivation
      1. fma-def76.3%

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

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{\color{blue}{z \cdot t}}{a}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      3. associate-*l/83.0%

        \[\leadsto \mathsf{fma}\left(-4.5, \color{blue}{\frac{z}{a} \cdot t}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      4. associate-*r/97.2%

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, 0.5 \cdot \color{blue}{\left(y \cdot \frac{x}{a}\right)}\right) \]
      5. associate-*l*97.2%

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

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, \color{blue}{\frac{x}{a} \cdot \left(0.5 \cdot y\right)}\right) \]
    8. Simplified97.2%

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

        \[\leadsto \color{blue}{-4.5 \cdot \left(\frac{z}{a} \cdot t\right) + \frac{x}{a} \cdot \left(0.5 \cdot y\right)} \]
      2. *-commutative97.2%

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

        \[\leadsto -4.5 \cdot \left(t \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      4. div-inv97.2%

        \[\leadsto -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      5. associate-*r/97.1%

        \[\leadsto \color{blue}{\frac{-4.5 \cdot t}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      6. div-inv97.2%

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

        \[\leadsto \left(-4.5 \cdot t\right) \cdot \color{blue}{\frac{z}{a}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
    10. Applied egg-rr97.2%

      \[\leadsto \color{blue}{\left(-4.5 \cdot t\right) \cdot \frac{z}{a} + \frac{x}{a} \cdot \left(0.5 \cdot y\right)} \]
    11. Taylor expanded in t around 0 76.4%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    12. Step-by-step derivation
      1. *-commutative76.4%

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} + \color{blue}{\frac{y \cdot x}{a} \cdot 0.5} \]
      2. associate-/r/76.4%

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} + \color{blue}{\frac{y \cdot x}{\frac{a}{0.5}}} \]
      3. associate-*l/87.5%

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} + \color{blue}{\frac{y}{\frac{a}{0.5}} \cdot x} \]
      4. *-commutative87.5%

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} + \color{blue}{x \cdot \frac{y}{\frac{a}{0.5}}} \]
      5. +-commutative87.5%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\frac{a}{0.5}} + -4.5 \cdot \frac{t \cdot z}{a}} \]
      6. fma-udef87.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{\frac{a}{0.5}}, -4.5 \cdot \frac{t \cdot z}{a}\right)} \]
      7. associate-/l*87.5%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\frac{y \cdot 0.5}{a}}, -4.5 \cdot \frac{t \cdot z}{a}\right) \]
      8. *-commutative87.5%

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

        \[\leadsto \mathsf{fma}\left(x, \frac{0.5 \cdot y}{a}, \color{blue}{\frac{-4.5 \cdot \left(t \cdot z\right)}{a}}\right) \]
      10. associate-*r*87.5%

        \[\leadsto \mathsf{fma}\left(x, \frac{0.5 \cdot y}{a}, \frac{\color{blue}{\left(-4.5 \cdot t\right) \cdot z}}{a}\right) \]
      11. associate-*r/95.2%

        \[\leadsto \mathsf{fma}\left(x, \frac{0.5 \cdot y}{a}, \color{blue}{\left(-4.5 \cdot t\right) \cdot \frac{z}{a}}\right) \]
    13. Simplified95.2%

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

    if -9.99999999999999929e-40 < (*.f64 a 2)

    1. Initial program 95.3%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.2%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -1 \cdot 10^{-39}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{0.5 \cdot y}{a}, \left(-4.5 \cdot t\right) \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \end{array} \]

Alternative 4: 93.1% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -100000000:\\ \;\;\;\;\left(-4.5 \cdot t\right) \cdot \frac{z}{a} + \left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* a 2.0) -100000000.0)
   (+ (* (* -4.5 t) (/ z a)) (* (* 0.5 y) (/ x a)))
   (* (fma x y (* z (* t -9.0))) (/ 0.5 a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a * 2.0) <= -100000000.0) {
		tmp = ((-4.5 * t) * (z / a)) + ((0.5 * y) * (x / a));
	} else {
		tmp = fma(x, y, (z * (t * -9.0))) * (0.5 / a);
	}
	return tmp;
}
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(a * 2.0) <= -100000000.0)
		tmp = Float64(Float64(Float64(-4.5 * t) * Float64(z / a)) + Float64(Float64(0.5 * y) * Float64(x / a)));
	else
		tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -100000000.0], N[(N[(N[(-4.5 * t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -100000000:\\
\;\;\;\;\left(-4.5 \cdot t\right) \cdot \frac{z}{a} + \left(0.5 \cdot y\right) \cdot \frac{x}{a}\\

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


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

    1. Initial program 74.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*74.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    7. Step-by-step derivation
      1. fma-def74.9%

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

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{\color{blue}{z \cdot t}}{a}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      3. associate-*l/82.0%

        \[\leadsto \mathsf{fma}\left(-4.5, \color{blue}{\frac{z}{a} \cdot t}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      4. associate-*r/97.1%

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, 0.5 \cdot \color{blue}{\left(y \cdot \frac{x}{a}\right)}\right) \]
      5. associate-*l*97.1%

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

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, \color{blue}{\frac{x}{a} \cdot \left(0.5 \cdot y\right)}\right) \]
    8. Simplified97.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, \frac{x}{a} \cdot \left(0.5 \cdot y\right)\right)} \]
    9. Step-by-step derivation
      1. fma-udef97.1%

        \[\leadsto \color{blue}{-4.5 \cdot \left(\frac{z}{a} \cdot t\right) + \frac{x}{a} \cdot \left(0.5 \cdot y\right)} \]
      2. *-commutative97.1%

        \[\leadsto -4.5 \cdot \color{blue}{\left(t \cdot \frac{z}{a}\right)} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      3. clear-num97.0%

        \[\leadsto -4.5 \cdot \left(t \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      4. div-inv97.1%

        \[\leadsto -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      5. associate-*r/97.0%

        \[\leadsto \color{blue}{\frac{-4.5 \cdot t}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      6. div-inv97.0%

        \[\leadsto \color{blue}{\left(-4.5 \cdot t\right) \cdot \frac{1}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      7. clear-num97.0%

        \[\leadsto \left(-4.5 \cdot t\right) \cdot \color{blue}{\frac{z}{a}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
    10. Applied egg-rr97.0%

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

    if -1e8 < (*.f64 a 2)

    1. Initial program 95.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -100000000:\\ \;\;\;\;\left(-4.5 \cdot t\right) \cdot \frac{z}{a} + \left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}\\ \end{array} \]

Alternative 5: 96.8% accurate, 0.4× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a \cdot 2}\\


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

    1. Initial program 66.8%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*66.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a} + 0.5 \cdot \frac{y \cdot x}{a}} \]
    7. Step-by-step derivation
      1. fma-def64.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-4.5, \frac{t \cdot z}{a}, 0.5 \cdot \frac{y \cdot x}{a}\right)} \]
      2. *-commutative64.2%

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{\color{blue}{z \cdot t}}{a}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      3. associate-*l/72.9%

        \[\leadsto \mathsf{fma}\left(-4.5, \color{blue}{\frac{z}{a} \cdot t}, 0.5 \cdot \frac{y \cdot x}{a}\right) \]
      4. associate-*r/92.1%

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, 0.5 \cdot \color{blue}{\left(y \cdot \frac{x}{a}\right)}\right) \]
      5. associate-*l*92.1%

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

        \[\leadsto \mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, \color{blue}{\frac{x}{a} \cdot \left(0.5 \cdot y\right)}\right) \]
    8. Simplified92.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4.5, \frac{z}{a} \cdot t, \frac{x}{a} \cdot \left(0.5 \cdot y\right)\right)} \]
    9. Step-by-step derivation
      1. fma-udef92.1%

        \[\leadsto \color{blue}{-4.5 \cdot \left(\frac{z}{a} \cdot t\right) + \frac{x}{a} \cdot \left(0.5 \cdot y\right)} \]
      2. *-commutative92.1%

        \[\leadsto -4.5 \cdot \color{blue}{\left(t \cdot \frac{z}{a}\right)} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      3. clear-num92.1%

        \[\leadsto -4.5 \cdot \left(t \cdot \color{blue}{\frac{1}{\frac{a}{z}}}\right) + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      4. div-inv93.1%

        \[\leadsto -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      5. associate-*r/93.1%

        \[\leadsto \color{blue}{\frac{-4.5 \cdot t}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      6. div-inv92.1%

        \[\leadsto \color{blue}{\left(-4.5 \cdot t\right) \cdot \frac{1}{\frac{a}{z}}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
      7. clear-num92.1%

        \[\leadsto \left(-4.5 \cdot t\right) \cdot \color{blue}{\frac{z}{a}} + \frac{x}{a} \cdot \left(0.5 \cdot y\right) \]
    10. Applied egg-rr92.1%

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2.00000000000000004e234

    1. Initial program 98.5%

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

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

Alternative 6: 94.4% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 46.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*46.4%

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{y}{\frac{a}{x}}} \]
    7. Step-by-step derivation
      1. clear-num90.4%

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{\frac{a}{x}}{y}}} \]
    8. Applied egg-rr90.4%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{\frac{a}{x}}{y}}} \]
    9. Taylor expanded in a around 0 46.4%

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

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

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

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

    1. Initial program 95.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.5%

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

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

    if 9.9999999999999996e210 < (*.f64 x y)

    1. Initial program 70.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*70.4%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
      6. associate-*r/99.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;\frac{0.5}{\frac{\frac{a}{y}}{x}}\\ \mathbf{elif}\;x \cdot y \leq 10^{+211}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \end{array} \]

Alternative 7: 94.4% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 46.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*46.4%

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{y}{\frac{a}{x}}} \]
    7. Step-by-step derivation
      1. clear-num90.4%

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{\frac{a}{x}}{y}}} \]
    8. Applied egg-rr90.4%

      \[\leadsto \color{blue}{\frac{0.5}{\frac{\frac{a}{x}}{y}}} \]
    9. Taylor expanded in a around 0 46.4%

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

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

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

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

    1. Initial program 95.6%

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

    if 9.9999999999999996e210 < (*.f64 x y)

    1. Initial program 70.4%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*70.4%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
      6. associate-*r/99.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;\frac{0.5}{\frac{\frac{a}{y}}{x}}\\ \mathbf{elif}\;x \cdot y \leq 10^{+211}:\\ \;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \end{array} \]

Alternative 8: 66.5% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-120}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-13}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+57} \lor \neg \left(y \leq 7 \cdot 10^{+96}\right):\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= y -6e-120)
   (* x (/ (* 0.5 y) a))
   (if (<= y 1.15e-13)
     (* -4.5 (/ (* t z) a))
     (if (or (<= y 5.4e+57) (not (<= y 7e+96)))
       (* 0.5 (/ y (/ a x)))
       (* -4.5 (/ t (/ a z)))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -6e-120) {
		tmp = x * ((0.5 * y) / a);
	} else if (y <= 1.15e-13) {
		tmp = -4.5 * ((t * z) / a);
	} else if ((y <= 5.4e+57) || !(y <= 7e+96)) {
		tmp = 0.5 * (y / (a / x));
	} else {
		tmp = -4.5 * (t / (a / z));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (y <= (-6d-120)) then
        tmp = x * ((0.5d0 * y) / a)
    else if (y <= 1.15d-13) then
        tmp = (-4.5d0) * ((t * z) / a)
    else if ((y <= 5.4d+57) .or. (.not. (y <= 7d+96))) then
        tmp = 0.5d0 * (y / (a / x))
    else
        tmp = (-4.5d0) * (t / (a / z))
    end if
    code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -6e-120) {
		tmp = x * ((0.5 * y) / a);
	} else if (y <= 1.15e-13) {
		tmp = -4.5 * ((t * z) / a);
	} else if ((y <= 5.4e+57) || !(y <= 7e+96)) {
		tmp = 0.5 * (y / (a / x));
	} else {
		tmp = -4.5 * (t / (a / z));
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if y <= -6e-120:
		tmp = x * ((0.5 * y) / a)
	elif y <= 1.15e-13:
		tmp = -4.5 * ((t * z) / a)
	elif (y <= 5.4e+57) or not (y <= 7e+96):
		tmp = 0.5 * (y / (a / x))
	else:
		tmp = -4.5 * (t / (a / z))
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	tmp = 0.0
	if (y <= -6e-120)
		tmp = Float64(x * Float64(Float64(0.5 * y) / a));
	elseif (y <= 1.15e-13)
		tmp = Float64(-4.5 * Float64(Float64(t * z) / a));
	elseif ((y <= 5.4e+57) || !(y <= 7e+96))
		tmp = Float64(0.5 * Float64(y / Float64(a / x)));
	else
		tmp = Float64(-4.5 * Float64(t / Float64(a / z)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (y <= -6e-120)
		tmp = x * ((0.5 * y) / a);
	elseif (y <= 1.15e-13)
		tmp = -4.5 * ((t * z) / a);
	elseif ((y <= 5.4e+57) || ~((y <= 7e+96)))
		tmp = 0.5 * (y / (a / x));
	else
		tmp = -4.5 * (t / (a / z));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -6e-120], N[(x * N[(N[(0.5 * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-13], N[(-4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 5.4e+57], N[Not[LessEqual[y, 7e+96]], $MachinePrecision]], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-120}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\

\mathbf{elif}\;y \leq 1.15 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+57} \lor \neg \left(y \leq 7 \cdot 10^{+96}\right):\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -6.00000000000000022e-120

    1. Initial program 86.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(y \cdot x\right)}{a}} \]
      2. *-commutative50.4%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
      6. associate-*r/55.3%

        \[\leadsto x \cdot \color{blue}{\frac{y \cdot 0.5}{a}} \]
      7. *-commutative55.3%

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

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

    if -6.00000000000000022e-120 < y < 1.1499999999999999e-13

    1. Initial program 95.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 76.0%

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

    if 1.1499999999999999e-13 < y < 5.3999999999999997e57 or 6.9999999999999998e96 < y

    1. Initial program 82.3%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*82.3%

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

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

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

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

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

    if 5.3999999999999997e57 < y < 6.9999999999999998e96

    1. Initial program 83.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*83.3%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 53.3%

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

        \[\leadsto -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}} \]
    6. Simplified53.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-120}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-13}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+57} \lor \neg \left(y \leq 7 \cdot 10^{+96}\right):\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array} \]

Alternative 9: 64.5% accurate, 0.9× speedup?

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

\mathbf{elif}\;z \leq -2.9 \cdot 10^{+80}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -8.5 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;z \leq 3.4 \cdot 10^{-38}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 85.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*85.4%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 82.5%

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

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

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

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

    if -2e176 < z < -2.89999999999999986e80 or -8.5000000000000001e-13 < z < 3.4000000000000002e-38

    1. Initial program 90.8%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*90.7%

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{a}{x}}} \]
    6. Simplified64.7%

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

    if -2.89999999999999986e80 < z < -8.5000000000000001e-13

    1. Initial program 95.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.1%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 76.5%

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

    if 3.4000000000000002e-38 < z

    1. Initial program 85.1%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*85.1%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 51.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2 \cdot 10^{+176}:\\ \;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+80}:\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-13}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-38}:\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array} \]

Alternative 10: 66.8% accurate, 0.9× speedup?

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

\mathbf{elif}\;y \leq 1.1 \cdot 10^{-12}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;y \leq 7.5 \cdot 10^{+96}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -2.9e-120

    1. Initial program 86.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(y \cdot x\right)}{a}} \]
      2. *-commutative50.4%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
      6. associate-*r/55.3%

        \[\leadsto x \cdot \color{blue}{\frac{y \cdot 0.5}{a}} \]
      7. *-commutative55.3%

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

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

    if -2.9e-120 < y < 1.09999999999999996e-12

    1. Initial program 95.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 76.0%

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

    if 1.09999999999999996e-12 < y < 1.26e63

    1. Initial program 93.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*93.1%

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{a}{x}}} \]
    6. Simplified70.0%

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

    if 1.26e63 < y < 7.4999999999999996e96

    1. Initial program 83.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*83.3%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 53.3%

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

        \[\leadsto -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}} \]
    6. Simplified53.6%

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

    if 7.4999999999999996e96 < y

    1. Initial program 78.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*78.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{-120}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-12}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+96}:\\ \;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \end{array} \]

Alternative 11: 66.8% accurate, 0.9× speedup?

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

\mathbf{elif}\;y \leq 8 \cdot 10^{-12}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+63}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+96}:\\
\;\;\;\;\frac{-4.5}{\frac{\frac{a}{z}}{t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -6.00000000000000022e-120

    1. Initial program 86.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(y \cdot x\right)}{a}} \]
      2. *-commutative50.4%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
      6. associate-*r/55.3%

        \[\leadsto x \cdot \color{blue}{\frac{y \cdot 0.5}{a}} \]
      7. *-commutative55.3%

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

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

    if -6.00000000000000022e-120 < y < 7.99999999999999984e-12

    1. Initial program 95.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 76.0%

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

    if 7.99999999999999984e-12 < y < 7.19999999999999998e63

    1. Initial program 93.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*93.1%

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{a}{x}}} \]
    6. Simplified70.0%

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

    if 7.19999999999999998e63 < y < 6.9999999999999998e96

    1. Initial program 83.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*83.3%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 53.3%

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

        \[\leadsto -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}} \]
    6. Simplified53.6%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t}{\frac{a}{z}}} \]
    7. Step-by-step derivation
      1. clear-num53.6%

        \[\leadsto -4.5 \cdot \color{blue}{\frac{1}{\frac{\frac{a}{z}}{t}}} \]
      2. un-div-inv53.4%

        \[\leadsto \color{blue}{\frac{-4.5}{\frac{\frac{a}{z}}{t}}} \]
    8. Applied egg-rr53.4%

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

    if 6.9999999999999998e96 < y

    1. Initial program 78.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*78.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-120}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-12}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+63}:\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+96}:\\ \;\;\;\;\frac{-4.5}{\frac{\frac{a}{z}}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \end{array} \]

Alternative 12: 66.8% accurate, 0.9× speedup?

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

\mathbf{elif}\;y \leq 1.46 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\

\mathbf{elif}\;y \leq 7 \cdot 10^{+96}:\\
\;\;\;\;\frac{z}{-0.2222222222222222 \cdot \frac{a}{t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -6.00000000000000022e-120

    1. Initial program 86.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(y \cdot x\right)}{a}} \]
      2. *-commutative50.4%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
      6. associate-*r/55.3%

        \[\leadsto x \cdot \color{blue}{\frac{y \cdot 0.5}{a}} \]
      7. *-commutative55.3%

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

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

    if -6.00000000000000022e-120 < y < 1.46000000000000009e-13

    1. Initial program 95.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 76.0%

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

    if 1.46000000000000009e-13 < y < 1.26e63

    1. Initial program 93.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*93.1%

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{a}{x}}} \]
    6. Simplified70.0%

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

    if 1.26e63 < y < 6.9999999999999998e96

    1. Initial program 83.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*83.3%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 53.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{a \cdot 2}{t \cdot -9}}} \]
      2. div-inv51.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{z \cdot 1}{\frac{a}{t} \cdot -0.2222222222222222}} \]
      2. *-rgt-identity66.2%

        \[\leadsto \frac{\color{blue}{z}}{\frac{a}{t} \cdot -0.2222222222222222} \]
      3. *-commutative66.2%

        \[\leadsto \frac{z}{\color{blue}{-0.2222222222222222 \cdot \frac{a}{t}}} \]
    10. Simplified66.2%

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

    if 6.9999999999999998e96 < y

    1. Initial program 78.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*78.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-120}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \mathbf{elif}\;y \leq 1.46 \cdot 10^{-13}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{+63}:\\ \;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+96}:\\ \;\;\;\;\frac{z}{-0.2222222222222222 \cdot \frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \end{array} \]

Alternative 13: 66.8% accurate, 0.9× speedup?

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

\mathbf{elif}\;y \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\

\mathbf{elif}\;y \leq 6.6 \cdot 10^{+63}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2}\\

\mathbf{elif}\;y \leq 1.42 \cdot 10^{+97}:\\
\;\;\;\;\frac{z}{-0.2222222222222222 \cdot \frac{a}{t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -5.89999999999999979e-120

    1. Initial program 86.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(y \cdot x\right)}{a}} \]
      2. *-commutative50.4%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
      6. associate-*r/55.3%

        \[\leadsto x \cdot \color{blue}{\frac{y \cdot 0.5}{a}} \]
      7. *-commutative55.3%

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

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

    if -5.89999999999999979e-120 < y < 1.7500000000000001e-13

    1. Initial program 95.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 76.0%

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

    if 1.7500000000000001e-13 < y < 6.6000000000000003e63

    1. Initial program 93.0%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*93.1%

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

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

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

    if 6.6000000000000003e63 < y < 1.41999999999999991e97

    1. Initial program 83.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*83.3%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 53.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{a \cdot 2}{t \cdot -9}}} \]
      2. div-inv51.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{z \cdot 1}{\frac{a}{t} \cdot -0.2222222222222222}} \]
      2. *-rgt-identity66.2%

        \[\leadsto \frac{\color{blue}{z}}{\frac{a}{t} \cdot -0.2222222222222222} \]
      3. *-commutative66.2%

        \[\leadsto \frac{z}{\color{blue}{-0.2222222222222222 \cdot \frac{a}{t}}} \]
    10. Simplified66.2%

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

    if 1.41999999999999991e97 < y

    1. Initial program 78.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*78.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Step-by-step derivation
      1. div-inv78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.9 \cdot 10^{-120}:\\ \;\;\;\;x \cdot \frac{0.5 \cdot y}{a}\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-13}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{+63}:\\ \;\;\;\;\frac{x \cdot y}{a \cdot 2}\\ \mathbf{elif}\;y \leq 1.42 \cdot 10^{+97}:\\ \;\;\;\;\frac{z}{-0.2222222222222222 \cdot \frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot y\right) \cdot \frac{x}{a}\\ \end{array} \]

Alternative 14: 51.4% accurate, 1.4× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.60000000000000009e51

    1. Initial program 71.9%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*71.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 41.9%

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

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

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

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

    if -5.60000000000000009e51 < a

    1. Initial program 95.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. associate-*l*95.1%

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

      \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
    4. Taylor expanded in x around 0 52.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.6 \cdot 10^{+51}:\\ \;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \frac{t \cdot z}{a}\\ \end{array} \]

Alternative 15: 51.4% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ -4.5 \cdot \left(z \cdot \frac{t}{a}\right) \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ t a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	return -4.5 * (z * (t / a));
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (-4.5d0) * (z * (t / a))
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	return -4.5 * (z * (t / a));
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	return -4.5 * (z * (t / a))
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	return Float64(-4.5 * Float64(z * Float64(t / a)))
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
	tmp = -4.5 * (z * (t / a));
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Derivation
  1. Initial program 89.0%

    \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
  2. Step-by-step derivation
    1. associate-*l*88.9%

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

    \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
  4. Taylor expanded in x around 0 49.7%

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

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

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

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

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

Alternative 16: 51.1% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ -4.5 \cdot \frac{t}{\frac{a}{z}} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a) :precision binary64 (* -4.5 (/ t (/ a z))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	return -4.5 * (t / (a / z));
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (-4.5d0) * (t / (a / z))
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	return -4.5 * (t / (a / z));
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	return -4.5 * (t / (a / z))
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	return Float64(-4.5 * Float64(t / Float64(a / z)))
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
	tmp = -4.5 * (t / (a / z));
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \frac{t}{\frac{a}{z}}
\end{array}
Derivation
  1. Initial program 89.0%

    \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
  2. Step-by-step derivation
    1. associate-*l*88.9%

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

    \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}} \]
  4. Taylor expanded in x around 0 49.7%

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

      \[\leadsto -4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}} \]
  6. Simplified49.2%

    \[\leadsto \color{blue}{-4.5 \cdot \frac{t}{\frac{a}{z}}} \]
  7. Final simplification49.2%

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

Developer target: 93.7% accurate, 0.7× 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 2023274 
(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)))