Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2

Percentage Accurate: 82.8% → 99.0%
Time: 8.2s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z):
	return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z)
	return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0)))
end
function tmp = code(x, y, z)
	tmp = (x * y) / ((z * z) * (z + 1.0));
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\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: 82.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
	return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z):
	return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z)
	return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0)))
end
function tmp = code(x, y, z)
	tmp = (x * y) / ((z * z) * (z + 1.0));
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}

Alternative 1: 99.0% 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;\frac{x_m \cdot y_m}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 5 \cdot 10^{-35}:\\ \;\;\;\;\frac{-x_m}{z \cdot \left(\frac{z}{y_m} \cdot \left(-1 - z\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y_m}{z + 1} \cdot \frac{x_m}{z}}{z}\\ \end{array}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (/ (* x_m y_m) (* (* z z) (+ z 1.0))) 5e-35)
     (/ (- x_m) (* z (* (/ z y_m) (- -1.0 z))))
     (/ (* (/ y_m (+ z 1.0)) (/ x_m z)) z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (((x_m * y_m) / ((z * z) * (z + 1.0))) <= 5e-35) {
		tmp = -x_m / (z * ((z / y_m) * (-1.0 - z)));
	} else {
		tmp = ((y_m / (z + 1.0)) * (x_m / z)) / z;
	}
	return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    real(8) :: tmp
    if (((x_m * y_m) / ((z * z) * (z + 1.0d0))) <= 5d-35) then
        tmp = -x_m / (z * ((z / y_m) * ((-1.0d0) - z)))
    else
        tmp = ((y_m / (z + 1.0d0)) * (x_m / z)) / z
    end if
    code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (((x_m * y_m) / ((z * z) * (z + 1.0))) <= 5e-35) {
		tmp = -x_m / (z * ((z / y_m) * (-1.0 - z)));
	} else {
		tmp = ((y_m / (z + 1.0)) * (x_m / z)) / z;
	}
	return 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)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if ((x_m * y_m) / ((z * z) * (z + 1.0))) <= 5e-35:
		tmp = -x_m / (z * ((z / y_m) * (-1.0 - z)))
	else:
		tmp = ((y_m / (z + 1.0)) * (x_m / z)) / z
	return 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)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (Float64(Float64(x_m * y_m) / Float64(Float64(z * z) * Float64(z + 1.0))) <= 5e-35)
		tmp = Float64(Float64(-x_m) / Float64(z * Float64(Float64(z / y_m) * Float64(-1.0 - z))));
	else
		tmp = Float64(Float64(Float64(y_m / Float64(z + 1.0)) * Float64(x_m / z)) / z);
	end
	return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (((x_m * y_m) / ((z * z) * (z + 1.0))) <= 5e-35)
		tmp = -x_m / (z * ((z / y_m) * (-1.0 - z)));
	else
		tmp = ((y_m / (z + 1.0)) * (x_m / z)) / z;
	end
	tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-35], N[((-x$95$m) / N[(z * N[(N[(z / y$95$m), $MachinePrecision] * N[(-1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{x_m \cdot y_m}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 5 \cdot 10^{-35}:\\
\;\;\;\;\frac{-x_m}{z \cdot \left(\frac{z}{y_m} \cdot \left(-1 - z\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{y_m}{z + 1} \cdot \frac{x_m}{z}}{z}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1))) < 4.99999999999999964e-35

    1. Initial program 87.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. frac-times91.1%

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/88.8%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac95.3%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Step-by-step derivation
      1. *-commutative95.3%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1}}{z} \cdot \frac{x}{z}} \]
      2. clear-num95.3%

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

        \[\leadsto \frac{1}{\frac{z}{\frac{y}{z + 1}}} \cdot \color{blue}{\frac{-x}{-z}} \]
      4. frac-times94.6%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(-x\right)}{\frac{z}{\frac{y}{z + 1}} \cdot \left(-z\right)}} \]
      5. *-un-lft-identity94.6%

        \[\leadsto \frac{\color{blue}{-x}}{\frac{z}{\frac{y}{z + 1}} \cdot \left(-z\right)} \]
      6. associate-/r/94.6%

        \[\leadsto \frac{-x}{\color{blue}{\left(\frac{z}{y} \cdot \left(z + 1\right)\right)} \cdot \left(-z\right)} \]
    5. Applied egg-rr94.6%

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

    if 4.99999999999999964e-35 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1)))

    1. Initial program 69.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg69.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac79.5%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg79.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified79.5%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Step-by-step derivation
      1. *-commutative79.5%

        \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*93.8%

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/99.5%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    5. Applied egg-rr99.5%

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

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

Alternative 2: 97.0% accurate, 0.8× 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{x_m}{z} \cdot \frac{\frac{y_m}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y_m \cdot \frac{x_m}{z}}{z}\\ \end{array}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (or (<= z -1.0) (not (<= z 1.0)))
     (* (/ x_m z) (/ (/ y_m z) z))
     (/ (* y_m (/ x_m z)) z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if ((z <= -1.0) || !(z <= 1.0)) {
		tmp = (x_m / z) * ((y_m / z) / z);
	} else {
		tmp = (y_m * (x_m / z)) / z;
	}
	return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    real(8) :: tmp
    if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
        tmp = (x_m / z) * ((y_m / z) / z)
    else
        tmp = (y_m * (x_m / z)) / z
    end if
    code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if ((z <= -1.0) || !(z <= 1.0)) {
		tmp = (x_m / z) * ((y_m / z) / z);
	} else {
		tmp = (y_m * (x_m / z)) / z;
	}
	return 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)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if (z <= -1.0) or not (z <= 1.0):
		tmp = (x_m / z) * ((y_m / z) / z)
	else:
		tmp = (y_m * (x_m / z)) / z
	return 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)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if ((z <= -1.0) || !(z <= 1.0))
		tmp = Float64(Float64(x_m / z) * Float64(Float64(y_m / z) / z));
	else
		tmp = Float64(Float64(y_m * Float64(x_m / z)) / z);
	end
	return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if ((z <= -1.0) || ~((z <= 1.0)))
		tmp = (x_m / z) * ((y_m / z) / z);
	else
		tmp = (y_m * (x_m / z)) / z;
	end
	tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x$95$m / z), $MachinePrecision] * N[(N[(y$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x_m}{z} \cdot \frac{\frac{y_m}{z}}{z}\\

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


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

    1. Initial program 86.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. frac-times91.5%

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/94.1%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac96.3%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Taylor expanded in z around inf 94.9%

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

    if -1 < z < 1

    1. Initial program 77.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg77.3%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac83.5%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg83.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*94.2%

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/96.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    5. Applied egg-rr96.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    6. Taylor expanded in z around 0 85.0%

      \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z}}}{z} \]
    7. Step-by-step derivation
      1. *-commutative85.0%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{z}}{z} \]
      2. associate-*r/95.7%

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{z}}}{z} \]
    8. Simplified95.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\ \end{array} \]

Alternative 3: 96.6% accurate, 0.8× 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x_m}{z \cdot \left(z \cdot \frac{z}{y_m}\right)}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{y_m \cdot \frac{x_m}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x_m}{z} \cdot \frac{\frac{y_m}{z}}{z}\\ \end{array}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z -1.0)
     (/ x_m (* z (* z (/ z y_m))))
     (if (<= z 1.0) (/ (* y_m (/ x_m z)) z) (* (/ x_m z) (/ (/ y_m z) z)))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = x_m / (z * (z * (z / y_m)));
	} else if (z <= 1.0) {
		tmp = (y_m * (x_m / z)) / z;
	} else {
		tmp = (x_m / z) * ((y_m / z) / z);
	}
	return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    real(8) :: tmp
    if (z <= (-1.0d0)) then
        tmp = x_m / (z * (z * (z / y_m)))
    else if (z <= 1.0d0) then
        tmp = (y_m * (x_m / z)) / z
    else
        tmp = (x_m / z) * ((y_m / z) / z)
    end if
    code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = x_m / (z * (z * (z / y_m)));
	} else if (z <= 1.0) {
		tmp = (y_m * (x_m / z)) / z;
	} else {
		tmp = (x_m / z) * ((y_m / z) / z);
	}
	return 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)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= -1.0:
		tmp = x_m / (z * (z * (z / y_m)))
	elif z <= 1.0:
		tmp = (y_m * (x_m / z)) / z
	else:
		tmp = (x_m / z) * ((y_m / z) / z)
	return 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)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(x_m / Float64(z * Float64(z * Float64(z / y_m))));
	elseif (z <= 1.0)
		tmp = Float64(Float64(y_m * Float64(x_m / z)) / z);
	else
		tmp = Float64(Float64(x_m / z) * Float64(Float64(y_m / z) / z));
	end
	return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = x_m / (z * (z * (z / y_m)));
	elseif (z <= 1.0)
		tmp = (y_m * (x_m / z)) / z;
	else
		tmp = (x_m / z) * ((y_m / z) / z);
	end
	tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.0], N[(x$95$m / N[(z * N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y$95$m * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(N[(y$95$m / z), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x_m}{z \cdot \left(z \cdot \frac{z}{y_m}\right)}\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{y_m \cdot \frac{x_m}{z}}{z}\\

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


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

    1. Initial program 87.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. frac-times88.5%

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/94.3%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac93.8%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Taylor expanded in z around inf 91.4%

      \[\leadsto \frac{x}{z} \cdot \frac{\color{blue}{\frac{y}{z}}}{z} \]
    5. Step-by-step derivation
      1. *-commutative91.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{z} \cdot \frac{x}{z}} \]
      2. clear-num91.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{y}{z}}}} \cdot \frac{x}{z} \]
      3. frac-times90.9%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{z}{\frac{y}{z}} \cdot z}} \]
      4. *-un-lft-identity90.9%

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{\frac{y}{z}} \cdot z} \]
      5. div-inv90.9%

        \[\leadsto \frac{x}{\color{blue}{\left(z \cdot \frac{1}{\frac{y}{z}}\right)} \cdot z} \]
      6. clear-num91.0%

        \[\leadsto \frac{x}{\left(z \cdot \color{blue}{\frac{z}{y}}\right) \cdot z} \]
    6. Applied egg-rr91.0%

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

    if -1 < z < 1

    1. Initial program 77.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg77.3%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac83.5%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg83.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*94.2%

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/96.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    5. Applied egg-rr96.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    6. Taylor expanded in z around 0 85.0%

      \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z}}}{z} \]
    7. Step-by-step derivation
      1. *-commutative85.0%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{z}}{z} \]
      2. associate-*r/95.7%

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{z}}}{z} \]
    8. Simplified95.7%

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

    if 1 < z

    1. Initial program 85.8%

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

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/93.9%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac99.9%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Taylor expanded in z around inf 99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x}{z \cdot \left(z \cdot \frac{z}{y}\right)}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\ \end{array} \]

Alternative 4: 96.9% accurate, 0.8× 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x_m}{z \cdot \left(z \cdot \frac{z}{y_m}\right)}\\ \mathbf{elif}\;z \leq 0.75:\\ \;\;\;\;\frac{y_m \cdot \left(\frac{x_m}{z} - x_m\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x_m}{z} \cdot \frac{\frac{y_m}{z}}{z}\\ \end{array}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z -1.0)
     (/ x_m (* z (* z (/ z y_m))))
     (if (<= z 0.75)
       (/ (* y_m (- (/ x_m z) x_m)) z)
       (* (/ x_m z) (/ (/ y_m z) z)))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = x_m / (z * (z * (z / y_m)));
	} else if (z <= 0.75) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = (x_m / z) * ((y_m / z) / z);
	}
	return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    real(8) :: tmp
    if (z <= (-1.0d0)) then
        tmp = x_m / (z * (z * (z / y_m)))
    else if (z <= 0.75d0) then
        tmp = (y_m * ((x_m / z) - x_m)) / z
    else
        tmp = (x_m / z) * ((y_m / z) / z)
    end if
    code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = x_m / (z * (z * (z / y_m)));
	} else if (z <= 0.75) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = (x_m / z) * ((y_m / z) / z);
	}
	return 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)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= -1.0:
		tmp = x_m / (z * (z * (z / y_m)))
	elif z <= 0.75:
		tmp = (y_m * ((x_m / z) - x_m)) / z
	else:
		tmp = (x_m / z) * ((y_m / z) / z)
	return 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)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(x_m / Float64(z * Float64(z * Float64(z / y_m))));
	elseif (z <= 0.75)
		tmp = Float64(Float64(y_m * Float64(Float64(x_m / z) - x_m)) / z);
	else
		tmp = Float64(Float64(x_m / z) * Float64(Float64(y_m / z) / z));
	end
	return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = x_m / (z * (z * (z / y_m)));
	elseif (z <= 0.75)
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	else
		tmp = (x_m / z) * ((y_m / z) / z);
	end
	tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.0], N[(x$95$m / N[(z * N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.75], N[(N[(y$95$m * N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(N[(y$95$m / z), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x_m}{z \cdot \left(z \cdot \frac{z}{y_m}\right)}\\

\mathbf{elif}\;z \leq 0.75:\\
\;\;\;\;\frac{y_m \cdot \left(\frac{x_m}{z} - x_m\right)}{z}\\

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


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

    1. Initial program 87.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. frac-times88.5%

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/94.3%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac93.8%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Taylor expanded in z around inf 91.4%

      \[\leadsto \frac{x}{z} \cdot \frac{\color{blue}{\frac{y}{z}}}{z} \]
    5. Step-by-step derivation
      1. *-commutative91.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{z} \cdot \frac{x}{z}} \]
      2. clear-num91.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{y}{z}}}} \cdot \frac{x}{z} \]
      3. frac-times90.9%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{z}{\frac{y}{z}} \cdot z}} \]
      4. *-un-lft-identity90.9%

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{\frac{y}{z}} \cdot z} \]
      5. div-inv90.9%

        \[\leadsto \frac{x}{\color{blue}{\left(z \cdot \frac{1}{\frac{y}{z}}\right)} \cdot z} \]
      6. clear-num91.0%

        \[\leadsto \frac{x}{\left(z \cdot \color{blue}{\frac{z}{y}}\right) \cdot z} \]
    6. Applied egg-rr91.0%

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

    if -1 < z < 0.75

    1. Initial program 77.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg77.3%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac83.5%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg83.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*94.2%

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/96.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    5. Applied egg-rr96.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    6. Taylor expanded in z around 0 79.5%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right) + \frac{x \cdot y}{z}}}{z} \]
    7. Step-by-step derivation
      1. mul-1-neg79.5%

        \[\leadsto \frac{\color{blue}{\left(-x \cdot y\right)} + \frac{x \cdot y}{z}}{z} \]
      2. distribute-lft-neg-out79.5%

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot y} + \frac{x \cdot y}{z}}{z} \]
      3. +-commutative79.5%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z} + \left(-x\right) \cdot y}}{z} \]
      4. *-commutative79.5%

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

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

        \[\leadsto \frac{y \cdot \frac{x}{z} + \color{blue}{y \cdot \left(-x\right)}}{z} \]
      7. distribute-lft-out96.8%

        \[\leadsto \frac{\color{blue}{y \cdot \left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
    8. Simplified96.8%

      \[\leadsto \frac{\color{blue}{y \cdot \left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
    9. Taylor expanded in y around 0 96.8%

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

    if 0.75 < z

    1. Initial program 85.8%

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

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/93.9%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac99.9%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Taylor expanded in z around inf 99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x}{z \cdot \left(z \cdot \frac{z}{y}\right)}\\ \mathbf{elif}\;z \leq 0.75:\\ \;\;\;\;\frac{y \cdot \left(\frac{x}{z} - x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\ \end{array} \]

Alternative 5: 96.8% accurate, 0.8× 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x_m}{z \cdot \left(z \cdot \frac{z}{y_m}\right)}\\ \mathbf{elif}\;z \leq 0.76:\\ \;\;\;\;\frac{y_m \cdot \left(\frac{x_m}{z} - x_m\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x_m}{z} \cdot \frac{y_m}{z}}{z}\\ \end{array}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z -1.0)
     (/ x_m (* z (* z (/ z y_m))))
     (if (<= z 0.76)
       (/ (* y_m (- (/ x_m z) x_m)) z)
       (/ (* (/ x_m z) (/ y_m z)) z))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = x_m / (z * (z * (z / y_m)));
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = ((x_m / z) * (y_m / z)) / z;
	}
	return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    real(8) :: tmp
    if (z <= (-1.0d0)) then
        tmp = x_m / (z * (z * (z / y_m)))
    else if (z <= 0.76d0) then
        tmp = (y_m * ((x_m / z) - x_m)) / z
    else
        tmp = ((x_m / z) * (y_m / z)) / z
    end if
    code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = x_m / (z * (z * (z / y_m)));
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = ((x_m / z) * (y_m / z)) / z;
	}
	return 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)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= -1.0:
		tmp = x_m / (z * (z * (z / y_m)))
	elif z <= 0.76:
		tmp = (y_m * ((x_m / z) - x_m)) / z
	else:
		tmp = ((x_m / z) * (y_m / z)) / z
	return 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)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(x_m / Float64(z * Float64(z * Float64(z / y_m))));
	elseif (z <= 0.76)
		tmp = Float64(Float64(y_m * Float64(Float64(x_m / z) - x_m)) / z);
	else
		tmp = Float64(Float64(Float64(x_m / z) * Float64(y_m / z)) / z);
	end
	return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = x_m / (z * (z * (z / y_m)));
	elseif (z <= 0.76)
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	else
		tmp = ((x_m / z) * (y_m / z)) / z;
	end
	tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.0], N[(x$95$m / N[(z * N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.76], N[(N[(y$95$m * N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x_m}{z \cdot \left(z \cdot \frac{z}{y_m}\right)}\\

\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{y_m \cdot \left(\frac{x_m}{z} - x_m\right)}{z}\\

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


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

    1. Initial program 87.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. frac-times88.5%

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/94.3%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac93.8%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Taylor expanded in z around inf 91.4%

      \[\leadsto \frac{x}{z} \cdot \frac{\color{blue}{\frac{y}{z}}}{z} \]
    5. Step-by-step derivation
      1. *-commutative91.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{z} \cdot \frac{x}{z}} \]
      2. clear-num91.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{y}{z}}}} \cdot \frac{x}{z} \]
      3. frac-times90.9%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{z}{\frac{y}{z}} \cdot z}} \]
      4. *-un-lft-identity90.9%

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{\frac{y}{z}} \cdot z} \]
      5. div-inv90.9%

        \[\leadsto \frac{x}{\color{blue}{\left(z \cdot \frac{1}{\frac{y}{z}}\right)} \cdot z} \]
      6. clear-num91.0%

        \[\leadsto \frac{x}{\left(z \cdot \color{blue}{\frac{z}{y}}\right) \cdot z} \]
    6. Applied egg-rr91.0%

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

    if -1 < z < 0.76000000000000001

    1. Initial program 77.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg77.3%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac83.5%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg83.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*94.2%

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/96.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    5. Applied egg-rr96.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    6. Taylor expanded in z around 0 79.5%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right) + \frac{x \cdot y}{z}}}{z} \]
    7. Step-by-step derivation
      1. mul-1-neg79.5%

        \[\leadsto \frac{\color{blue}{\left(-x \cdot y\right)} + \frac{x \cdot y}{z}}{z} \]
      2. distribute-lft-neg-out79.5%

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot y} + \frac{x \cdot y}{z}}{z} \]
      3. +-commutative79.5%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z} + \left(-x\right) \cdot y}}{z} \]
      4. *-commutative79.5%

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

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

        \[\leadsto \frac{y \cdot \frac{x}{z} + \color{blue}{y \cdot \left(-x\right)}}{z} \]
      7. distribute-lft-out96.8%

        \[\leadsto \frac{\color{blue}{y \cdot \left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
    8. Simplified96.8%

      \[\leadsto \frac{\color{blue}{y \cdot \left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
    9. Taylor expanded in y around 0 96.8%

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

    if 0.76000000000000001 < z

    1. Initial program 85.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg85.8%

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

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg95.9%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified95.9%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Taylor expanded in z around inf 95.9%

      \[\leadsto \frac{x}{z \cdot z} \cdot \color{blue}{\frac{y}{z}} \]
    5. Step-by-step derivation
      1. *-commutative95.9%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*99.9%

        \[\leadsto \frac{y}{z} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/99.9%

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot \frac{x}{z}}{z}} \]
    6. Applied egg-rr99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x}{z \cdot \left(z \cdot \frac{z}{y}\right)}\\ \mathbf{elif}\;z \leq 0.76:\\ \;\;\;\;\frac{y \cdot \left(\frac{x}{z} - x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\ \end{array} \]

Alternative 6: 96.9% accurate, 0.8× 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{\frac{x_m \cdot \frac{y_m}{z}}{z}}{z}\\ \mathbf{elif}\;z \leq 0.76:\\ \;\;\;\;\frac{y_m \cdot \left(\frac{x_m}{z} - x_m\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x_m}{z} \cdot \frac{y_m}{z}}{z}\\ \end{array}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z -1.0)
     (/ (/ (* x_m (/ y_m z)) z) z)
     (if (<= z 0.76)
       (/ (* y_m (- (/ x_m z) x_m)) z)
       (/ (* (/ x_m z) (/ y_m z)) z))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = ((x_m * (y_m / z)) / z) / z;
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = ((x_m / z) * (y_m / z)) / z;
	}
	return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    real(8) :: tmp
    if (z <= (-1.0d0)) then
        tmp = ((x_m * (y_m / z)) / z) / z
    else if (z <= 0.76d0) then
        tmp = (y_m * ((x_m / z) - x_m)) / z
    else
        tmp = ((x_m / z) * (y_m / z)) / z
    end if
    code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = ((x_m * (y_m / z)) / z) / z;
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = ((x_m / z) * (y_m / z)) / z;
	}
	return 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)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if z <= -1.0:
		tmp = ((x_m * (y_m / z)) / z) / z
	elif z <= 0.76:
		tmp = (y_m * ((x_m / z) - x_m)) / z
	else:
		tmp = ((x_m / z) * (y_m / z)) / z
	return 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)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(Float64(Float64(x_m * Float64(y_m / z)) / z) / z);
	elseif (z <= 0.76)
		tmp = Float64(Float64(y_m * Float64(Float64(x_m / z) - x_m)) / z);
	else
		tmp = Float64(Float64(Float64(x_m / z) * Float64(y_m / z)) / z);
	end
	return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = ((x_m * (y_m / z)) / z) / z;
	elseif (z <= 0.76)
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	else
		tmp = ((x_m / z) * (y_m / z)) / z;
	end
	tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.0], N[(N[(N[(x$95$m * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 0.76], N[(N[(y$95$m * N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{\frac{x_m \cdot \frac{y_m}{z}}{z}}{z}\\

\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{y_m \cdot \left(\frac{x_m}{z} - x_m\right)}{z}\\

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


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

    1. Initial program 87.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg87.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac88.5%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg88.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified88.5%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Step-by-step derivation
      1. *-commutative88.5%

        \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*92.2%

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/96.2%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    5. Applied egg-rr96.2%

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

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

      \[\leadsto \frac{\color{blue}{\frac{\frac{y}{z + 1} \cdot x}{z}}}{z} \]
    8. Taylor expanded in z around inf 96.0%

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

    if -1 < z < 0.76000000000000001

    1. Initial program 77.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg77.3%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac83.5%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg83.5%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*94.2%

        \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/96.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    5. Applied egg-rr96.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
    6. Taylor expanded in z around 0 79.5%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right) + \frac{x \cdot y}{z}}}{z} \]
    7. Step-by-step derivation
      1. mul-1-neg79.5%

        \[\leadsto \frac{\color{blue}{\left(-x \cdot y\right)} + \frac{x \cdot y}{z}}{z} \]
      2. distribute-lft-neg-out79.5%

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot y} + \frac{x \cdot y}{z}}{z} \]
      3. +-commutative79.5%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z} + \left(-x\right) \cdot y}}{z} \]
      4. *-commutative79.5%

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

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

        \[\leadsto \frac{y \cdot \frac{x}{z} + \color{blue}{y \cdot \left(-x\right)}}{z} \]
      7. distribute-lft-out96.8%

        \[\leadsto \frac{\color{blue}{y \cdot \left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
    8. Simplified96.8%

      \[\leadsto \frac{\color{blue}{y \cdot \left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
    9. Taylor expanded in y around 0 96.8%

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

    if 0.76000000000000001 < z

    1. Initial program 85.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg85.8%

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

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg95.9%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified95.9%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Taylor expanded in z around inf 95.9%

      \[\leadsto \frac{x}{z \cdot z} \cdot \color{blue}{\frac{y}{z}} \]
    5. Step-by-step derivation
      1. *-commutative95.9%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z \cdot z}} \]
      2. associate-/r*99.9%

        \[\leadsto \frac{y}{z} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
      3. associate-*r/99.9%

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot \frac{x}{z}}{z}} \]
    6. Applied egg-rr99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{\frac{x \cdot \frac{y}{z}}{z}}{z}\\ \mathbf{elif}\;z \leq 0.76:\\ \;\;\;\;\frac{y \cdot \left(\frac{x}{z} - x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\ \end{array} \]

Alternative 7: 97.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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \left(\frac{x_m}{z} \cdot \frac{\frac{y_m}{z + 1}}{z}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (* (/ x_m z) (/ (/ y_m (+ z 1.0)) z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * ((x_m / z) * ((y_m / (z + 1.0)) / z)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    code = y_s * (x_s * ((x_m / z) * ((y_m / (z + 1.0d0)) / z)))
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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * ((x_m / z) * ((y_m / (z + 1.0)) / z)));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * ((x_m / z) * ((y_m / (z + 1.0)) / z)))
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(Float64(x_m / z) * Float64(Float64(y_m / Float64(z + 1.0)) / z))))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * ((x_m / z) * ((y_m / (z + 1.0)) / z)));
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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(x$95$m / z), $MachinePrecision] * N[(N[(y$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \left(\frac{x_m}{z} \cdot \frac{\frac{y_m}{z + 1}}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 81.7%

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  2. Step-by-step derivation
    1. frac-times87.2%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    2. associate-*l/85.1%

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

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

    \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
  4. Final simplification96.0%

    \[\leadsto \frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z} \]

Alternative 8: 98.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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \frac{\frac{y_m}{z + 1} \cdot \frac{x_m}{z}}{z}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (/ (* (/ y_m (+ z 1.0)) (/ x_m z)) z))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (((y_m / (z + 1.0)) * (x_m / z)) / z));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    code = y_s * (x_s * (((y_m / (z + 1.0d0)) * (x_m / z)) / z))
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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (((y_m / (z + 1.0)) * (x_m / z)) / z));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * (((y_m / (z + 1.0)) * (x_m / z)) / z))
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(Float64(Float64(y_m / Float64(z + 1.0)) * Float64(x_m / z)) / z)))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * (((y_m / (z + 1.0)) * (x_m / z)) / z));
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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(N[(y$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \frac{\frac{y_m}{z + 1} \cdot \frac{x_m}{z}}{z}\right)
\end{array}
Derivation
  1. Initial program 81.7%

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  2. Step-by-step derivation
    1. sqr-neg81.7%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
    2. times-frac87.2%

      \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
    3. sqr-neg87.2%

      \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
  3. Simplified87.2%

    \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
  4. Step-by-step derivation
    1. *-commutative87.2%

      \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
    2. associate-/r*94.8%

      \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
    3. associate-*r/97.3%

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

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

    \[\leadsto \frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z} \]

Alternative 9: 81.2% accurate, 1.2× 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \begin{array}{l} \mathbf{if}\;y_m \leq 2.05 \cdot 10^{+58}:\\ \;\;\;\;\frac{x_m}{z} \cdot \frac{y_m}{z}\\ \mathbf{else}:\\ \;\;\;\;y_m \cdot \frac{x_m}{z \cdot z}\\ \end{array}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= y_m 2.05e+58) (* (/ x_m z) (/ y_m z)) (* y_m (/ x_m (* z z)))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (y_m <= 2.05e+58) {
		tmp = (x_m / z) * (y_m / z);
	} else {
		tmp = y_m * (x_m / (z * z));
	}
	return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    real(8) :: tmp
    if (y_m <= 2.05d+58) then
        tmp = (x_m / z) * (y_m / z)
    else
        tmp = y_m * (x_m / (z * z))
    end if
    code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (y_m <= 2.05e+58) {
		tmp = (x_m / z) * (y_m / z);
	} else {
		tmp = y_m * (x_m / (z * z));
	}
	return 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)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	tmp = 0
	if y_m <= 2.05e+58:
		tmp = (x_m / z) * (y_m / z)
	else:
		tmp = y_m * (x_m / (z * z))
	return 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)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (y_m <= 2.05e+58)
		tmp = Float64(Float64(x_m / z) * Float64(y_m / z));
	else
		tmp = Float64(y_m * Float64(x_m / Float64(z * z)));
	end
	return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0;
	if (y_m <= 2.05e+58)
		tmp = (x_m / z) * (y_m / z);
	else
		tmp = y_m * (x_m / (z * z));
	end
	tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 2.05e+58], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(x$95$m / N[(z * z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 2.05 \cdot 10^{+58}:\\
\;\;\;\;\frac{x_m}{z} \cdot \frac{y_m}{z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.05e58

    1. Initial program 80.7%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. frac-times86.5%

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
      2. associate-*l/82.6%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{z + 1}}{z \cdot z}} \]
      3. times-frac96.8%

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
    4. Taylor expanded in z around 0 79.7%

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

    if 2.05e58 < y

    1. Initial program 86.1%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Step-by-step derivation
      1. sqr-neg86.1%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      2. times-frac90.4%

        \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
      3. sqr-neg90.4%

        \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
    3. Simplified90.4%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    4. Taylor expanded in z around 0 71.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.05 \cdot 10^{+58}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \end{array} \]

Alternative 10: 74.9% accurate, 1.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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \left(\frac{x_m}{z} \cdot \frac{y_m}{z}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (* (/ x_m z) (/ y_m z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * ((x_m / z) * (y_m / z)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    code = y_s * (x_s * ((x_m / z) * (y_m / z)))
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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * ((x_m / z) * (y_m / z)));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * ((x_m / z) * (y_m / z)))
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(Float64(x_m / z) * Float64(y_m / z))))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * ((x_m / z) * (y_m / z)));
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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \left(\frac{x_m}{z} \cdot \frac{y_m}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 81.7%

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  2. Step-by-step derivation
    1. frac-times87.2%

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
    2. associate-*l/85.1%

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

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

    \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}} \]
  4. Taylor expanded in z around 0 74.0%

    \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{y}{z}} \]
  5. Final simplification74.0%

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

Alternative 11: 27.4% accurate, 1.8× 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) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y_s \cdot \left(x_s \cdot \left(x_m \cdot \frac{-y_m}{z}\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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (* x_m (/ (- y_m) z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (x_m * (-y_m / z)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    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
    code = y_s * (x_s * (x_m * (-y_m / z)))
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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (x_m * (-y_m / z)));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * (x_m * (-y_m / z)))
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(x_m * Float64(Float64(-y_m) / z))))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * (x_m * (-y_m / z)));
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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(x$95$m * N[((-y$95$m) / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y_s \cdot \left(x_s \cdot \left(x_m \cdot \frac{-y_m}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 81.7%

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  2. Step-by-step derivation
    1. sqr-neg81.7%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
    2. times-frac87.2%

      \[\leadsto \color{blue}{\frac{x}{\left(-z\right) \cdot \left(-z\right)} \cdot \frac{y}{z + 1}} \]
    3. sqr-neg87.2%

      \[\leadsto \frac{x}{\color{blue}{z \cdot z}} \cdot \frac{y}{z + 1} \]
  3. Simplified87.2%

    \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}} \]
  4. Step-by-step derivation
    1. *-commutative87.2%

      \[\leadsto \color{blue}{\frac{y}{z + 1} \cdot \frac{x}{z \cdot z}} \]
    2. associate-/r*94.8%

      \[\leadsto \frac{y}{z + 1} \cdot \color{blue}{\frac{\frac{x}{z}}{z}} \]
    3. associate-*r/97.3%

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

    \[\leadsto \color{blue}{\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}} \]
  6. Taylor expanded in z around 0 55.5%

    \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right) + \frac{x \cdot y}{z}}}{z} \]
  7. Step-by-step derivation
    1. mul-1-neg55.5%

      \[\leadsto \frac{\color{blue}{\left(-x \cdot y\right)} + \frac{x \cdot y}{z}}{z} \]
    2. distribute-lft-neg-out55.5%

      \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot y} + \frac{x \cdot y}{z}}{z} \]
    3. +-commutative55.5%

      \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z} + \left(-x\right) \cdot y}}{z} \]
    4. *-commutative55.5%

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

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

      \[\leadsto \frac{y \cdot \frac{x}{z} + \color{blue}{y \cdot \left(-x\right)}}{z} \]
    7. distribute-lft-out64.8%

      \[\leadsto \frac{\color{blue}{y \cdot \left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
  8. Simplified64.8%

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot y\right)}{z}} \]
    2. mul-1-neg22.8%

      \[\leadsto \frac{\color{blue}{-x \cdot y}}{z} \]
    3. *-commutative22.8%

      \[\leadsto \frac{-\color{blue}{y \cdot x}}{z} \]
    4. distribute-lft-neg-in22.8%

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

      \[\leadsto \color{blue}{\frac{-y}{z} \cdot x} \]
  11. Simplified28.4%

    \[\leadsto \color{blue}{\frac{-y}{z} \cdot x} \]
  12. Final simplification28.4%

    \[\leadsto x \cdot \frac{-y}{z} \]

Developer target: 97.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z < 249.6182814532307:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (< z 249.6182814532307)
   (/ (* y (/ x z)) (+ z (* z z)))
   (/ (* (/ (/ y z) (+ 1.0 z)) x) z)))
double code(double x, double y, double z) {
	double tmp;
	if (z < 249.6182814532307) {
		tmp = (y * (x / z)) / (z + (z * z));
	} else {
		tmp = (((y / z) / (1.0 + z)) * x) / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z < 249.6182814532307d0) then
        tmp = (y * (x / z)) / (z + (z * z))
    else
        tmp = (((y / z) / (1.0d0 + z)) * x) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z < 249.6182814532307) {
		tmp = (y * (x / z)) / (z + (z * z));
	} else {
		tmp = (((y / z) / (1.0 + z)) * x) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z < 249.6182814532307:
		tmp = (y * (x / z)) / (z + (z * z))
	else:
		tmp = (((y / z) / (1.0 + z)) * x) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z < 249.6182814532307)
		tmp = Float64(Float64(y * Float64(x / z)) / Float64(z + Float64(z * z)));
	else
		tmp = Float64(Float64(Float64(Float64(y / z) / Float64(1.0 + z)) * x) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z < 249.6182814532307)
		tmp = (y * (x / z)) / (z + (z * z));
	else
		tmp = (((y / z) / (1.0 + z)) * x) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Less[z, 249.6182814532307], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / N[(z + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / z), $MachinePrecision] / N[(1.0 + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z < 249.6182814532307:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023340 
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))

  (/ (* x y) (* (* z z) (+ z 1.0))))