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

Percentage Accurate: 90.9% → 96.5%
Time: 10.2s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 90.9% 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.5% 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 - \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+287}\right):\\ \;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right) + \left(x \cdot \frac{y}{a}\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{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) (* (* z 9.0) t))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+287)))
     (+ (* -4.5 (* z (/ t a))) (* (* x (/ y a)) 0.5))
     (/ (fma x y (* z (* t -9.0))) (* 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) - ((z * 9.0) * t);
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+287)) {
		tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
	} else {
		tmp = fma(x, y, (z * (t * -9.0))) / (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(Float64(z * 9.0) * t))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+287))
		tmp = Float64(Float64(-4.5 * Float64(z * Float64(t / a))) + Float64(Float64(x * Float64(y / a)) * 0.5));
	else
		tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0));
	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[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+287]], $MachinePrecision]], N[(N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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 - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+287}\right):\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right) + \left(x \cdot \frac{y}{a}\right) \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{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.0000000000000002e287 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))

    1. Initial program 59.3%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-59.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-59.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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-def56.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2.0000000000000002e287

    1. Initial program 97.7%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(x \cdot y + 0\right) - \left(z \cdot 9\right) \cdot t}{a \cdot 2}} \]
      4. +-rgt-identity97.7%

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

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

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

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

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

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

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

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

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

Alternative 2: 96.5% 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 - \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+287}\right):\\ \;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right) + \left(x \cdot \frac{y}{a}\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{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) (* (* z 9.0) t))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+287)))
     (+ (* -4.5 (* z (/ t a))) (* (* x (/ y a)) 0.5))
     (/ (- (* x y) (* z (* 9.0 t))) (* 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) - ((z * 9.0) * t);
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+287)) {
		tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
	} else {
		tmp = ((x * y) - (z * (9.0 * t))) / (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) - ((z * 9.0) * t);
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+287)) {
		tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
	} else {
		tmp = ((x * y) - (z * (9.0 * t))) / (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) - ((z * 9.0) * t)
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 2e+287):
		tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5)
	else:
		tmp = ((x * y) - (z * (9.0 * t))) / (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(Float64(z * 9.0) * t))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+287))
		tmp = Float64(Float64(-4.5 * Float64(z * Float64(t / a))) + Float64(Float64(x * Float64(y / a)) * 0.5));
	else
		tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / 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) - ((z * 9.0) * t);
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 2e+287)))
		tmp = (-4.5 * (z * (t / a))) + ((x * (y / a)) * 0.5);
	else
		tmp = ((x * y) - (z * (9.0 * t))) / (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[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+287]], $MachinePrecision]], N[(N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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 - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+287}\right):\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right) + \left(x \cdot \frac{y}{a}\right) \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{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.0000000000000002e287 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))

    1. Initial program 59.3%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-59.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-59.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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-def56.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2.0000000000000002e287

    1. Initial program 97.7%

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

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

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

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

Alternative 3: 94.7% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+296}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{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 (* (* z 9.0) t)))
   (if (<= t_1 (- INFINITY))
     (* -4.5 (* z (/ t a)))
     (if (<= t_1 2e+296)
       (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
       (* z (* -4.5 (/ t a)))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = -4.5 * (z * (t / a));
	} else if (t_1 <= 2e+296) {
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
	} else {
		tmp = z * (-4.5 * (t / a));
	}
	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 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = -4.5 * (z * (t / a));
	} else if (t_1 <= 2e+296) {
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
	} else {
		tmp = z * (-4.5 * (t / a));
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	t_1 = (z * 9.0) * t
	tmp = 0
	if t_1 <= -math.inf:
		tmp = -4.5 * (z * (t / a))
	elif t_1 <= 2e+296:
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0)
	else:
		tmp = z * (-4.5 * (t / a))
	return tmp
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(z * 9.0) * t)
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(-4.5 * Float64(z * Float64(t / a)));
	elseif (t_1 <= 2e+296)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0));
	else
		tmp = Float64(z * Float64(-4.5 * Float64(t / 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)
	t_1 = (z * 9.0) * t;
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = -4.5 * (z * (t / a));
	elseif (t_1 <= 2e+296)
		tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
	else
		tmp = z * (-4.5 * (t / 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_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+296], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(-4.5 * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\

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

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


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

    1. Initial program 49.7%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(x \cdot y + 0\right) - \left(z \cdot 9\right) \cdot t}{a \cdot 2}} \]
      4. +-rgt-identity49.7%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\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*87.9%

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

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

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

    if -inf.0 < (*.f64 (*.f64 z 9) t) < 1.99999999999999996e296

    1. Initial program 94.2%

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

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

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

    if 1.99999999999999996e296 < (*.f64 (*.f64 z 9) t)

    1. Initial program 56.5%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg56.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-56.5%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-56.5%

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

        \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
      15. distribute-lft-neg-out56.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{t \cdot z}{a} \cdot -4.5} \]
      2. *-commutative67.9%

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

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

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

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

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

Alternative 4: 94.8% 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:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+287}:\\ \;\;\;\;\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y \cdot 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 (<= (* x y) (- INFINITY))
   (* x (* y (/ 0.5 a)))
   (if (<= (* x y) 2e+287)
     (* (- (* x y) (* (* z 9.0) t)) (/ 0.5 a))
     (* x (/ (* y 0.5) 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 = x * (y * (0.5 / a));
	} else if ((x * y) <= 2e+287) {
		tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a);
	} else {
		tmp = x * ((y * 0.5) / 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 = x * (y * (0.5 / a));
	} else if ((x * y) <= 2e+287) {
		tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a);
	} else {
		tmp = x * ((y * 0.5) / 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 = x * (y * (0.5 / a))
	elif (x * y) <= 2e+287:
		tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a)
	else:
		tmp = x * ((y * 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(x * y) <= Float64(-Inf))
		tmp = Float64(x * Float64(y * Float64(0.5 / a)));
	elseif (Float64(x * y) <= 2e+287)
		tmp = Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) * Float64(0.5 / a));
	else
		tmp = Float64(x * Float64(Float64(y * 0.5) / 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 = x * (y * (0.5 / a));
	elseif ((x * y) <= 2e+287)
		tmp = ((x * y) - ((z * 9.0) * t)) * (0.5 / a);
	else
		tmp = x * ((y * 0.5) / 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[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+287], N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y * 0.5), $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:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\

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

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


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

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{\frac{a}{0.5}}} \]
    7. Step-by-step derivation
      1. div-inv70.6%

        \[\leadsto \frac{y \cdot x}{\color{blue}{a \cdot \frac{1}{0.5}}} \]
      2. metadata-eval70.6%

        \[\leadsto \frac{y \cdot x}{a \cdot \color{blue}{2}} \]
      3. div-inv70.6%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
    8. Applied egg-rr95.5%

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

    if -inf.0 < (*.f64 x y) < 2.0000000000000002e287

    1. Initial program 93.7%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg93.7%

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-93.7%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-93.6%

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

        \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
      15. distribute-lft-neg-out93.6%

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000002e287 < (*.f64 x y)

    1. Initial program 49.6%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(x \cdot y + 0\right) - \left(z \cdot 9\right) \cdot t}{a \cdot 2}} \]
      4. +-rgt-identity49.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot x}{a \cdot \color{blue}{2}} \]
      3. div-inv54.4%

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

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{a \cdot 2} \]
      5. metadata-eval54.4%

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
    8. Applied egg-rr81.1%

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

        \[\leadsto x \cdot \color{blue}{\frac{y \cdot 0.5}{a}} \]
    10. Applied egg-rr81.1%

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

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

Alternative 5: 67.5% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-72} \lor \neg \left(y \leq 8.6 \cdot 10^{-16}\right):\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{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
 (if (or (<= y -2.6e-72) (not (<= y 8.6e-16)))
   (* x (* y (/ 0.5 a)))
   (* t (* -4.5 (/ z a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -2.6e-72) || !(y <= 8.6e-16)) {
		tmp = x * (y * (0.5 / a));
	} else {
		tmp = t * (-4.5 * (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 ((y <= (-2.6d-72)) .or. (.not. (y <= 8.6d-16))) then
        tmp = x * (y * (0.5d0 / a))
    else
        tmp = t * ((-4.5d0) * (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 ((y <= -2.6e-72) || !(y <= 8.6e-16)) {
		tmp = x * (y * (0.5 / a));
	} else {
		tmp = t * (-4.5 * (z / 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.6e-72) or not (y <= 8.6e-16):
		tmp = x * (y * (0.5 / a))
	else:
		tmp = t * (-4.5 * (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 ((y <= -2.6e-72) || !(y <= 8.6e-16))
		tmp = Float64(x * Float64(y * Float64(0.5 / a)));
	else
		tmp = Float64(t * Float64(-4.5 * Float64(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 ((y <= -2.6e-72) || ~((y <= 8.6e-16)))
		tmp = x * (y * (0.5 / a));
	else
		tmp = t * (-4.5 * (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[Or[LessEqual[y, -2.6e-72], N[Not[LessEqual[y, 8.6e-16]], $MachinePrecision]], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(-4.5 * N[(z / a), $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 -2.6 \cdot 10^{-72} \lor \neg \left(y \leq 8.6 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.59999999999999996e-72 or 8.5999999999999997e-16 < y

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\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-*r/59.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{\frac{a}{0.5}}} \]
    7. Step-by-step derivation
      1. div-inv59.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{a \cdot \frac{1}{0.5}}} \]
      2. metadata-eval59.2%

        \[\leadsto \frac{y \cdot x}{a \cdot \color{blue}{2}} \]
      3. div-inv59.2%

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

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{a \cdot 2} \]
      5. metadata-eval59.2%

        \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{a \cdot \color{blue}{\frac{1}{0.5}}} \]
      6. div-inv59.2%

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

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

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

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

    if -2.59999999999999996e-72 < y < 8.5999999999999997e-16

    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. sub-neg93.0%

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-93.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(-x \cdot y\right) + \left(z \cdot 9\right) \cdot t\right)} \cdot \frac{-1}{a \cdot 2} \]
      12. neg-sub093.0%

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-93.0%

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

        \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
      15. distribute-lft-neg-out93.0%

        \[\leadsto \color{blue}{-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2}} \]
      16. distribute-rgt-neg-in93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(a \cdot 2\right) - \left(a \cdot 2\right) \cdot \left(t \cdot \left(z \cdot 9\right)\right)}{\left(a \cdot a\right) \cdot 4}} \]
    6. Taylor expanded in x around 0 90.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-def90.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-4.5 \cdot t}{\frac{a}{z}}} \]
      3. *-rgt-identity69.2%

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

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

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

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

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

        \[\leadsto t \cdot \left(-4.5 \cdot \color{blue}{\frac{1 \cdot z}{a}}\right) \]
      9. *-lft-identity69.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-72} \lor \neg \left(y \leq 8.6 \cdot 10^{-16}\right):\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \end{array} \]

Alternative 6: 67.6% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-15}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y \cdot 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 (<= y -3.2e-72)
   (* x (* y (/ 0.5 a)))
   (if (<= y 1.1e-15) (* t (* -4.5 (/ z a))) (* x (/ (* y 0.5) a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -3.2e-72) {
		tmp = x * (y * (0.5 / a));
	} else if (y <= 1.1e-15) {
		tmp = t * (-4.5 * (z / a));
	} else {
		tmp = x * ((y * 0.5) / 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 <= (-3.2d-72)) then
        tmp = x * (y * (0.5d0 / a))
    else if (y <= 1.1d-15) then
        tmp = t * ((-4.5d0) * (z / a))
    else
        tmp = x * ((y * 0.5d0) / 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 <= -3.2e-72) {
		tmp = x * (y * (0.5 / a));
	} else if (y <= 1.1e-15) {
		tmp = t * (-4.5 * (z / a));
	} else {
		tmp = x * ((y * 0.5) / a);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if y <= -3.2e-72:
		tmp = x * (y * (0.5 / a))
	elif y <= 1.1e-15:
		tmp = t * (-4.5 * (z / a))
	else:
		tmp = x * ((y * 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 (y <= -3.2e-72)
		tmp = Float64(x * Float64(y * Float64(0.5 / a)));
	elseif (y <= 1.1e-15)
		tmp = Float64(t * Float64(-4.5 * Float64(z / a)));
	else
		tmp = Float64(x * Float64(Float64(y * 0.5) / 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 <= -3.2e-72)
		tmp = x * (y * (0.5 / a));
	elseif (y <= 1.1e-15)
		tmp = t * (-4.5 * (z / a));
	else
		tmp = x * ((y * 0.5) / 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, -3.2e-72], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-15], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y * 0.5), $MachinePrecision] / 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 -3.2 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{-15}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.19999999999999999e-72

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot x}{a \cdot \color{blue}{2}} \]
      3. div-inv51.4%

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

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{a \cdot 2} \]
      5. metadata-eval51.4%

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

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

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

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

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

    if -3.19999999999999999e-72 < y < 1.09999999999999993e-15

    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. sub-neg93.0%

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-93.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(-x \cdot y\right) + \left(z \cdot 9\right) \cdot t\right)} \cdot \frac{-1}{a \cdot 2} \]
      12. neg-sub093.0%

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-93.0%

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

        \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
      15. distribute-lft-neg-out93.0%

        \[\leadsto \color{blue}{-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2}} \]
      16. distribute-rgt-neg-in93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(a \cdot 2\right) - \left(a \cdot 2\right) \cdot \left(t \cdot \left(z \cdot 9\right)\right)}{\left(a \cdot a\right) \cdot 4}} \]
    6. Taylor expanded in x around 0 90.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-def90.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-4.5 \cdot t}{\frac{a}{z}}} \]
      3. *-rgt-identity69.2%

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

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

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

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

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

        \[\leadsto t \cdot \left(-4.5 \cdot \color{blue}{\frac{1 \cdot z}{a}}\right) \]
      9. *-lft-identity69.4%

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

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

    if 1.09999999999999993e-15 < y

    1. Initial program 83.6%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(x \cdot y + 0\right) - \left(z \cdot 9\right) \cdot t}{a \cdot 2}} \]
      4. +-rgt-identity83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{\frac{a}{0.5}}} \]
    7. Step-by-step derivation
      1. div-inv69.9%

        \[\leadsto \frac{y \cdot x}{\color{blue}{a \cdot \frac{1}{0.5}}} \]
      2. metadata-eval69.9%

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

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

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{a \cdot 2} \]
      5. metadata-eval69.8%

        \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{a \cdot \color{blue}{\frac{1}{0.5}}} \]
      6. div-inv69.8%

        \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{\color{blue}{\frac{a}{0.5}}} \]
      7. clear-num69.8%

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

        \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{0.5}{a}\right)} \]
    8. Applied egg-rr73.2%

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

        \[\leadsto x \cdot \color{blue}{\frac{y \cdot 0.5}{a}} \]
    10. Applied egg-rr73.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-15}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y \cdot 0.5}{a}\\ \end{array} \]

Alternative 7: 66.2% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-16}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\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 (<= y -1.05e-72)
   (* x (* y (/ 0.5 a)))
   (if (<= y 8.6e-16) (* t (* -4.5 (/ z a))) (* (* x y) (/ 0.5 a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -1.05e-72) {
		tmp = x * (y * (0.5 / a));
	} else if (y <= 8.6e-16) {
		tmp = t * (-4.5 * (z / a));
	} else {
		tmp = (x * y) * (0.5 / 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 <= (-1.05d-72)) then
        tmp = x * (y * (0.5d0 / a))
    else if (y <= 8.6d-16) then
        tmp = t * ((-4.5d0) * (z / a))
    else
        tmp = (x * y) * (0.5d0 / 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 <= -1.05e-72) {
		tmp = x * (y * (0.5 / a));
	} else if (y <= 8.6e-16) {
		tmp = t * (-4.5 * (z / a));
	} else {
		tmp = (x * y) * (0.5 / a);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if y <= -1.05e-72:
		tmp = x * (y * (0.5 / a))
	elif y <= 8.6e-16:
		tmp = t * (-4.5 * (z / a))
	else:
		tmp = (x * y) * (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 (y <= -1.05e-72)
		tmp = Float64(x * Float64(y * Float64(0.5 / a)));
	elseif (y <= 8.6e-16)
		tmp = Float64(t * Float64(-4.5 * Float64(z / a)));
	else
		tmp = Float64(Float64(x * y) * Float64(0.5 / 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 <= -1.05e-72)
		tmp = x * (y * (0.5 / a));
	elseif (y <= 8.6e-16)
		tmp = t * (-4.5 * (z / a));
	else
		tmp = (x * y) * (0.5 / 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, -1.05e-72], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.6e-16], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $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}\;y \leq -1.05 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\

\mathbf{elif}\;y \leq 8.6 \cdot 10^{-16}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.05e-72

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot x}{a \cdot \color{blue}{2}} \]
      3. div-inv51.4%

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

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{a \cdot 2} \]
      5. metadata-eval51.4%

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

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

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

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

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

    if -1.05e-72 < y < 8.5999999999999997e-16

    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. sub-neg93.0%

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-93.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(-x \cdot y\right) + \left(z \cdot 9\right) \cdot t\right)} \cdot \frac{-1}{a \cdot 2} \]
      12. neg-sub093.0%

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-93.0%

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

        \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
      15. distribute-lft-neg-out93.0%

        \[\leadsto \color{blue}{-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2}} \]
      16. distribute-rgt-neg-in93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(a \cdot 2\right) - \left(a \cdot 2\right) \cdot \left(t \cdot \left(z \cdot 9\right)\right)}{\left(a \cdot a\right) \cdot 4}} \]
    6. Taylor expanded in x around 0 90.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-def90.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-4.5 \cdot t}{\frac{a}{z}}} \]
      3. *-rgt-identity69.2%

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

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

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

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

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

        \[\leadsto t \cdot \left(-4.5 \cdot \color{blue}{\frac{1 \cdot z}{a}}\right) \]
      9. *-lft-identity69.4%

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

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

    if 8.5999999999999997e-16 < y

    1. Initial program 83.6%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Step-by-step derivation
      1. sub-neg83.6%

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-83.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-83.5%

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

        \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
      15. distribute-lft-neg-out83.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-16}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{0.5}{a}\\ \end{array} \]

Alternative 8: 66.3% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;y \leq 10^{-15}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{\frac{a}{0.5}}\\ \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.4e-76)
   (* x (* y (/ 0.5 a)))
   (if (<= y 1e-15) (* t (* -4.5 (/ z a))) (/ (* x y) (/ a 0.5)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -5.4e-76) {
		tmp = x * (y * (0.5 / a));
	} else if (y <= 1e-15) {
		tmp = t * (-4.5 * (z / a));
	} else {
		tmp = (x * y) / (a / 0.5);
	}
	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.4d-76)) then
        tmp = x * (y * (0.5d0 / a))
    else if (y <= 1d-15) then
        tmp = t * ((-4.5d0) * (z / a))
    else
        tmp = (x * y) / (a / 0.5d0)
    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.4e-76) {
		tmp = x * (y * (0.5 / a));
	} else if (y <= 1e-15) {
		tmp = t * (-4.5 * (z / a));
	} else {
		tmp = (x * y) / (a / 0.5);
	}
	return tmp;
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	tmp = 0
	if y <= -5.4e-76:
		tmp = x * (y * (0.5 / a))
	elif y <= 1e-15:
		tmp = t * (-4.5 * (z / a))
	else:
		tmp = (x * y) / (a / 0.5)
	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.4e-76)
		tmp = Float64(x * Float64(y * Float64(0.5 / a)));
	elseif (y <= 1e-15)
		tmp = Float64(t * Float64(-4.5 * Float64(z / a)));
	else
		tmp = Float64(Float64(x * y) / Float64(a / 0.5));
	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.4e-76)
		tmp = x * (y * (0.5 / a));
	elseif (y <= 1e-15)
		tmp = t * (-4.5 * (z / a));
	else
		tmp = (x * y) / (a / 0.5);
	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.4e-76], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e-15], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(a / 0.5), $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.4 \cdot 10^{-76}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\

\mathbf{elif}\;y \leq 10^{-15}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.4000000000000001e-76

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{\frac{a}{0.5}}} \]
    7. Step-by-step derivation
      1. div-inv50.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{a \cdot \frac{1}{0.5}}} \]
      2. metadata-eval50.8%

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

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

        \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{1}{a \cdot 2} \]
      5. metadata-eval50.8%

        \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{a \cdot \color{blue}{\frac{1}{0.5}}} \]
      6. div-inv50.8%

        \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{\color{blue}{\frac{a}{0.5}}} \]
      7. clear-num50.8%

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

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

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

    if -5.4000000000000001e-76 < y < 1.0000000000000001e-15

    1. Initial program 92.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
      4. associate-+l-92.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
      13. associate-+l-92.9%

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

        \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
      15. distribute-lft-neg-out92.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t \cdot \left(-4.5 \cdot \color{blue}{\frac{1 \cdot z}{a}}\right) \]
      9. *-lft-identity69.1%

        \[\leadsto t \cdot \left(-4.5 \cdot \frac{\color{blue}{z}}{a}\right) \]
    11. Simplified69.1%

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

    if 1.0000000000000001e-15 < y

    1. Initial program 83.6%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(x \cdot y + 0\right) - \left(z \cdot 9\right) \cdot t}{a \cdot 2}} \]
      4. +-rgt-identity83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\ \mathbf{elif}\;y \leq 10^{-15}:\\ \;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{\frac{a}{0.5}}\\ \end{array} \]

Alternative 9: 51.1% 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 88.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot y + 0\right) - \left(z \cdot 9\right) \cdot t}{a \cdot 2}} \]
    4. +-rgt-identity88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 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 88.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot y + 0\right) - \left(z \cdot 9\right) \cdot t}{a \cdot 2}} \]
    4. +-rgt-identity88.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 51.2% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ [z, t] = \mathsf{sort}([z, t])\\ \\ t \cdot \left(-4.5 \cdot \frac{z}{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 (* t (* -4.5 (/ z a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
	return t * (-4.5 * (z / 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 = t * ((-4.5d0) * (z / a))
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
	return t * (-4.5 * (z / a));
}
[x, y] = sort([x, y])
[z, t] = sort([z, t])
def code(x, y, z, t, a):
	return t * (-4.5 * (z / a))
x, y = sort([x, y])
z, t = sort([z, t])
function code(x, y, z, t, a)
	return Float64(t * Float64(-4.5 * Float64(z / a)))
end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
	tmp = t * (-4.5 * (z / 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[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
t \cdot \left(-4.5 \cdot \frac{z}{a}\right)
\end{array}
Derivation
  1. Initial program 88.6%

    \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
  2. Step-by-step derivation
    1. sub-neg88.6%

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

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

      \[\leadsto \frac{\color{blue}{\left(0 - \left(z \cdot 9\right) \cdot t\right)} + x \cdot y}{a \cdot 2} \]
    4. associate-+l-88.6%

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\left(0 - x \cdot y\right)} + \left(z \cdot 9\right) \cdot t\right) \cdot \frac{-1}{a \cdot 2} \]
    13. associate-+l-88.5%

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

      \[\leadsto \color{blue}{\left(-\left(x \cdot y - \left(z \cdot 9\right) \cdot t\right)\right)} \cdot \frac{-1}{a \cdot 2} \]
    15. distribute-lft-neg-out88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-4.5 \cdot t}{\frac{a}{z}}} \]
    3. *-rgt-identity53.1%

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

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

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

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

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

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

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

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

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

Developer target: 93.0% 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 2023173 
(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)))