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

Percentage Accurate: 61.2% → 91.4%
Time: 15.9s
Alternatives: 7
Speedup: 37.7×

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 7 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.4% accurate, 1.0× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ [x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\ \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 1.55 \cdot 10^{+131}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z\_m}{\sqrt{z\_m \cdot z\_m - t \cdot a}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z\_m}{z\_m + -0.5 \cdot \left(a \cdot \frac{t}{z\_m}\right)}\right)\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s x y z_m t a)
 :precision binary64
 (*
  z_s
  (if (<= z_m 1.55e+131)
    (* x (* y (/ z_m (sqrt (- (* z_m z_m) (* t a))))))
    (* x (* y (/ z_m (+ z_m (* -0.5 (* a (/ t z_m))))))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
assert(x < y && y < z_m && z_m < t && t < a);
double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 1.55e+131) {
		tmp = x * (y * (z_m / sqrt(((z_m * z_m) - (t * a)))));
	} else {
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))));
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, x, y, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z_m <= 1.55d+131) then
        tmp = x * (y * (z_m / sqrt(((z_m * z_m) - (t * a)))))
    else
        tmp = x * (y * (z_m / (z_m + ((-0.5d0) * (a * (t / z_m))))))
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
assert x < y && y < z_m && z_m < t && t < a;
public static double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 1.55e+131) {
		tmp = x * (y * (z_m / Math.sqrt(((z_m * z_m) - (t * a)))));
	} else {
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))));
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
[x, y, z_m, t, a] = sort([x, y, z_m, t, a])
def code(z_s, x, y, z_m, t, a):
	tmp = 0
	if z_m <= 1.55e+131:
		tmp = x * (y * (z_m / math.sqrt(((z_m * z_m) - (t * a)))))
	else:
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))))
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
x, y, z_m, t, a = sort([x, y, z_m, t, a])
function code(z_s, x, y, z_m, t, a)
	tmp = 0.0
	if (z_m <= 1.55e+131)
		tmp = Float64(x * Float64(y * Float64(z_m / sqrt(Float64(Float64(z_m * z_m) - Float64(t * a))))));
	else
		tmp = Float64(x * Float64(y * Float64(z_m / Float64(z_m + Float64(-0.5 * Float64(a * Float64(t / z_m)))))));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
x, y, z_m, t, a = num2cell(sort([x, y, z_m, t, a])){:}
function tmp_2 = code(z_s, x, y, z_m, t, a)
	tmp = 0.0;
	if (z_m <= 1.55e+131)
		tmp = x * (y * (z_m / sqrt(((z_m * z_m) - (t * a)))));
	else
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))));
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, x_, y_, z$95$m_, t_, a_] := N[(z$95$s * If[LessEqual[z$95$m, 1.55e+131], N[(x * N[(y * N[(z$95$m / N[Sqrt[N[(N[(z$95$m * z$95$m), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(z$95$m / N[(z$95$m + N[(-0.5 * N[(a * N[(t / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
[x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.55 \cdot 10^{+131}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{z\_m}{\sqrt{z\_m \cdot z\_m - t \cdot a}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.55000000000000008e131

    1. Initial program 72.2%

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

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

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

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

    if 1.55000000000000008e131 < z

    1. Initial program 32.4%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 91.5%

      \[\leadsto x \cdot \left(y \cdot \frac{z}{\color{blue}{z + -0.5 \cdot \frac{a \cdot t}{z}}}\right) \]
    6. Step-by-step derivation
      1. associate-/l*98.0%

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

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

Alternative 2: 83.7% accurate, 1.0× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ [x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\ \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 2.7 \cdot 10^{-95}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z\_m}{\sqrt{t \cdot \left(-a\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z\_m}{z\_m + -0.5 \cdot \left(a \cdot \frac{t}{z\_m}\right)}\right)\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s x y z_m t a)
 :precision binary64
 (*
  z_s
  (if (<= z_m 2.7e-95)
    (* x (* y (/ z_m (sqrt (* t (- a))))))
    (* x (* y (/ z_m (+ z_m (* -0.5 (* a (/ t z_m))))))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
assert(x < y && y < z_m && z_m < t && t < a);
double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 2.7e-95) {
		tmp = x * (y * (z_m / sqrt((t * -a))));
	} else {
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))));
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, x, y, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z_m <= 2.7d-95) then
        tmp = x * (y * (z_m / sqrt((t * -a))))
    else
        tmp = x * (y * (z_m / (z_m + ((-0.5d0) * (a * (t / z_m))))))
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
assert x < y && y < z_m && z_m < t && t < a;
public static double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 2.7e-95) {
		tmp = x * (y * (z_m / Math.sqrt((t * -a))));
	} else {
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))));
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
[x, y, z_m, t, a] = sort([x, y, z_m, t, a])
def code(z_s, x, y, z_m, t, a):
	tmp = 0
	if z_m <= 2.7e-95:
		tmp = x * (y * (z_m / math.sqrt((t * -a))))
	else:
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))))
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
x, y, z_m, t, a = sort([x, y, z_m, t, a])
function code(z_s, x, y, z_m, t, a)
	tmp = 0.0
	if (z_m <= 2.7e-95)
		tmp = Float64(x * Float64(y * Float64(z_m / sqrt(Float64(t * Float64(-a))))));
	else
		tmp = Float64(x * Float64(y * Float64(z_m / Float64(z_m + Float64(-0.5 * Float64(a * Float64(t / z_m)))))));
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
x, y, z_m, t, a = num2cell(sort([x, y, z_m, t, a])){:}
function tmp_2 = code(z_s, x, y, z_m, t, a)
	tmp = 0.0;
	if (z_m <= 2.7e-95)
		tmp = x * (y * (z_m / sqrt((t * -a))));
	else
		tmp = x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m))))));
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, x_, y_, z$95$m_, t_, a_] := N[(z$95$s * If[LessEqual[z$95$m, 2.7e-95], N[(x * N[(y * N[(z$95$m / N[Sqrt[N[(t * (-a)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(z$95$m / N[(z$95$m + N[(-0.5 * N[(a * N[(t / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
[x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 2.7 \cdot 10^{-95}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{z\_m}{\sqrt{t \cdot \left(-a\right)}}\right)\\

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


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

    1. Initial program 64.4%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 37.9%

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

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

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

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

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

    if 2.7e-95 < z

    1. Initial program 66.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.3%

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

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 86.6%

      \[\leadsto x \cdot \left(y \cdot \frac{z}{\color{blue}{z + -0.5 \cdot \frac{a \cdot t}{z}}}\right) \]
    6. Step-by-step derivation
      1. associate-/l*89.6%

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

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

Alternative 3: 78.9% accurate, 7.5× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ [x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\ \\ z\_s \cdot \left(x \cdot \left(y \cdot \frac{z\_m}{z\_m + -0.5 \cdot \left(a \cdot \frac{t}{z\_m}\right)}\right)\right) \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s x y z_m t a)
 :precision binary64
 (* z_s (* x (* y (/ z_m (+ z_m (* -0.5 (* a (/ t z_m)))))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
assert(x < y && y < z_m && z_m < t && t < a);
double code(double z_s, double x, double y, double z_m, double t, double a) {
	return z_s * (x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m)))))));
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, x, y, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = z_s * (x * (y * (z_m / (z_m + ((-0.5d0) * (a * (t / z_m)))))))
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
assert x < y && y < z_m && z_m < t && t < a;
public static double code(double z_s, double x, double y, double z_m, double t, double a) {
	return z_s * (x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m)))))));
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
[x, y, z_m, t, a] = sort([x, y, z_m, t, a])
def code(z_s, x, y, z_m, t, a):
	return z_s * (x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m)))))))
z\_m = abs(z)
z\_s = copysign(1.0, z)
x, y, z_m, t, a = sort([x, y, z_m, t, a])
function code(z_s, x, y, z_m, t, a)
	return Float64(z_s * Float64(x * Float64(y * Float64(z_m / Float64(z_m + Float64(-0.5 * Float64(a * Float64(t / z_m))))))))
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
x, y, z_m, t, a = num2cell(sort([x, y, z_m, t, a])){:}
function tmp = code(z_s, x, y, z_m, t, a)
	tmp = z_s * (x * (y * (z_m / (z_m + (-0.5 * (a * (t / z_m)))))));
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, x_, y_, z$95$m_, t_, a_] := N[(z$95$s * N[(x * N[(y * N[(z$95$m / N[(z$95$m + N[(-0.5 * N[(a * N[(t / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
[x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\
\\
z\_s \cdot \left(x \cdot \left(y \cdot \frac{z\_m}{z\_m + -0.5 \cdot \left(a \cdot \frac{t}{z\_m}\right)}\right)\right)
\end{array}
Derivation
  1. Initial program 65.0%

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

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

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

    \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around 0 49.1%

    \[\leadsto x \cdot \left(y \cdot \frac{z}{\color{blue}{z + -0.5 \cdot \frac{a \cdot t}{z}}}\right) \]
  6. Step-by-step derivation
    1. associate-/l*50.2%

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

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

Alternative 4: 76.2% accurate, 9.4× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ [x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\ \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 1.4 \cdot 10^{-60}:\\ \;\;\;\;\frac{y \cdot \left(z\_m \cdot x\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s x y z_m t a)
 :precision binary64
 (* z_s (if (<= z_m 1.4e-60) (/ (* y (* z_m x)) z_m) (* x y))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
assert(x < y && y < z_m && z_m < t && t < a);
double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 1.4e-60) {
		tmp = (y * (z_m * x)) / z_m;
	} else {
		tmp = x * y;
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, x, y, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z_m <= 1.4d-60) then
        tmp = (y * (z_m * x)) / z_m
    else
        tmp = x * y
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
assert x < y && y < z_m && z_m < t && t < a;
public static double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 1.4e-60) {
		tmp = (y * (z_m * x)) / z_m;
	} else {
		tmp = x * y;
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
[x, y, z_m, t, a] = sort([x, y, z_m, t, a])
def code(z_s, x, y, z_m, t, a):
	tmp = 0
	if z_m <= 1.4e-60:
		tmp = (y * (z_m * x)) / z_m
	else:
		tmp = x * y
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
x, y, z_m, t, a = sort([x, y, z_m, t, a])
function code(z_s, x, y, z_m, t, a)
	tmp = 0.0
	if (z_m <= 1.4e-60)
		tmp = Float64(Float64(y * Float64(z_m * x)) / z_m);
	else
		tmp = Float64(x * y);
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
x, y, z_m, t, a = num2cell(sort([x, y, z_m, t, a])){:}
function tmp_2 = code(z_s, x, y, z_m, t, a)
	tmp = 0.0;
	if (z_m <= 1.4e-60)
		tmp = (y * (z_m * x)) / z_m;
	else
		tmp = x * y;
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, x_, y_, z$95$m_, t_, a_] := N[(z$95$s * If[LessEqual[z$95$m, 1.4e-60], N[(N[(y * N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(x * y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
[x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.4 \cdot 10^{-60}:\\
\;\;\;\;\frac{y \cdot \left(z\_m \cdot x\right)}{z\_m}\\

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


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

    1. Initial program 65.7%

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x \cdot z}{\color{blue}{z}} \]
    6. Step-by-step derivation
      1. associate-*r/24.8%

        \[\leadsto \color{blue}{\frac{y \cdot \left(x \cdot z\right)}{z}} \]
    7. Applied egg-rr24.8%

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

    if 1.4000000000000001e-60 < z

    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. associate-/l*64.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.4 \cdot 10^{-60}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 76.4% accurate, 9.4× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ [x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\ \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 7.5 \cdot 10^{-94}:\\ \;\;\;\;\frac{x \cdot \left(z\_m \cdot y\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s x y z_m t a)
 :precision binary64
 (* z_s (if (<= z_m 7.5e-94) (/ (* x (* z_m y)) z_m) (* x y))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
assert(x < y && y < z_m && z_m < t && t < a);
double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 7.5e-94) {
		tmp = (x * (z_m * y)) / z_m;
	} else {
		tmp = x * y;
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, x, y, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z_m <= 7.5d-94) then
        tmp = (x * (z_m * y)) / z_m
    else
        tmp = x * y
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
assert x < y && y < z_m && z_m < t && t < a;
public static double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 7.5e-94) {
		tmp = (x * (z_m * y)) / z_m;
	} else {
		tmp = x * y;
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
[x, y, z_m, t, a] = sort([x, y, z_m, t, a])
def code(z_s, x, y, z_m, t, a):
	tmp = 0
	if z_m <= 7.5e-94:
		tmp = (x * (z_m * y)) / z_m
	else:
		tmp = x * y
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
x, y, z_m, t, a = sort([x, y, z_m, t, a])
function code(z_s, x, y, z_m, t, a)
	tmp = 0.0
	if (z_m <= 7.5e-94)
		tmp = Float64(Float64(x * Float64(z_m * y)) / z_m);
	else
		tmp = Float64(x * y);
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
x, y, z_m, t, a = num2cell(sort([x, y, z_m, t, a])){:}
function tmp_2 = code(z_s, x, y, z_m, t, a)
	tmp = 0.0;
	if (z_m <= 7.5e-94)
		tmp = (x * (z_m * y)) / z_m;
	else
		tmp = x * y;
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, x_, y_, z$95$m_, t_, a_] := N[(z$95$s * If[LessEqual[z$95$m, 7.5e-94], N[(N[(x * N[(z$95$m * y), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(x * y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
[x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 7.5 \cdot 10^{-94}:\\
\;\;\;\;\frac{x \cdot \left(z\_m \cdot y\right)}{z\_m}\\

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


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

    1. Initial program 64.6%

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around 0 25.9%

      \[\leadsto x \cdot \left(y \cdot \frac{z}{\color{blue}{z + -0.5 \cdot \frac{a \cdot t}{z}}}\right) \]
    6. Step-by-step derivation
      1. associate-/l*25.8%

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

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

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

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

    if 7.5000000000000003e-94 < z

    1. Initial program 65.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7.5 \cdot 10^{-94}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.9% accurate, 9.4× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ [x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\ \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 1.8 \cdot 10^{-186}:\\ \;\;\;\;y \cdot \frac{z\_m \cdot x}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s x y z_m t a)
 :precision binary64
 (* z_s (if (<= z_m 1.8e-186) (* y (/ (* z_m x) z_m)) (* x y))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
assert(x < y && y < z_m && z_m < t && t < a);
double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 1.8e-186) {
		tmp = y * ((z_m * x) / z_m);
	} else {
		tmp = x * y;
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, x, y, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z_m <= 1.8d-186) then
        tmp = y * ((z_m * x) / z_m)
    else
        tmp = x * y
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
assert x < y && y < z_m && z_m < t && t < a;
public static double code(double z_s, double x, double y, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 1.8e-186) {
		tmp = y * ((z_m * x) / z_m);
	} else {
		tmp = x * y;
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
[x, y, z_m, t, a] = sort([x, y, z_m, t, a])
def code(z_s, x, y, z_m, t, a):
	tmp = 0
	if z_m <= 1.8e-186:
		tmp = y * ((z_m * x) / z_m)
	else:
		tmp = x * y
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
x, y, z_m, t, a = sort([x, y, z_m, t, a])
function code(z_s, x, y, z_m, t, a)
	tmp = 0.0
	if (z_m <= 1.8e-186)
		tmp = Float64(y * Float64(Float64(z_m * x) / z_m));
	else
		tmp = Float64(x * y);
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
x, y, z_m, t, a = num2cell(sort([x, y, z_m, t, a])){:}
function tmp_2 = code(z_s, x, y, z_m, t, a)
	tmp = 0.0;
	if (z_m <= 1.8e-186)
		tmp = y * ((z_m * x) / z_m);
	else
		tmp = x * y;
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, x_, y_, z$95$m_, t_, a_] := N[(z$95$s * If[LessEqual[z$95$m, 1.8e-186], N[(y * N[(N[(z$95$m * x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
[x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\
\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.8 \cdot 10^{-186}:\\
\;\;\;\;y \cdot \frac{z\_m \cdot x}{z\_m}\\

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


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

    1. Initial program 63.4%

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

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

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

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

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

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

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

    if 1.7999999999999999e-186 < z

    1. Initial program 67.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.8 \cdot 10^{-186}:\\ \;\;\;\;y \cdot \frac{z \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.0% accurate, 37.7× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ [x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\ \\ z\_s \cdot \left(x \cdot y\right) \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s x y z_m t a) :precision binary64 (* z_s (* x y)))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
assert(x < y && y < z_m && z_m < t && t < a);
double code(double z_s, double x, double y, double z_m, double t, double a) {
	return z_s * (x * y);
}
z\_m = abs(z)
z\_s = copysign(1.0d0, z)
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, x, y, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = z_s * (x * y)
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
assert x < y && y < z_m && z_m < t && t < a;
public static double code(double z_s, double x, double y, double z_m, double t, double a) {
	return z_s * (x * y);
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
[x, y, z_m, t, a] = sort([x, y, z_m, t, a])
def code(z_s, x, y, z_m, t, a):
	return z_s * (x * y)
z\_m = abs(z)
z\_s = copysign(1.0, z)
x, y, z_m, t, a = sort([x, y, z_m, t, a])
function code(z_s, x, y, z_m, t, a)
	return Float64(z_s * Float64(x * y))
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
x, y, z_m, t, a = num2cell(sort([x, y, z_m, t, a])){:}
function tmp = code(z_s, x, y, z_m, t, a)
	tmp = z_s * (x * y);
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, x_, y_, z$95$m_, t_, a_] := N[(z$95$s * N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)
\\
[x, y, z_m, t, a] = \mathsf{sort}([x, y, z_m, t, a])\\
\\
z\_s \cdot \left(x \cdot y\right)
\end{array}
Derivation
  1. Initial program 65.0%

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

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

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

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

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

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

    \[\leadsto y \cdot \color{blue}{x} \]
  6. Final simplification44.3%

    \[\leadsto x \cdot y \]
  7. Add Preprocessing

Developer Target 1: 89.1% accurate, 0.9× 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 2024146 
(FPCore (x y z t a)
  :name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< z -31921305903852764000000000000000000000000000000) (- (* y x)) (if (< z 5976268120920894000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x))))

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