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

Percentage Accurate: 61.4% → 91.6%
Time: 14.8s
Alternatives: 11
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 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.4% 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.6% accurate, 0.5× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ [x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\ \\ z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z_m \leq 470000:\\ \;\;\;\;x_m \cdot \left(\left(z_m \cdot y_m\right) \cdot {\left({z_m}^{2} - t \cdot a\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;x_m \cdot y_m\\ \end{array}\right)\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
 :precision binary64
 (*
  z_s
  (*
   y_s
   (*
    x_s
    (if (<= z_m 470000.0)
      (* x_m (* (* z_m y_m) (pow (- (pow z_m 2.0) (* t a)) -0.5)))
      (* x_m y_m))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 470000.0) {
		tmp = x_m * ((z_m * y_m) * pow((pow(z_m, 2.0) - (t * a)), -0.5));
	} else {
		tmp = x_m * y_m;
	}
	return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z_m <= 470000.0d0) then
        tmp = x_m * ((z_m * y_m) * (((z_m ** 2.0d0) - (t * a)) ** (-0.5d0)))
    else
        tmp = x_m * y_m
    end if
    code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 470000.0) {
		tmp = x_m * ((z_m * y_m) * Math.pow((Math.pow(z_m, 2.0) - (t * a)), -0.5));
	} else {
		tmp = x_m * y_m;
	}
	return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
z_m = math.fabs(z)
z_s = math.copysign(1.0, z)
[x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a])
def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a):
	tmp = 0
	if z_m <= 470000.0:
		tmp = x_m * ((z_m * y_m) * math.pow((math.pow(z_m, 2.0) - (t * a)), -0.5))
	else:
		tmp = x_m * y_m
	return z_s * (y_s * (x_s * tmp))
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
z_m = abs(z)
z_s = copysign(1.0, z)
x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a])
function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
	tmp = 0.0
	if (z_m <= 470000.0)
		tmp = Float64(x_m * Float64(Float64(z_m * y_m) * (Float64((z_m ^ 2.0) - Float64(t * a)) ^ -0.5)));
	else
		tmp = Float64(x_m * y_m);
	end
	return Float64(z_s * Float64(y_s * Float64(x_s * tmp)))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
	tmp = 0.0;
	if (z_m <= 470000.0)
		tmp = x_m * ((z_m * y_m) * (((z_m ^ 2.0) - (t * a)) ^ -0.5));
	else
		tmp = x_m * y_m;
	end
	tmp_2 = z_s * (y_s * (x_s * tmp));
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 470000.0], N[(x$95$m * N[(N[(z$95$m * y$95$m), $MachinePrecision] * N[Power[N[(N[Power[z$95$m, 2.0], $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 470000:\\
\;\;\;\;x_m \cdot \left(\left(z_m \cdot y_m\right) \cdot {\left({z_m}^{2} - t \cdot a\right)}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 4.7e5

    1. Initial program 65.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{x \cdot z}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r/65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.7e5 < z

    1. Initial program 44.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*43.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 470000:\\ \;\;\;\;x \cdot \left(\left(z \cdot y\right) \cdot {\left({z}^{2} - t \cdot a\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 91.2% accurate, 0.5× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ [x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\ \\ z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z_m \leq 29000:\\ \;\;\;\;\left(z_m \cdot y_m\right) \cdot \frac{x_m}{\sqrt{{z_m}^{2} - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;x_m \cdot y_m\\ \end{array}\right)\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
 :precision binary64
 (*
  z_s
  (*
   y_s
   (*
    x_s
    (if (<= z_m 29000.0)
      (* (* z_m y_m) (/ x_m (sqrt (- (pow z_m 2.0) (* t a)))))
      (* x_m y_m))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 29000.0) {
		tmp = (z_m * y_m) * (x_m / sqrt((pow(z_m, 2.0) - (t * a))));
	} else {
		tmp = x_m * y_m;
	}
	return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
    real(8), intent (in) :: z_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (z_m <= 29000.0d0) then
        tmp = (z_m * y_m) * (x_m / sqrt(((z_m ** 2.0d0) - (t * a))))
    else
        tmp = x_m * y_m
    end if
    code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
	double tmp;
	if (z_m <= 29000.0) {
		tmp = (z_m * y_m) * (x_m / Math.sqrt((Math.pow(z_m, 2.0) - (t * a))));
	} else {
		tmp = x_m * y_m;
	}
	return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
z_m = math.fabs(z)
z_s = math.copysign(1.0, z)
[x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a])
def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a):
	tmp = 0
	if z_m <= 29000.0:
		tmp = (z_m * y_m) * (x_m / math.sqrt((math.pow(z_m, 2.0) - (t * a))))
	else:
		tmp = x_m * y_m
	return z_s * (y_s * (x_s * tmp))
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
z_m = abs(z)
z_s = copysign(1.0, z)
x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a])
function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
	tmp = 0.0
	if (z_m <= 29000.0)
		tmp = Float64(Float64(z_m * y_m) * Float64(x_m / sqrt(Float64((z_m ^ 2.0) - Float64(t * a)))));
	else
		tmp = Float64(x_m * y_m);
	end
	return Float64(z_s * Float64(y_s * Float64(x_s * tmp)))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
	tmp = 0.0;
	if (z_m <= 29000.0)
		tmp = (z_m * y_m) * (x_m / sqrt(((z_m ^ 2.0) - (t * a))));
	else
		tmp = x_m * y_m;
	end
	tmp_2 = z_s * (y_s * (x_s * tmp));
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 29000.0], N[(N[(z$95$m * y$95$m), $MachinePrecision] * N[(x$95$m / N[Sqrt[N[(N[Power[z$95$m, 2.0], $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 29000:\\
\;\;\;\;\left(z_m \cdot y_m\right) \cdot \frac{x_m}{\sqrt{{z_m}^{2} - t \cdot a}}\\

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 29000

    1. Initial program 65.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{x \cdot z}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r/65.9%

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

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

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

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

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

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

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

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

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

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

    if 29000 < z

    1. Initial program 44.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*43.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 29000:\\ \;\;\;\;\left(z \cdot y\right) \cdot \frac{x}{\sqrt{{z}^{2} - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 90.3% accurate, 1.0× speedup?

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

\mathbf{elif}\;z_m \leq 1.55 \cdot 10^{+108}:\\
\;\;\;\;\frac{y_m}{\frac{\sqrt{z_m \cdot z_m - t \cdot a}}{z_m \cdot x_m}}\\

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 1.14999999999999993e-170

    1. Initial program 64.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}{\sqrt{z \cdot z - t \cdot a}} \cdot z} \]
      2. *-commutative63.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*63.6%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{x \cdot z}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r/64.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\sqrt{{z}^{2} - t \cdot a}} \cdot \color{blue}{\left(z \cdot y\right)} \]
    6. Applied egg-rr65.0%

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

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

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

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

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

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

    if 1.14999999999999993e-170 < z < 1.5500000000000001e108

    1. Initial program 89.1%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*86.4%

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

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

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

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

    if 1.5500000000000001e108 < z

    1. Initial program 21.3%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*21.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.15 \cdot 10^{-170}:\\ \;\;\;\;\left(z \cdot y\right) \cdot \frac{x}{\sqrt{t \cdot \left(-a\right)}}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+108}:\\ \;\;\;\;\frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 90.3% accurate, 1.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 4.7e5

    1. Initial program 65.9%

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

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

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

    if 4.7e5 < z

    1. Initial program 44.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*43.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 470000:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.2% accurate, 1.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 4.10000000000000028e-58

    1. Initial program 64.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*63.8%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{x \cdot z}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r/64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.10000000000000028e-58 < z

    1. Initial program 51.0%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*51.1%

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

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

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

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

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

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

Alternative 6: 78.6% accurate, 6.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1e5

    1. Initial program 65.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{\frac{\color{blue}{z + \frac{-0.5 \cdot \left(a \cdot t\right)}{z}}}{x \cdot z}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u25.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{\frac{z + \frac{-0.5 \cdot \left(a \cdot t\right)}{z}}{x \cdot z}}\right)\right)} \]
      2. expm1-udef23.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{y}{\frac{z + \frac{-0.5 \cdot \left(a \cdot t\right)}{z}}{x \cdot z}}\right)} - 1} \]
      3. div-inv23.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{y \cdot \frac{1}{\frac{z + \frac{-0.5 \cdot \left(a \cdot t\right)}{z}}{x \cdot z}}}\right)} - 1 \]
      4. clear-num23.6%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{\frac{x \cdot z}{z + \frac{-0.5 \cdot \left(a \cdot t\right)}{z}}}\right)} - 1 \]
      5. *-commutative23.6%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \frac{\color{blue}{z \cdot x}}{z + \frac{-0.5 \cdot \left(a \cdot t\right)}{z}}\right)} - 1 \]
      6. associate-*r*23.6%

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \frac{z \cdot x}{z + \frac{\left(-0.5 \cdot a\right) \cdot t}{z}}\right)\right)} \]
      2. expm1-log1p27.5%

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

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

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

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

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

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

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

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

    if 1e5 < z

    1. Initial program 44.8%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*43.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 100000:\\ \;\;\;\;x \cdot \frac{z \cdot y}{z + \left(a \cdot -0.5\right) \cdot \frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.2% accurate, 12.5× speedup?

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

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.00000000000000008e-215

    1. Initial program 64.3%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*63.7%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{x \cdot z}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r/64.3%

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000008e-215 < z

    1. Initial program 55.1%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*54.1%

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

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

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

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

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

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

Alternative 8: 73.9% accurate, 12.5× speedup?

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

\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\


\end{array}\right)\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 3.14999999999999978e-215

    1. Initial program 64.0%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*63.4%

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

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

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

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

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

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

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

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

    if 3.14999999999999978e-215 < z

    1. Initial program 55.7%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
      3. associate-/l*54.7%

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

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

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

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

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

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

Alternative 9: 74.7% accurate, 12.6× speedup?

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

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

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

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
    3. associate-/l*60.6%

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

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

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

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

    \[\leadsto \frac{y}{\frac{\color{blue}{z}}{x \cdot z}} \]
  6. Step-by-step derivation
    1. div-inv34.3%

      \[\leadsto \frac{y}{\color{blue}{z \cdot \frac{1}{x \cdot z}}} \]
    2. *-commutative34.3%

      \[\leadsto \frac{y}{z \cdot \frac{1}{\color{blue}{z \cdot x}}} \]
  7. Applied egg-rr34.3%

    \[\leadsto \frac{y}{\color{blue}{z \cdot \frac{1}{z \cdot x}}} \]
  8. Final simplification34.3%

    \[\leadsto \frac{y}{z \cdot \frac{1}{z \cdot x}} \]
  9. Add Preprocessing

Alternative 10: 74.7% accurate, 16.1× speedup?

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

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

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

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
    3. associate-/l*60.6%

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

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

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

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

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

    \[\leadsto \frac{y}{\frac{z}{z \cdot x}} \]
  7. Add Preprocessing

Alternative 11: 72.7% accurate, 37.7× speedup?

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

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

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

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\sqrt{z \cdot z - t \cdot a}} \cdot z \]
    3. associate-/l*60.6%

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

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

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

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

    \[\leadsto \color{blue}{x \cdot y} \]
  6. Final simplification34.9%

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

Developer target: 87.2% 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 2024010 
(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)))))