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

Percentage Accurate: 82.7% → 97.5%
Time: 12.8s
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.7% 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: 97.5% accurate, 0.3× 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])\\ \\ \begin{array}{l} t_0 := z \cdot \left(z + 1\right)\\ t_1 := \frac{x\_m \cdot y\_m}{\left(z + 1\right) \cdot \left(z \cdot z\right)}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 2 \cdot 10^{-17}:\\ \;\;\;\;\frac{x\_m}{\frac{z}{y\_m} \cdot t\_0}\\ \mathbf{elif}\;t\_1 \leq 10^{+217}:\\ \;\;\;\;\frac{x\_m \cdot y\_m}{z \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m}{z} \cdot \frac{\frac{x\_m}{z + 1}}{z}\\ \end{array}\right) \end{array} \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
 (let* ((t_0 (* z (+ z 1.0))) (t_1 (/ (* x_m y_m) (* (+ z 1.0) (* z z)))))
   (*
    y_s
    (*
     x_s
     (if (<= t_1 2e-17)
       (/ x_m (* (/ z y_m) t_0))
       (if (<= t_1 1e+217)
         (/ (* x_m y_m) (* z t_0))
         (* (/ y_m z) (/ (/ x_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) {
	double t_0 = z * (z + 1.0);
	double t_1 = (x_m * y_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_1 <= 2e-17) {
		tmp = x_m / ((z / y_m) * t_0);
	} else if (t_1 <= 1e+217) {
		tmp = (x_m * y_m) / (z * t_0);
	} else {
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = z * (z + 1.0d0)
    t_1 = (x_m * y_m) / ((z + 1.0d0) * (z * z))
    if (t_1 <= 2d-17) then
        tmp = x_m / ((z / y_m) * t_0)
    else if (t_1 <= 1d+217) then
        tmp = (x_m * y_m) / (z * t_0)
    else
        tmp = (y_m / z) * ((x_m / (z + 1.0d0)) / 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 t_0 = z * (z + 1.0);
	double t_1 = (x_m * y_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_1 <= 2e-17) {
		tmp = x_m / ((z / y_m) * t_0);
	} else if (t_1 <= 1e+217) {
		tmp = (x_m * y_m) / (z * t_0);
	} else {
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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):
	t_0 = z * (z + 1.0)
	t_1 = (x_m * y_m) / ((z + 1.0) * (z * z))
	tmp = 0
	if t_1 <= 2e-17:
		tmp = x_m / ((z / y_m) * t_0)
	elif t_1 <= 1e+217:
		tmp = (x_m * y_m) / (z * t_0)
	else:
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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)
	t_0 = Float64(z * Float64(z + 1.0))
	t_1 = Float64(Float64(x_m * y_m) / Float64(Float64(z + 1.0) * Float64(z * z)))
	tmp = 0.0
	if (t_1 <= 2e-17)
		tmp = Float64(x_m / Float64(Float64(z / y_m) * t_0));
	elseif (t_1 <= 1e+217)
		tmp = Float64(Float64(x_m * y_m) / Float64(z * t_0));
	else
		tmp = Float64(Float64(y_m / z) * Float64(Float64(x_m / Float64(z + 1.0)) / 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)
	t_0 = z * (z + 1.0);
	t_1 = (x_m * y_m) / ((z + 1.0) * (z * z));
	tmp = 0.0;
	if (t_1 <= 2e-17)
		tmp = x_m / ((z / y_m) * t_0);
	elseif (t_1 <= 1e+217)
		tmp = (x_m * y_m) / (z * t_0);
	else
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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_] := Block[{t$95$0 = N[(z * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$1, 2e-17], N[(x$95$m / N[(N[(z / y$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+217], N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / z), $MachinePrecision] * N[(N[(x$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])\\
\\
\begin{array}{l}
t_0 := z \cdot \left(z + 1\right)\\
t_1 := \frac{x\_m \cdot y\_m}{\left(z + 1\right) \cdot \left(z \cdot z\right)}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y\_m} \cdot t\_0}\\

\mathbf{elif}\;t\_1 \leq 10^{+217}:\\
\;\;\;\;\frac{x\_m \cdot y\_m}{z \cdot t\_0}\\

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


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

    1. Initial program 90.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{\frac{x}{z + 1}}{z}} \]
    5. Step-by-step derivation
      1. clear-num95.8%

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

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

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

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

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

    if 2.00000000000000014e-17 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1))) < 9.9999999999999996e216

    1. Initial program 99.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.6%

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z + 1}}{z \cdot z}} \]
      4. times-frac80.5%

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

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

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

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

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

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

    if 9.9999999999999996e216 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1)))

    1. Initial program 75.5%

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

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

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

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

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

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

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

Alternative 2: 97.4% accurate, 0.3× 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])\\ \\ \begin{array}{l} t_0 := \frac{x\_m \cdot y\_m}{\left(z + 1\right) \cdot \left(z \cdot z\right)}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\frac{x\_m}{\frac{z}{y\_m} \cdot \left(z \cdot \left(z + 1\right)\right)}\\ \mathbf{elif}\;t\_0 \leq 10^{+217}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m}{z} \cdot \frac{\frac{x\_m}{z + 1}}{z}\\ \end{array}\right) \end{array} \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
 (let* ((t_0 (/ (* x_m y_m) (* (+ z 1.0) (* z z)))))
   (*
    y_s
    (*
     x_s
     (if (<= t_0 0.0)
       (/ x_m (* (/ z y_m) (* z (+ z 1.0))))
       (if (<= t_0 1e+217) t_0 (* (/ y_m z) (/ (/ x_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) {
	double t_0 = (x_m * y_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = x_m / ((z / y_m) * (z * (z + 1.0)));
	} else if (t_0 <= 1e+217) {
		tmp = t_0;
	} else {
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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) :: t_0
    real(8) :: tmp
    t_0 = (x_m * y_m) / ((z + 1.0d0) * (z * z))
    if (t_0 <= 0.0d0) then
        tmp = x_m / ((z / y_m) * (z * (z + 1.0d0)))
    else if (t_0 <= 1d+217) then
        tmp = t_0
    else
        tmp = (y_m / z) * ((x_m / (z + 1.0d0)) / 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 t_0 = (x_m * y_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = x_m / ((z / y_m) * (z * (z + 1.0)));
	} else if (t_0 <= 1e+217) {
		tmp = t_0;
	} else {
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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):
	t_0 = (x_m * y_m) / ((z + 1.0) * (z * z))
	tmp = 0
	if t_0 <= 0.0:
		tmp = x_m / ((z / y_m) * (z * (z + 1.0)))
	elif t_0 <= 1e+217:
		tmp = t_0
	else:
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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)
	t_0 = Float64(Float64(x_m * y_m) / Float64(Float64(z + 1.0) * Float64(z * z)))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(x_m / Float64(Float64(z / y_m) * Float64(z * Float64(z + 1.0))));
	elseif (t_0 <= 1e+217)
		tmp = t_0;
	else
		tmp = Float64(Float64(y_m / z) * Float64(Float64(x_m / Float64(z + 1.0)) / 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)
	t_0 = (x_m * y_m) / ((z + 1.0) * (z * z));
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = x_m / ((z / y_m) * (z * (z + 1.0)));
	elseif (t_0 <= 1e+217)
		tmp = t_0;
	else
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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_] := Block[{t$95$0 = N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$0, 0.0], N[(x$95$m / N[(N[(z / y$95$m), $MachinePrecision] * N[(z * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+217], t$95$0, N[(N[(y$95$m / z), $MachinePrecision] * N[(N[(x$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])\\
\\
\begin{array}{l}
t_0 := \frac{x\_m \cdot y\_m}{\left(z + 1\right) \cdot \left(z \cdot z\right)}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y\_m} \cdot \left(z \cdot \left(z + 1\right)\right)}\\

\mathbf{elif}\;t\_0 \leq 10^{+217}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 89.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative89.6%

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{\frac{x}{z + 1}}{z}} \]
    5. Step-by-step derivation
      1. clear-num95.6%

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

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

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

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

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

    if 0.0 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1))) < 9.9999999999999996e216

    1. Initial program 99.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing

    if 9.9999999999999996e216 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1)))

    1. Initial program 75.5%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{\left(z + 1\right) \cdot \left(z \cdot z\right)} \leq 0:\\ \;\;\;\;\frac{x}{\frac{z}{y} \cdot \left(z \cdot \left(z + 1\right)\right)}\\ \mathbf{elif}\;\frac{x \cdot y}{\left(z + 1\right) \cdot \left(z \cdot z\right)} \leq 10^{+217}:\\ \;\;\;\;\frac{x \cdot y}{\left(z + 1\right) \cdot \left(z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z + 1}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 94.8% accurate, 0.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])\\ \\ \begin{array}{l} t_0 := \frac{\frac{x\_m}{z}}{z}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{y\_m}{z} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot t\_0\\ \end{array}\right) \end{array} \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
 (let* ((t_0 (/ (/ x_m z) z)))
   (*
    y_s
    (*
     x_s
     (if (or (<= z -1.0) (not (<= z 1.0))) (* (/ y_m z) t_0) (* y_m t_0))))))
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 t_0 = (x_m / z) / z;
	double tmp;
	if ((z <= -1.0) || !(z <= 1.0)) {
		tmp = (y_m / z) * t_0;
	} else {
		tmp = y_m * t_0;
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = (x_m / z) / z
    if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
        tmp = (y_m / z) * t_0
    else
        tmp = y_m * t_0
    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 t_0 = (x_m / z) / z;
	double tmp;
	if ((z <= -1.0) || !(z <= 1.0)) {
		tmp = (y_m / z) * t_0;
	} else {
		tmp = y_m * t_0;
	}
	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):
	t_0 = (x_m / z) / z
	tmp = 0
	if (z <= -1.0) or not (z <= 1.0):
		tmp = (y_m / z) * t_0
	else:
		tmp = y_m * t_0
	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)
	t_0 = Float64(Float64(x_m / z) / z)
	tmp = 0.0
	if ((z <= -1.0) || !(z <= 1.0))
		tmp = Float64(Float64(y_m / z) * t_0);
	else
		tmp = Float64(y_m * t_0);
	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)
	t_0 = (x_m / z) / z;
	tmp = 0.0;
	if ((z <= -1.0) || ~((z <= 1.0)))
		tmp = (y_m / z) * t_0;
	else
		tmp = y_m * t_0;
	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_] := Block[{t$95$0 = N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(y$95$m / z), $MachinePrecision] * t$95$0), $MachinePrecision], N[(y$95$m * t$95$0), $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])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{x\_m}{z}}{z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{y\_m}{z} \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot t\_0\\


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

    1. Initial program 89.1%

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 86.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}} \]
      2. *-commutative82.7%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z}}}{z} \]
    8. Step-by-step derivation
      1. associate-/l/85.0%

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z}} \]
      2. *-commutative85.0%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} \]
      3. frac-times93.7%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      4. associate-*l/92.4%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z}}{z}} \]
      5. associate-/l*85.3%

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

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

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

Alternative 4: 96.3% accurate, 0.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 \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.76\right):\\ \;\;\;\;\frac{\frac{x\_m \cdot \frac{y\_m}{z}}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m \cdot \left(\frac{x\_m}{z} - x\_m\right)}{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 0.76)))
     (/ (/ (* x_m (/ y_m z)) z) z)
     (/ (* y_m (- (/ x_m z) x_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) {
	double tmp;
	if ((z <= -1.0) || !(z <= 0.76)) {
		tmp = ((x_m * (y_m / z)) / z) / z;
	} else {
		tmp = (y_m * ((x_m / z) - x_m)) / 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 <= 0.76d0))) then
        tmp = ((x_m * (y_m / z)) / z) / z
    else
        tmp = (y_m * ((x_m / z) - x_m)) / 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 <= 0.76)) {
		tmp = ((x_m * (y_m / z)) / z) / z;
	} else {
		tmp = (y_m * ((x_m / z) - x_m)) / 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 <= 0.76):
		tmp = ((x_m * (y_m / z)) / z) / z
	else:
		tmp = (y_m * ((x_m / z) - x_m)) / 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 <= 0.76))
		tmp = Float64(Float64(Float64(x_m * Float64(y_m / z)) / z) / z);
	else
		tmp = Float64(Float64(y_m * Float64(Float64(x_m / z) - x_m)) / 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 <= 0.76)))
		tmp = ((x_m * (y_m / z)) / z) / z;
	else
		tmp = (y_m * ((x_m / z) - x_m)) / 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, 0.76]], $MachinePrecision]], N[(N[(N[(x$95$m * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m * N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $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 0.76\right):\\
\;\;\;\;\frac{\frac{x\_m \cdot \frac{y\_m}{z}}{z}}{z}\\

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


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

    1. Initial program 89.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{x}{z \cdot z}}{z + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l/91.1%

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

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

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

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

        \[\leadsto \frac{\frac{y \cdot \color{blue}{\frac{1}{\frac{z + 1}{x}}}}{z}}{z} \]
      6. un-div-inv99.8%

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

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

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

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

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

    if -1 < z < 0.76000000000000001

    1. Initial program 86.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}} \]
      2. *-commutative82.7%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right) + \frac{x \cdot y}{z}}}{z} \]
    8. Step-by-step derivation
      1. associate-*r*85.8%

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

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

        \[\leadsto \frac{\left(-x\right) \cdot y + \color{blue}{\frac{x}{z} \cdot y}}{z} \]
      4. distribute-rgt-out93.4%

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

        \[\leadsto \frac{y \cdot \color{blue}{\left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
      6. unsub-neg93.4%

        \[\leadsto \frac{y \cdot \color{blue}{\left(\frac{x}{z} - x\right)}}{z} \]
    9. Simplified93.4%

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

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

Alternative 5: 94.5% accurate, 0.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])\\ \\ \begin{array}{l} t_0 := \frac{\frac{x\_m}{z}}{z}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z \cdot z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y\_m \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m}{z} \cdot t\_0\\ \end{array}\right) \end{array} \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
 (let* ((t_0 (/ (/ x_m z) z)))
   (*
    y_s
    (*
     x_s
     (if (<= z -1.0)
       (* (/ x_m z) (/ y_m (* z z)))
       (if (<= z 1.0) (* y_m t_0) (* (/ y_m z) t_0)))))))
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 t_0 = (x_m / z) / z;
	double tmp;
	if (z <= -1.0) {
		tmp = (x_m / z) * (y_m / (z * z));
	} else if (z <= 1.0) {
		tmp = y_m * t_0;
	} else {
		tmp = (y_m / z) * t_0;
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = (x_m / z) / z
    if (z <= (-1.0d0)) then
        tmp = (x_m / z) * (y_m / (z * z))
    else if (z <= 1.0d0) then
        tmp = y_m * t_0
    else
        tmp = (y_m / z) * t_0
    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 t_0 = (x_m / z) / z;
	double tmp;
	if (z <= -1.0) {
		tmp = (x_m / z) * (y_m / (z * z));
	} else if (z <= 1.0) {
		tmp = y_m * t_0;
	} else {
		tmp = (y_m / z) * t_0;
	}
	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):
	t_0 = (x_m / z) / z
	tmp = 0
	if z <= -1.0:
		tmp = (x_m / z) * (y_m / (z * z))
	elif z <= 1.0:
		tmp = y_m * t_0
	else:
		tmp = (y_m / z) * t_0
	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)
	t_0 = Float64(Float64(x_m / z) / z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(Float64(x_m / z) * Float64(y_m / Float64(z * z)));
	elseif (z <= 1.0)
		tmp = Float64(y_m * t_0);
	else
		tmp = Float64(Float64(y_m / z) * t_0);
	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)
	t_0 = (x_m / z) / z;
	tmp = 0.0;
	if (z <= -1.0)
		tmp = (x_m / z) * (y_m / (z * z));
	elseif (z <= 1.0)
		tmp = y_m * t_0;
	else
		tmp = (y_m / z) * t_0;
	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_] := Block[{t$95$0 = N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.0], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(y$95$m * t$95$0), $MachinePrecision], N[(N[(y$95$m / z), $MachinePrecision] * t$95$0), $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])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{x\_m}{z}}{z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z \cdot z}\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;y\_m \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{z} \cdot t\_0\\


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 86.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}} \]
      2. *-commutative82.7%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z}}}{z} \]
    8. Step-by-step derivation
      1. associate-/l/85.0%

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z}} \]
      2. *-commutative85.0%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} \]
      3. frac-times93.7%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      4. associate-*l/92.4%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z}}{z}} \]
      5. associate-/l*85.3%

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

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

    if 1 < z

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

Alternative 6: 95.2% accurate, 0.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 \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z \cdot z}\\ \mathbf{elif}\;z \leq 0.76:\\ \;\;\;\;\frac{y\_m \cdot \left(\frac{x\_m}{z} - x\_m\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m}{z} \cdot \frac{\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 (<= z -1.0)
     (* (/ x_m z) (/ y_m (* z z)))
     (if (<= z 0.76)
       (/ (* y_m (- (/ x_m z) x_m)) z)
       (* (/ y_m z) (/ (/ 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) {
		tmp = (x_m / z) * (y_m / (z * z));
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = (y_m / z) * ((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)) then
        tmp = (x_m / z) * (y_m / (z * z))
    else if (z <= 0.76d0) then
        tmp = (y_m * ((x_m / z) - x_m)) / z
    else
        tmp = (y_m / z) * ((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) {
		tmp = (x_m / z) * (y_m / (z * z));
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = (y_m / z) * ((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:
		tmp = (x_m / z) * (y_m / (z * z))
	elif z <= 0.76:
		tmp = (y_m * ((x_m / z) - x_m)) / z
	else:
		tmp = (y_m / z) * ((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)
		tmp = Float64(Float64(x_m / z) * Float64(y_m / Float64(z * z)));
	elseif (z <= 0.76)
		tmp = Float64(Float64(y_m * Float64(Float64(x_m / z) - x_m)) / z);
	else
		tmp = Float64(Float64(y_m / z) * Float64(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)
		tmp = (x_m / z) * (y_m / (z * z));
	elseif (z <= 0.76)
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	else
		tmp = (y_m / z) * ((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[z, -1.0], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / N[(z * z), $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[(y$95$m / z), $MachinePrecision] * N[(N[(x$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 \frac{y\_m}{z \cdot z}\\

\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{y\_m \cdot \left(\frac{x\_m}{z} - x\_m\right)}{z}\\

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

    if -1 < z < 0.76000000000000001

    1. Initial program 86.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}} \]
      2. *-commutative82.7%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right) + \frac{x \cdot y}{z}}}{z} \]
    8. Step-by-step derivation
      1. associate-*r*85.8%

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

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

        \[\leadsto \frac{\left(-x\right) \cdot y + \color{blue}{\frac{x}{z} \cdot y}}{z} \]
      4. distribute-rgt-out93.4%

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

        \[\leadsto \frac{y \cdot \color{blue}{\left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
      6. unsub-neg93.4%

        \[\leadsto \frac{y \cdot \color{blue}{\left(\frac{x}{z} - x\right)}}{z} \]
    9. Simplified93.4%

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

    if 0.76000000000000001 < z

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

Alternative 7: 95.9% accurate, 0.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 \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{\frac{y\_m}{\frac{z}{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 (<= z -1.0)
     (/ (/ (* x_m (/ y_m z)) z) z)
     (if (<= z 0.76)
       (/ (* y_m (- (/ x_m z) x_m)) z)
       (/ (/ (/ y_m (/ z 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) {
		tmp = ((x_m * (y_m / z)) / z) / z;
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = ((y_m / (z / 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)) 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 = ((y_m / (z / 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) {
		tmp = ((x_m * (y_m / z)) / z) / z;
	} else if (z <= 0.76) {
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	} else {
		tmp = ((y_m / (z / 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:
		tmp = ((x_m * (y_m / z)) / z) / z
	elif z <= 0.76:
		tmp = (y_m * ((x_m / z) - x_m)) / z
	else:
		tmp = ((y_m / (z / 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)
		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(y_m / Float64(z / 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)
		tmp = ((x_m * (y_m / z)) / z) / z;
	elseif (z <= 0.76)
		tmp = (y_m * ((x_m / z) - x_m)) / z;
	else
		tmp = ((y_m / (z / 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[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[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $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{\frac{y\_m}{\frac{z}{x\_m}}}{z}}{z}\\


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

    1. Initial program 88.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{x}{z \cdot z}}{z + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l/86.3%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{z + 1}}{z}}{z}} \]
      5. clear-num99.6%

        \[\leadsto \frac{\frac{y \cdot \color{blue}{\frac{1}{\frac{z + 1}{x}}}}{z}}{z} \]
      6. un-div-inv99.7%

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

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

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

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

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

    if -1 < z < 0.76000000000000001

    1. Initial program 86.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}} \]
      2. *-commutative82.7%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right) + \frac{x \cdot y}{z}}}{z} \]
    8. Step-by-step derivation
      1. associate-*r*85.8%

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

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

        \[\leadsto \frac{\left(-x\right) \cdot y + \color{blue}{\frac{x}{z} \cdot y}}{z} \]
      4. distribute-rgt-out93.4%

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

        \[\leadsto \frac{y \cdot \color{blue}{\left(\frac{x}{z} + \left(-x\right)\right)}}{z} \]
      6. unsub-neg93.4%

        \[\leadsto \frac{y \cdot \color{blue}{\left(\frac{x}{z} - x\right)}}{z} \]
    9. Simplified93.4%

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

    if 0.76000000000000001 < z

    1. Initial program 89.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{\frac{x}{z \cdot z}}{z + 1}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l/95.0%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{z + 1}}{z}}{z}} \]
      5. clear-num99.9%

        \[\leadsto \frac{\frac{y \cdot \color{blue}{\frac{1}{\frac{z + 1}{x}}}}{z}}{z} \]
      6. un-div-inv99.9%

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

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

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

    \[\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{\frac{y}{\frac{z}{x}}}{z}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 95.7% 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{y\_m}{z} \cdot \frac{\frac{x\_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 (* (/ y_m z) (/ (/ x_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 * ((y_m / z) * ((x_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 * ((y_m / z) * ((x_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 * ((y_m / z) * ((x_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 * ((y_m / z) * ((x_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(y_m / z) * Float64(Float64(x_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 * ((y_m / z) * ((x_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[(y$95$m / z), $MachinePrecision] * N[(N[(x$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{y\_m}{z} \cdot \frac{\frac{x\_m}{z + 1}}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 87.9%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{\frac{x}{z + 1}}{z}} \]
  5. Final simplification95.8%

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

Alternative 9: 98.1% 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{x\_m}{z} \cdot \frac{y\_m}{z + 1}}{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 (/ (* (/ 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(Float64(x_m / z) * 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[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / N[(z + 1.0), $MachinePrecision]), $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{x\_m}{z} \cdot \frac{y\_m}{z + 1}}{z}\right)
\end{array}
Derivation
  1. Initial program 87.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}} \]
    2. *-commutative88.4%

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

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

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

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

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

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

Alternative 10: 80.2% 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(y\_m \cdot \frac{\frac{x\_m}{z}}{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 (* 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) {
	return y_s * (x_s * (y_m * ((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 * ((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 * ((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 * ((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(y_m * Float64(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 * ((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[(y$95$m * N[(N[(x$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 \left(y\_m \cdot \frac{\frac{x\_m}{z}}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 87.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot z}}{z + 1}} \]
    2. *-commutative88.4%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z}}}{z} \]
  8. Step-by-step derivation
    1. associate-/l/75.8%

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

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

      \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
    4. associate-*l/76.3%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z}}{z}} \]
    5. associate-/l*75.5%

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

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

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

Alternative 11: 80.7% 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 \frac{y\_m}{z \cdot \frac{z}{x\_m}}\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 (/ z x_m))))))
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 * (z / x_m))));
}
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 * (z / 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);
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 * (z / 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)
[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 * (z / x_m))))
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(y_m / Float64(z * Float64(z / 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);
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 * (z / 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]
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[(y$95$m / N[(z * N[(z / x$95$m), $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 \frac{y\_m}{z \cdot \frac{z}{x\_m}}\right)
\end{array}
Derivation
  1. Initial program 87.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{y}}{\frac{z}{x} \cdot z} \]
  7. Applied egg-rr76.0%

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

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

Developer target: 96.8% accurate, 0.7× 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 2024043 
(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))))