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

Percentage Accurate: 82.6% → 97.1%
Time: 11.2s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 82.6% 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.1% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+41}:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z \cdot \frac{z}{y\_m}}\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-94}:\\ \;\;\;\;y\_m \cdot \frac{\frac{x\_m}{z \cdot z}}{z + 1}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{y\_m \cdot \frac{x\_m}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y\_m}{z} \cdot x\_m}{z}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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.25e+41)
     (/ (/ x_m z) (* z (/ z y_m)))
     (if (<= z -2.8e-94)
       (* y_m (/ (/ x_m (* z z)) (+ z 1.0)))
       (if (<= z 1.0)
         (/ (* y_m (/ x_m z)) 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.25e+41) {
		tmp = (x_m / z) / (z * (z / y_m));
	} else if (z <= -2.8e-94) {
		tmp = y_m * ((x_m / (z * z)) / (z + 1.0));
	} else if (z <= 1.0) {
		tmp = (y_m * (x_m / z)) / 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.25d+41)) then
        tmp = (x_m / z) / (z * (z / y_m))
    else if (z <= (-2.8d-94)) then
        tmp = y_m * ((x_m / (z * z)) / (z + 1.0d0))
    else if (z <= 1.0d0) then
        tmp = (y_m * (x_m / z)) / 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.25e+41) {
		tmp = (x_m / z) / (z * (z / y_m));
	} else if (z <= -2.8e-94) {
		tmp = y_m * ((x_m / (z * z)) / (z + 1.0));
	} else if (z <= 1.0) {
		tmp = (y_m * (x_m / z)) / 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.25e+41:
		tmp = (x_m / z) / (z * (z / y_m))
	elif z <= -2.8e-94:
		tmp = y_m * ((x_m / (z * z)) / (z + 1.0))
	elif z <= 1.0:
		tmp = (y_m * (x_m / z)) / 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.25e+41)
		tmp = Float64(Float64(x_m / z) / Float64(z * Float64(z / y_m)));
	elseif (z <= -2.8e-94)
		tmp = Float64(y_m * Float64(Float64(x_m / Float64(z * z)) / Float64(z + 1.0)));
	elseif (z <= 1.0)
		tmp = Float64(Float64(y_m * Float64(x_m / z)) / z);
	else
		tmp = Float64(Float64(Float64(Float64(y_m / 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.25e+41)
		tmp = (x_m / z) / (z * (z / y_m));
	elseif (z <= -2.8e-94)
		tmp = y_m * ((x_m / (z * z)) / (z + 1.0));
	elseif (z <= 1.0)
		tmp = (y_m * (x_m / z)) / 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.25e+41], N[(N[(x$95$m / z), $MachinePrecision] / N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.8e-94], N[(y$95$m * N[(N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y$95$m * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(N[(y$95$m / z), $MachinePrecision] * x$95$m), $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.25 \cdot 10^{+41}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z \cdot \frac{z}{y\_m}}\\

\mathbf{elif}\;z \leq -2.8 \cdot 10^{-94}:\\
\;\;\;\;y\_m \cdot \frac{\frac{x\_m}{z \cdot z}}{z + 1}\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{y\_m \cdot \frac{x\_m}{z}}{z}\\

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


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

    1. Initial program 78.8%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg85.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*90.7%

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

        \[\leadsto y \cdot \frac{\frac{x}{\color{blue}{z \cdot z}}}{z + 1} \]
    3. Simplified90.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*85.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{z + 1}}{\frac{{z}^{2}}{y}}} \]
    7. Step-by-step derivation
      1. pow288.9%

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

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

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

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

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

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

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

    if -1.25000000000000006e41 < z < -2.7999999999999998e-94

    1. Initial program 89.0%

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

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

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

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

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

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

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

    if -2.7999999999999998e-94 < z < 1

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\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.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.8% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 10^{+66}:\\ \;\;\;\;\frac{y\_m}{z} \cdot \frac{\frac{x\_m}{z + 1}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y\_m}{z} \cdot x\_m}{z}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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) (* z z)) 1e+66)
     (* (/ y_m z) (/ (/ x_m (+ z 1.0)) 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) * (z * z)) <= 1e+66) {
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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) * (z * z)) <= 1d+66) then
        tmp = (y_m / z) * ((x_m / (z + 1.0d0)) / 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) * (z * z)) <= 1e+66) {
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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) * (z * z)) <= 1e+66:
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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 (Float64(Float64(z + 1.0) * Float64(z * z)) <= 1e+66)
		tmp = Float64(Float64(y_m / z) * Float64(Float64(x_m / Float64(z + 1.0)) / z));
	else
		tmp = Float64(Float64(Float64(Float64(y_m / 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) * (z * z)) <= 1e+66)
		tmp = (y_m / z) * ((x_m / (z + 1.0)) / 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[N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision], 1e+66], N[(N[(y$95$m / z), $MachinePrecision] * N[(N[(x$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y$95$m / z), $MachinePrecision] * x$95$m), $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}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 10^{+66}:\\
\;\;\;\;\frac{y\_m}{z} \cdot \frac{\frac{x\_m}{z + 1}}{z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 9.99999999999999945e65

    1. Initial program 78.1%

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

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

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

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

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

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

    if 9.99999999999999945e65 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

    1. Initial program 84.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 83.9%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg88.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*91.1%

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

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

      \[\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.1%

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{y\_m \cdot \frac{x\_m}{z}}{z}\\

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


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

    1. Initial program 82.0%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg87.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*92.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{z + 1}}{\frac{{z}^{2}}{y}}} \]
    7. Step-by-step derivation
      1. pow290.5%

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\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.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 96.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])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z \cdot \frac{z}{y\_m}}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{y\_m \cdot \frac{x\_m}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y\_m}{z} \cdot x\_m}{z}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z -1.0)
     (/ (/ x_m z) (* z (/ z y_m)))
     (if (<= z 1.0) (/ (* y_m (/ x_m z)) z) (/ (/ (* (/ 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) / (z * (z / y_m));
	} else if (z <= 1.0) {
		tmp = (y_m * (x_m / z)) / 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) / (z * (z / y_m))
    else if (z <= 1.0d0) then
        tmp = (y_m * (x_m / z)) / 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) / (z * (z / y_m));
	} else if (z <= 1.0) {
		tmp = (y_m * (x_m / z)) / 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) / (z * (z / y_m))
	elif z <= 1.0:
		tmp = (y_m * (x_m / z)) / 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(z * Float64(z / y_m)));
	elseif (z <= 1.0)
		tmp = Float64(Float64(y_m * Float64(x_m / z)) / z);
	else
		tmp = Float64(Float64(Float64(Float64(y_m / 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 / z) / (z * (z / y_m));
	elseif (z <= 1.0)
		tmp = (y_m * (x_m / z)) / 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[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y$95$m * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(N[(y$95$m / z), $MachinePrecision] * x$95$m), $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}{z}}{z \cdot \frac{z}{y\_m}}\\

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{y\_m \cdot \frac{x\_m}{z}}{z}\\

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


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

    1. Initial program 82.0%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg87.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*92.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{z + 1}}{\frac{{z}^{2}}{y}}} \]
    7. Step-by-step derivation
      1. pow290.5%

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.4000000000000001e-42

    1. Initial program 78.5%

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

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

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

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

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

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

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

    if 4.4000000000000001e-42 < x

    1. Initial program 83.1%

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

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

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

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

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

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

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

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

Alternative 7: 81.3% accurate, 0.9× speedup?

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

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


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

    1. Initial program 79.6%

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

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

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

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

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

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

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

    if 4.9999999999999996e22 < y

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 81.4% accurate, 0.9× speedup?

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

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


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

    1. Initial program 79.6%

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

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

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

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

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

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

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

    if 5.99999999999999974e44 < y

    1. Initial program 79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 81.6% accurate, 0.9× speedup?

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

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


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

    1. Initial program 79.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{z} \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      2. un-div-inv78.2%

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{\frac{z}{x}}} \]
    7. Applied egg-rr78.2%

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

    if 2e-3 < y

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{y}}{\frac{z}{\frac{x}{z + 1}} \cdot z} \]
      5. div-inv87.1%

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

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

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

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

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

Alternative 10: 96.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{y\_m}{z} \cdot \frac{x\_m}{z + 1}}{z}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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(Float64(y_m / z) * 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[(N[(y$95$m / z), $MachinePrecision] * N[(x$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{y\_m}{z} \cdot \frac{x\_m}{z + 1}}{z}\right)
\end{array}
Derivation
  1. Initial program 79.6%

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

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

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

      \[\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*81.2%

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

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

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

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

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

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

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

Alternative 11: 74.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(\frac{y\_m}{z} \cdot \frac{x\_m}{z}\right)\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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)))))
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)));
}
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)))
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)));
}
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)))
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(x_m / z))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * ((y_m / z) * (x_m / z)));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(y$95$m / z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \left(\frac{y\_m}{z} \cdot \frac{x\_m}{z}\right)\right)
\end{array}
Derivation
  1. Initial program 79.6%

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

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

      \[\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-frac96.6%

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

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

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

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

Developer target: 97.0% 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 2024067 
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))

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