Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2

Percentage Accurate: 61.2% → 91.1%
Time: 16.0s
Alternatives: 11
Speedup: 18.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 61.2% accurate, 1.0× speedup?

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

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

Alternative 1: 91.1% accurate, 1.0× speedup?

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

\mathbf{elif}\;z \leq 1.65 \cdot 10^{-117}:\\
\;\;\;\;y \cdot \left(z \cdot \left(x \cdot {\left(z \cdot z - a \cdot t\right)}^{-0.5}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{\sqrt{1 - t_1}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.59999999999999994e95

    1. Initial program 38.6%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified40.5%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Taylor expanded in z around -inf 92.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{0.5 \cdot \frac{a \cdot t}{{z}^{2}} - 1}} \]
    5. Step-by-step derivation
      1. fma-neg92.0%

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

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

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

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

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

    if -4.59999999999999994e95 < z < 1.65000000000000008e-117

    1. Initial program 80.3%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/84.0%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified84.0%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Step-by-step derivation
      1. div-inv83.9%

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

        \[\leadsto y \cdot \left(\color{blue}{\left(z \cdot x\right)} \cdot \frac{1}{\sqrt{z \cdot z - t \cdot a}}\right) \]
      3. associate-*l*86.0%

        \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(x \cdot \frac{1}{\sqrt{z \cdot z - t \cdot a}}\right)\right)} \]
      4. pow1/286.0%

        \[\leadsto y \cdot \left(z \cdot \left(x \cdot \frac{1}{\color{blue}{{\left(z \cdot z - t \cdot a\right)}^{0.5}}}\right)\right) \]
      5. pow-flip86.0%

        \[\leadsto y \cdot \left(z \cdot \left(x \cdot \color{blue}{{\left(z \cdot z - t \cdot a\right)}^{\left(-0.5\right)}}\right)\right) \]
      6. metadata-eval86.0%

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

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

    if 1.65000000000000008e-117 < z

    1. Initial program 58.0%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified62.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}} \]
      2. sqrt-unprod62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z} \cdot \frac{\sqrt{z \cdot z - t \cdot a}}{z}}}} \]
      3. frac-times56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{\frac{\sqrt{z \cdot z - t \cdot a} \cdot \sqrt{z \cdot z - t \cdot a}}{z \cdot z}}}} \]
      4. add-sqr-sqrt56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\frac{\color{blue}{z \cdot z - t \cdot a}}{z \cdot z}}} \]
    5. Applied egg-rr56.5%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{z \cdot z - t \cdot a}{z \cdot z}}}} \]
    6. Step-by-step derivation
      1. div-sub56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{\frac{z \cdot z}{z \cdot z} - \frac{t \cdot a}{z \cdot z}}}} \]
      2. *-inverses94.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{1} - \frac{t \cdot a}{z \cdot z}}} \]
      3. *-commutative94.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{1 - \frac{\color{blue}{a \cdot t}}{z \cdot z}}} \]
      4. times-frac98.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{1 - \color{blue}{\frac{a}{z} \cdot \frac{t}{z}}}} \]
    7. Simplified98.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u78.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\right)\right)} \]
      2. expm1-udef38.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\right)} - 1} \]
      3. associate-/l*38.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}{y}}}\right)} - 1 \]
      4. associate-*l/38.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \color{blue}{\frac{a \cdot \frac{t}{z}}{z}}}}{y}}\right)} - 1 \]
    9. Applied egg-rr38.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def78.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}\right)\right)} \]
      2. expm1-log1p98.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}} \]
      3. associate-/r/98.9%

        \[\leadsto \color{blue}{\frac{x}{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}} \cdot y} \]
      4. *-commutative98.9%

        \[\leadsto \frac{x}{\sqrt{1 - \frac{\color{blue}{\frac{t}{z} \cdot a}}{z}}} \cdot y \]
      5. associate-*r/98.9%

        \[\leadsto \frac{x}{\sqrt{1 - \color{blue}{\frac{t}{z} \cdot \frac{a}{z}}}} \cdot y \]
    11. Simplified98.9%

      \[\leadsto \color{blue}{\frac{x}{\sqrt{1 - \frac{t}{z} \cdot \frac{a}{z}}} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.6 \cdot 10^{+95}:\\ \;\;\;\;\frac{x \cdot y}{\mathsf{fma}\left(0.5, \frac{a}{z} \cdot \frac{t}{z}, -1\right)}\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-117}:\\ \;\;\;\;y \cdot \left(z \cdot \left(x \cdot {\left(z \cdot z - a \cdot t\right)}^{-0.5}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\\ \end{array} \]

Alternative 2: 90.2% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+89}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+21}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{1 + -0.5 \cdot \left(\frac{a}{z} \cdot \frac{t}{z}\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -6e+89)
   (* x (- y))
   (if (<= z 2.6e+21)
     (* y (/ (* z x) (sqrt (- (* z z) (* a t)))))
     (/ (* x y) (+ 1.0 (* -0.5 (* (/ a z) (/ t z))))))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6e+89) {
		tmp = x * -y;
	} else if (z <= 2.6e+21) {
		tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
	} else {
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))));
	}
	return tmp;
}
NOTE: x and y 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 (z <= (-6d+89)) then
        tmp = x * -y
    else if (z <= 2.6d+21) then
        tmp = y * ((z * x) / sqrt(((z * z) - (a * t))))
    else
        tmp = (x * y) / (1.0d0 + ((-0.5d0) * ((a / z) * (t / z))))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6e+89) {
		tmp = x * -y;
	} else if (z <= 2.6e+21) {
		tmp = y * ((z * x) / Math.sqrt(((z * z) - (a * t))));
	} else {
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -6e+89:
		tmp = x * -y
	elif z <= 2.6e+21:
		tmp = y * ((z * x) / math.sqrt(((z * z) - (a * t))))
	else:
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))))
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -6e+89)
		tmp = Float64(x * Float64(-y));
	elseif (z <= 2.6e+21)
		tmp = Float64(y * Float64(Float64(z * x) / sqrt(Float64(Float64(z * z) - Float64(a * t)))));
	else
		tmp = Float64(Float64(x * y) / Float64(1.0 + Float64(-0.5 * Float64(Float64(a / z) * Float64(t / z)))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -6e+89)
		tmp = x * -y;
	elseif (z <= 2.6e+21)
		tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
	else
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e+89], N[(x * (-y)), $MachinePrecision], If[LessEqual[z, 2.6e+21], N[(y * N[(N[(z * x), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+21}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.00000000000000025e89

    1. Initial program 38.6%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/35.5%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified35.5%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 97.0%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-197.0%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified97.0%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -6.00000000000000025e89 < z < 2.6e21

    1. Initial program 84.2%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/86.0%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified86.0%

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

    if 2.6e21 < z

    1. Initial program 41.2%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified47.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Step-by-step derivation
      1. clear-num47.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{\frac{z}{\sqrt{z \cdot z - t \cdot a}}}}} \]
      2. associate-/r/47.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    5. Applied egg-rr47.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    6. Taylor expanded in z around inf 92.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 + -0.5 \cdot \frac{a \cdot t}{{z}^{2}}}} \]
    7. Step-by-step derivation
      1. *-commutative92.9%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{\color{blue}{t \cdot a}}{{z}^{2}}} \]
      2. unpow292.9%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{t \cdot a}{\color{blue}{z \cdot z}}} \]
      3. times-frac98.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+89}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+21}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{1 + -0.5 \cdot \left(\frac{a}{z} \cdot \frac{t}{z}\right)}\\ \end{array} \]

Alternative 3: 91.2% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -8.6 \cdot 10^{+87}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-117}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -8.6e+87)
   (* x (- y))
   (if (<= z 7.8e-117)
     (* y (/ (* z x) (sqrt (- (* z z) (* a t)))))
     (* y (/ x (sqrt (- 1.0 (* (/ a z) (/ t z)))))))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -8.6e+87) {
		tmp = x * -y;
	} else if (z <= 7.8e-117) {
		tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
	} else {
		tmp = y * (x / sqrt((1.0 - ((a / z) * (t / z)))));
	}
	return tmp;
}
NOTE: x and y 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 (z <= (-8.6d+87)) then
        tmp = x * -y
    else if (z <= 7.8d-117) then
        tmp = y * ((z * x) / sqrt(((z * z) - (a * t))))
    else
        tmp = y * (x / sqrt((1.0d0 - ((a / z) * (t / z)))))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -8.6e+87) {
		tmp = x * -y;
	} else if (z <= 7.8e-117) {
		tmp = y * ((z * x) / Math.sqrt(((z * z) - (a * t))));
	} else {
		tmp = y * (x / Math.sqrt((1.0 - ((a / z) * (t / z)))));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -8.6e+87:
		tmp = x * -y
	elif z <= 7.8e-117:
		tmp = y * ((z * x) / math.sqrt(((z * z) - (a * t))))
	else:
		tmp = y * (x / math.sqrt((1.0 - ((a / z) * (t / z)))))
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -8.6e+87)
		tmp = Float64(x * Float64(-y));
	elseif (z <= 7.8e-117)
		tmp = Float64(y * Float64(Float64(z * x) / sqrt(Float64(Float64(z * z) - Float64(a * t)))));
	else
		tmp = Float64(y * Float64(x / sqrt(Float64(1.0 - Float64(Float64(a / z) * Float64(t / z))))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -8.6e+87)
		tmp = x * -y;
	elseif (z <= 7.8e-117)
		tmp = y * ((z * x) / sqrt(((z * z) - (a * t))));
	else
		tmp = y * (x / sqrt((1.0 - ((a / z) * (t / z)))));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.6e+87], N[(x * (-y)), $MachinePrecision], If[LessEqual[z, 7.8e-117], N[(y * N[(N[(z * x), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / N[Sqrt[N[(1.0 - N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+87}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;z \leq 7.8 \cdot 10^{-117}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.6000000000000002e87

    1. Initial program 38.6%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/35.5%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified35.5%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 97.0%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-197.0%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified97.0%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -8.6000000000000002e87 < z < 7.79999999999999984e-117

    1. Initial program 80.3%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/84.0%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified84.0%

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

    if 7.79999999999999984e-117 < z

    1. Initial program 58.0%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified62.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}} \]
      2. sqrt-unprod62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z} \cdot \frac{\sqrt{z \cdot z - t \cdot a}}{z}}}} \]
      3. frac-times56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{\frac{\sqrt{z \cdot z - t \cdot a} \cdot \sqrt{z \cdot z - t \cdot a}}{z \cdot z}}}} \]
      4. add-sqr-sqrt56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\frac{\color{blue}{z \cdot z - t \cdot a}}{z \cdot z}}} \]
    5. Applied egg-rr56.5%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{z \cdot z - t \cdot a}{z \cdot z}}}} \]
    6. Step-by-step derivation
      1. div-sub56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{\frac{z \cdot z}{z \cdot z} - \frac{t \cdot a}{z \cdot z}}}} \]
      2. *-inverses94.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{1} - \frac{t \cdot a}{z \cdot z}}} \]
      3. *-commutative94.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{1 - \frac{\color{blue}{a \cdot t}}{z \cdot z}}} \]
      4. times-frac98.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{1 - \color{blue}{\frac{a}{z} \cdot \frac{t}{z}}}} \]
    7. Simplified98.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u78.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\right)\right)} \]
      2. expm1-udef38.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\right)} - 1} \]
      3. associate-/l*38.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}{y}}}\right)} - 1 \]
      4. associate-*l/38.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \color{blue}{\frac{a \cdot \frac{t}{z}}{z}}}}{y}}\right)} - 1 \]
    9. Applied egg-rr38.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def78.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}\right)\right)} \]
      2. expm1-log1p98.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}} \]
      3. associate-/r/98.9%

        \[\leadsto \color{blue}{\frac{x}{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}} \cdot y} \]
      4. *-commutative98.9%

        \[\leadsto \frac{x}{\sqrt{1 - \frac{\color{blue}{\frac{t}{z} \cdot a}}{z}}} \cdot y \]
      5. associate-*r/98.9%

        \[\leadsto \frac{x}{\sqrt{1 - \color{blue}{\frac{t}{z} \cdot \frac{a}{z}}}} \cdot y \]
    11. Simplified98.9%

      \[\leadsto \color{blue}{\frac{x}{\sqrt{1 - \frac{t}{z} \cdot \frac{a}{z}}} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.6 \cdot 10^{+87}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{-117}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\\ \end{array} \]

Alternative 4: 91.2% accurate, 1.0× speedup?

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

\mathbf{elif}\;z \leq 4.4 \cdot 10^{-116}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{\sqrt{1 - t_1}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.5000000000000001e93

    1. Initial program 38.6%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified40.5%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Taylor expanded in z around -inf 92.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{0.5 \cdot \frac{a \cdot t}{{z}^{2}} - 1}} \]
    5. Step-by-step derivation
      1. fma-neg92.0%

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

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

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

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

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

    if -2.5000000000000001e93 < z < 4.4000000000000002e-116

    1. Initial program 80.3%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/84.0%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified84.0%

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

    if 4.4000000000000002e-116 < z

    1. Initial program 58.0%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified62.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}} \]
      2. sqrt-unprod62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{\sqrt{z \cdot z - t \cdot a}}{z} \cdot \frac{\sqrt{z \cdot z - t \cdot a}}{z}}}} \]
      3. frac-times56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{\frac{\sqrt{z \cdot z - t \cdot a} \cdot \sqrt{z \cdot z - t \cdot a}}{z \cdot z}}}} \]
      4. add-sqr-sqrt56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\frac{\color{blue}{z \cdot z - t \cdot a}}{z \cdot z}}} \]
    5. Applied egg-rr56.5%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{z \cdot z - t \cdot a}{z \cdot z}}}} \]
    6. Step-by-step derivation
      1. div-sub56.5%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{\frac{z \cdot z}{z \cdot z} - \frac{t \cdot a}{z \cdot z}}}} \]
      2. *-inverses94.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{\color{blue}{1} - \frac{t \cdot a}{z \cdot z}}} \]
      3. *-commutative94.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{1 - \frac{\color{blue}{a \cdot t}}{z \cdot z}}} \]
      4. times-frac98.9%

        \[\leadsto \frac{x \cdot y}{\sqrt{1 - \color{blue}{\frac{a}{z} \cdot \frac{t}{z}}}} \]
    7. Simplified98.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u78.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot y}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\right)\right)} \]
      2. expm1-udef38.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x \cdot y}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\right)} - 1} \]
      3. associate-/l*38.1%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}{y}}}\right)} - 1 \]
      4. associate-*l/38.1%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \color{blue}{\frac{a \cdot \frac{t}{z}}{z}}}}{y}}\right)} - 1 \]
    9. Applied egg-rr38.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def78.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}\right)\right)} \]
      2. expm1-log1p98.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}}{y}}} \]
      3. associate-/r/98.9%

        \[\leadsto \color{blue}{\frac{x}{\sqrt{1 - \frac{a \cdot \frac{t}{z}}{z}}} \cdot y} \]
      4. *-commutative98.9%

        \[\leadsto \frac{x}{\sqrt{1 - \frac{\color{blue}{\frac{t}{z} \cdot a}}{z}}} \cdot y \]
      5. associate-*r/98.9%

        \[\leadsto \frac{x}{\sqrt{1 - \color{blue}{\frac{t}{z} \cdot \frac{a}{z}}}} \cdot y \]
    11. Simplified98.9%

      \[\leadsto \color{blue}{\frac{x}{\sqrt{1 - \frac{t}{z} \cdot \frac{a}{z}}} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+93}:\\ \;\;\;\;\frac{x \cdot y}{\mathsf{fma}\left(0.5, \frac{a}{z} \cdot \frac{t}{z}, -1\right)}\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-116}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{z \cdot z - a \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{\sqrt{1 - \frac{a}{z} \cdot \frac{t}{z}}}\\ \end{array} \]

Alternative 5: 82.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -7.4:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{-152}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{a \cdot \left(-t\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{1 + -0.5 \cdot \left(\frac{a}{z} \cdot \frac{t}{z}\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -7.4)
   (* x (- y))
   (if (<= z 2.35e-152)
     (* y (/ (* z x) (sqrt (* a (- t)))))
     (/ (* x y) (+ 1.0 (* -0.5 (* (/ a z) (/ t z))))))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -7.4) {
		tmp = x * -y;
	} else if (z <= 2.35e-152) {
		tmp = y * ((z * x) / sqrt((a * -t)));
	} else {
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))));
	}
	return tmp;
}
NOTE: x and y 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 (z <= (-7.4d0)) then
        tmp = x * -y
    else if (z <= 2.35d-152) then
        tmp = y * ((z * x) / sqrt((a * -t)))
    else
        tmp = (x * y) / (1.0d0 + ((-0.5d0) * ((a / z) * (t / z))))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -7.4) {
		tmp = x * -y;
	} else if (z <= 2.35e-152) {
		tmp = y * ((z * x) / Math.sqrt((a * -t)));
	} else {
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -7.4:
		tmp = x * -y
	elif z <= 2.35e-152:
		tmp = y * ((z * x) / math.sqrt((a * -t)))
	else:
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))))
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -7.4)
		tmp = Float64(x * Float64(-y));
	elseif (z <= 2.35e-152)
		tmp = Float64(y * Float64(Float64(z * x) / sqrt(Float64(a * Float64(-t)))));
	else
		tmp = Float64(Float64(x * y) / Float64(1.0 + Float64(-0.5 * Float64(Float64(a / z) * Float64(t / z)))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -7.4)
		tmp = x * -y;
	elseif (z <= 2.35e-152)
		tmp = y * ((z * x) / sqrt((a * -t)));
	else
		tmp = (x * y) / (1.0 + (-0.5 * ((a / z) * (t / z))));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.4], N[(x * (-y)), $MachinePrecision], If[LessEqual[z, 2.35e-152], N[(y * N[(N[(z * x), $MachinePrecision] / N[Sqrt[N[(a * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(a / z), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;z \leq 2.35 \cdot 10^{-152}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{a \cdot \left(-t\right)}}\\

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


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

    1. Initial program 54.1%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/48.3%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified48.3%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 95.5%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-195.5%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified95.5%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -7.4000000000000004 < z < 2.35000000000000006e-152

    1. Initial program 76.4%

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Step-by-step derivation
      1. *-commutative76.4%

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/84.5%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified84.5%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around 0 78.6%

      \[\leadsto y \cdot \frac{x \cdot z}{\sqrt{\color{blue}{-1 \cdot \left(a \cdot t\right)}}} \]
    5. Step-by-step derivation
      1. mul-1-neg78.6%

        \[\leadsto y \cdot \frac{x \cdot z}{\sqrt{\color{blue}{-a \cdot t}}} \]
      2. distribute-rgt-neg-out78.6%

        \[\leadsto y \cdot \frac{x \cdot z}{\sqrt{\color{blue}{a \cdot \left(-t\right)}}} \]
    6. Simplified78.6%

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

    if 2.35000000000000006e-152 < z

    1. Initial program 58.1%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified63.6%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Step-by-step derivation
      1. clear-num63.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{\frac{z}{\sqrt{z \cdot z - t \cdot a}}}}} \]
      2. associate-/r/63.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    5. Applied egg-rr63.5%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    6. Taylor expanded in z around inf 84.8%

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 + -0.5 \cdot \frac{a \cdot t}{{z}^{2}}}} \]
    7. Step-by-step derivation
      1. *-commutative84.8%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{\color{blue}{t \cdot a}}{{z}^{2}}} \]
      2. unpow284.8%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{t \cdot a}{\color{blue}{z \cdot z}}} \]
      3. times-frac88.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.4:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{-152}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{\sqrt{a \cdot \left(-t\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{1 + -0.5 \cdot \left(\frac{a}{z} \cdot \frac{t}{z}\right)}\\ \end{array} \]

Alternative 6: 77.2% accurate, 5.9× speedup?

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

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+22}:\\
\;\;\;\;y \cdot \frac{z \cdot x}{z + -0.5 \cdot \frac{a \cdot t}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.5000000000000001e-147

    1. Initial program 60.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/57.3%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified57.3%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 82.7%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-182.7%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified82.7%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -1.5000000000000001e-147 < z < 1.1e22

    1. Initial program 79.9%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/84.9%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified84.9%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around inf 50.1%

      \[\leadsto y \cdot \frac{x \cdot z}{\color{blue}{z + -0.5 \cdot \frac{a \cdot t}{z}}} \]

    if 1.1e22 < z

    1. Initial program 41.2%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/45.3%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified45.3%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around inf 98.3%

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

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

Alternative 7: 76.0% accurate, 6.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{-147}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-152}:\\ \;\;\;\;-2 \cdot \left(\frac{y}{a} \cdot \frac{x \cdot \left(z \cdot z\right)}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -6.2e-147)
   (* x (- y))
   (if (<= z 1.3e-152) (* -2.0 (* (/ y a) (/ (* x (* z z)) t))) (* x y))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6.2e-147) {
		tmp = x * -y;
	} else if (z <= 1.3e-152) {
		tmp = -2.0 * ((y / a) * ((x * (z * z)) / t));
	} else {
		tmp = x * y;
	}
	return tmp;
}
NOTE: x and y 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 (z <= (-6.2d-147)) then
        tmp = x * -y
    else if (z <= 1.3d-152) then
        tmp = (-2.0d0) * ((y / a) * ((x * (z * z)) / t))
    else
        tmp = x * y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6.2e-147) {
		tmp = x * -y;
	} else if (z <= 1.3e-152) {
		tmp = -2.0 * ((y / a) * ((x * (z * z)) / t));
	} else {
		tmp = x * y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -6.2e-147:
		tmp = x * -y
	elif z <= 1.3e-152:
		tmp = -2.0 * ((y / a) * ((x * (z * z)) / t))
	else:
		tmp = x * y
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -6.2e-147)
		tmp = Float64(x * Float64(-y));
	elseif (z <= 1.3e-152)
		tmp = Float64(-2.0 * Float64(Float64(y / a) * Float64(Float64(x * Float64(z * z)) / t)));
	else
		tmp = Float64(x * y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -6.2e-147)
		tmp = x * -y;
	elseif (z <= 1.3e-152)
		tmp = -2.0 * ((y / a) * ((x * (z * z)) / t));
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.2e-147], N[(x * (-y)), $MachinePrecision], If[LessEqual[z, 1.3e-152], N[(-2.0 * N[(N[(y / a), $MachinePrecision] * N[(N[(x * N[(z * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{-147}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.2000000000000005e-147

    1. Initial program 60.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/57.3%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified57.3%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 82.7%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-182.7%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified82.7%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -6.2000000000000005e-147 < z < 1.30000000000000006e-152

    1. Initial program 71.8%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified73.3%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Step-by-step derivation
      1. clear-num73.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{\frac{z}{\sqrt{z \cdot z - t \cdot a}}}}} \]
      2. associate-/r/73.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    5. Applied egg-rr73.2%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    6. Taylor expanded in z around inf 32.8%

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 + -0.5 \cdot \frac{a \cdot t}{{z}^{2}}}} \]
    7. Step-by-step derivation
      1. *-commutative32.8%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{\color{blue}{t \cdot a}}{{z}^{2}}} \]
      2. unpow232.8%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{t \cdot a}{\color{blue}{z \cdot z}}} \]
      3. times-frac35.5%

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

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

      \[\leadsto \color{blue}{-2 \cdot \frac{y \cdot \left({z}^{2} \cdot x\right)}{a \cdot t}} \]
    10. Step-by-step derivation
      1. times-frac33.1%

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

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

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

    if 1.30000000000000006e-152 < z

    1. Initial program 58.1%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/60.4%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified60.4%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around inf 84.3%

      \[\leadsto y \cdot \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{-147}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-152}:\\ \;\;\;\;-2 \cdot \left(\frac{y}{a} \cdot \frac{x \cdot \left(z \cdot z\right)}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 8: 76.1% accurate, 6.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{-145}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-152}:\\ \;\;\;\;z \cdot \left(-2 \cdot \left(\frac{z}{\frac{t}{y}} \cdot \frac{x}{a}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -4.8e-145)
   (* x (- y))
   (if (<= z 2.2e-152) (* z (* -2.0 (* (/ z (/ t y)) (/ x a)))) (* x y))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.8e-145) {
		tmp = x * -y;
	} else if (z <= 2.2e-152) {
		tmp = z * (-2.0 * ((z / (t / y)) * (x / a)));
	} else {
		tmp = x * y;
	}
	return tmp;
}
NOTE: x and y 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 (z <= (-4.8d-145)) then
        tmp = x * -y
    else if (z <= 2.2d-152) then
        tmp = z * ((-2.0d0) * ((z / (t / y)) * (x / a)))
    else
        tmp = x * y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -4.8e-145) {
		tmp = x * -y;
	} else if (z <= 2.2e-152) {
		tmp = z * (-2.0 * ((z / (t / y)) * (x / a)));
	} else {
		tmp = x * y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if z <= -4.8e-145:
		tmp = x * -y
	elif z <= 2.2e-152:
		tmp = z * (-2.0 * ((z / (t / y)) * (x / a)))
	else:
		tmp = x * y
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -4.8e-145)
		tmp = Float64(x * Float64(-y));
	elseif (z <= 2.2e-152)
		tmp = Float64(z * Float64(-2.0 * Float64(Float64(z / Float64(t / y)) * Float64(x / a))));
	else
		tmp = Float64(x * y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z <= -4.8e-145)
		tmp = x * -y;
	elseif (z <= 2.2e-152)
		tmp = z * (-2.0 * ((z / (t / y)) * (x / a)));
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.8e-145], N[(x * (-y)), $MachinePrecision], If[LessEqual[z, 2.2e-152], N[(z * N[(-2.0 * N[(N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-145}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.8000000000000003e-145

    1. Initial program 60.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/57.3%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified57.3%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 82.7%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-182.7%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified82.7%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -4.8000000000000003e-145 < z < 2.19999999999999985e-152

    1. Initial program 71.8%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\sqrt{z \cdot z - t \cdot a}} \cdot z} \]
    3. Simplified75.4%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\sqrt{z \cdot z - t \cdot a}} \cdot z} \]
    4. Taylor expanded in z around inf 35.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{z + -0.5 \cdot \frac{a \cdot t}{z}}} \cdot z \]
    5. Taylor expanded in z around 0 35.5%

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

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

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

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

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

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

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

    if 2.19999999999999985e-152 < z

    1. Initial program 58.1%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/60.4%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified60.4%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around inf 84.3%

      \[\leadsto y \cdot \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{-145}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-152}:\\ \;\;\;\;z \cdot \left(-2 \cdot \left(\frac{z}{\frac{t}{y}} \cdot \frac{x}{a}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 9: 77.8% accurate, 6.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.5499999999999999e-146

    1. Initial program 60.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/57.3%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified57.3%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 82.7%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-182.7%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified82.7%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -1.5499999999999999e-146 < z

    1. Initial program 62.1%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Simplified66.4%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    4. Step-by-step derivation
      1. clear-num66.4%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{\frac{z}{\sqrt{z \cdot z - t \cdot a}}}}} \]
      2. associate-/r/66.4%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    5. Applied egg-rr66.4%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{1}{z} \cdot \sqrt{z \cdot z - t \cdot a}}} \]
    6. Taylor expanded in z around inf 69.6%

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 + -0.5 \cdot \frac{a \cdot t}{{z}^{2}}}} \]
    7. Step-by-step derivation
      1. *-commutative69.6%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{\color{blue}{t \cdot a}}{{z}^{2}}} \]
      2. unpow269.6%

        \[\leadsto \frac{x \cdot y}{1 + -0.5 \cdot \frac{t \cdot a}{\color{blue}{z \cdot z}}} \]
      3. times-frac73.0%

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

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

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

Alternative 10: 73.3% accurate, 18.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.75e-304

    1. Initial program 63.9%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/60.8%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified60.8%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around -inf 70.7%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-170.7%

        \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]
    6. Simplified70.7%

      \[\leadsto y \cdot \color{blue}{\left(-x\right)} \]

    if -1.75e-304 < z

    1. Initial program 59.3%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
      3. associate-*r/64.9%

        \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Simplified64.9%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    4. Taylor expanded in z around inf 73.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{-304}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 11: 43.0% accurate, 37.7× speedup?

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

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

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

      \[\leadsto \frac{\color{blue}{y \cdot \left(x \cdot z\right)}}{\sqrt{z \cdot z - t \cdot a}} \]
    3. associate-*r/62.8%

      \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
  3. Simplified62.8%

    \[\leadsto \color{blue}{y \cdot \frac{x \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
  4. Taylor expanded in z around inf 45.9%

    \[\leadsto y \cdot \color{blue}{x} \]
  5. Final simplification45.9%

    \[\leadsto x \cdot y \]

Developer target: 89.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z < -3.1921305903852764 \cdot 10^{+46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z < 5.976268120920894 \cdot 10^{+90}:\\ \;\;\;\;\frac{x \cdot z}{\frac{\sqrt{z \cdot z - a \cdot t}}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (< z -3.1921305903852764e+46)
   (- (* y x))
   (if (< z 5.976268120920894e+90)
     (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y))
     (* y x))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z < -3.1921305903852764e+46) {
		tmp = -(y * x);
	} else if (z < 5.976268120920894e+90) {
		tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y);
	} else {
		tmp = y * x;
	}
	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 (z < (-3.1921305903852764d+46)) then
        tmp = -(y * x)
    else if (z < 5.976268120920894d+90) then
        tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y)
    else
        tmp = y * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z < -3.1921305903852764e+46) {
		tmp = -(y * x);
	} else if (z < 5.976268120920894e+90) {
		tmp = (x * z) / (Math.sqrt(((z * z) - (a * t))) / y);
	} else {
		tmp = y * x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if z < -3.1921305903852764e+46:
		tmp = -(y * x)
	elif z < 5.976268120920894e+90:
		tmp = (x * z) / (math.sqrt(((z * z) - (a * t))) / y)
	else:
		tmp = y * x
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (z < -3.1921305903852764e+46)
		tmp = Float64(-Float64(y * x));
	elseif (z < 5.976268120920894e+90)
		tmp = Float64(Float64(x * z) / Float64(sqrt(Float64(Float64(z * z) - Float64(a * t))) / y));
	else
		tmp = Float64(y * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (z < -3.1921305903852764e+46)
		tmp = -(y * x);
	elseif (z < 5.976268120920894e+90)
		tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y);
	else
		tmp = y * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Less[z, -3.1921305903852764e+46], (-N[(y * x), $MachinePrecision]), If[Less[z, 5.976268120920894e+90], N[(N[(x * z), $MachinePrecision] / N[(N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z < -3.1921305903852764 \cdot 10^{+46}:\\
\;\;\;\;-y \cdot x\\

\mathbf{elif}\;z < 5.976268120920894 \cdot 10^{+90}:\\
\;\;\;\;\frac{x \cdot z}{\frac{\sqrt{z \cdot z - a \cdot t}}{y}}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023242 
(FPCore (x y z t a)
  :name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z -3.1921305903852764e+46) (- (* y x)) (if (< z 5.976268120920894e+90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

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