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

Percentage Accurate: 82.5% → 96.0%
Time: 13.2s
Alternatives: 17
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 17 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.5% 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: 96.0% accurate, 0.3× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := \frac{x\_m}{z + 1}\\ t_1 := \frac{x\_m \cdot y\_m}{\left(z + 1\right) \cdot \left(z \cdot z\right)}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 10^{+102}:\\ \;\;\;\;t\_0 \cdot \frac{y\_m}{z \cdot z}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{\frac{x\_m \cdot y\_m}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m}{z} \cdot \frac{t\_0}{z}\\ \end{array}\right) \end{array} \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (/ x_m (+ z 1.0))) (t_1 (/ (* x_m y_m) (* (+ z 1.0) (* z z)))))
   (*
    y_s
    (*
     x_s
     (if (<= t_1 1e+102)
       (* t_0 (/ y_m (* z z)))
       (if (<= t_1 INFINITY)
         (/ (/ (* x_m y_m) z) z)
         (* (/ y_m z) (/ t_0 z))))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = x_m / (z + 1.0);
	double t_1 = (x_m * y_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_1 <= 1e+102) {
		tmp = t_0 * (y_m / (z * z));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = ((x_m * y_m) / z) / z;
	} else {
		tmp = (y_m / z) * (t_0 / z);
	}
	return y_s * (x_s * tmp);
}
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = x_m / (z + 1.0);
	double t_1 = (x_m * y_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_1 <= 1e+102) {
		tmp = t_0 * (y_m / (z * z));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = ((x_m * y_m) / z) / z;
	} else {
		tmp = (y_m / z) * (t_0 / z);
	}
	return y_s * (x_s * tmp);
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	t_0 = x_m / (z + 1.0)
	t_1 = (x_m * y_m) / ((z + 1.0) * (z * z))
	tmp = 0
	if t_1 <= 1e+102:
		tmp = t_0 * (y_m / (z * z))
	elif t_1 <= math.inf:
		tmp = ((x_m * y_m) / z) / z
	else:
		tmp = (y_m / z) * (t_0 / z)
	return y_s * (x_s * tmp)
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(x_m / Float64(z + 1.0))
	t_1 = Float64(Float64(x_m * y_m) / Float64(Float64(z + 1.0) * Float64(z * z)))
	tmp = 0.0
	if (t_1 <= 1e+102)
		tmp = Float64(t_0 * Float64(y_m / Float64(z * z)));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(Float64(x_m * y_m) / z) / z);
	else
		tmp = Float64(Float64(y_m / z) * Float64(t_0 / z));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	t_0 = x_m / (z + 1.0);
	t_1 = (x_m * y_m) / ((z + 1.0) * (z * z));
	tmp = 0.0;
	if (t_1 <= 1e+102)
		tmp = t_0 * (y_m / (z * z));
	elseif (t_1 <= Inf)
		tmp = ((x_m * y_m) / z) / z;
	else
		tmp = (y_m / z) * (t_0 / z);
	end
	tmp_2 = y_s * (x_s * tmp);
end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(x$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$1, 1e+102], N[(t$95$0 * N[(y$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(x$95$m * y$95$m), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m / z), $MachinePrecision] * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \frac{x\_m}{z + 1}\\
t_1 := \frac{x\_m \cdot y\_m}{\left(z + 1\right) \cdot \left(z \cdot z\right)}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 10^{+102}:\\
\;\;\;\;t\_0 \cdot \frac{y\_m}{z \cdot z}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\frac{x\_m \cdot y\_m}{z}}{z}\\

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


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

    1. Initial program 92.5%

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

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

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

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

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

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

    if 9.99999999999999977e101 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1))) < +inf.0

    1. Initial program 88.2%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)\right)}} \]
      9. sqr-neg86.2%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, z \cdot \color{blue}{\left(z \cdot z\right)}\right)} \]
      10. cube-unmult86.2%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, \color{blue}{{z}^{3}}\right)} \]
    3. Simplified86.2%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-def86.2%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z + {z}^{3}} \]
      4. cube-mult88.2%

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1)))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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


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

    1. Initial program 85.1%

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
      3. remove-double-neg95.8%

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

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

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{z \cdot z}}} \]
      7. sqr-neg43.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{-x}}}}{z} \]
      13. add-sqr-sqrt1.1%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z} \]
      14. sqrt-unprod35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}}{z} \]
      15. sqr-neg35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\sqrt{\color{blue}{x \cdot x}}}}}{z} \]
      16. sqrt-unprod46.7%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z} \]
      17. add-sqr-sqrt95.9%

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

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

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

Alternative 3: 96.3% accurate, 0.6× speedup?

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

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


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

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)\right)}} \]
      9. sqr-neg87.0%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, z \cdot \color{blue}{\left(z \cdot z\right)}\right)} \]
      10. cube-unmult87.0%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, \color{blue}{{z}^{3}}\right)} \]
    3. Simplified87.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-def66.5%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z + {z}^{3}} \]
      4. cube-mult66.9%

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

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

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

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

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

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

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

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

    if -1 < z < 0.849999999999999978

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
      3. remove-double-neg95.8%

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

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

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{z \cdot z}}} \]
      7. sqr-neg43.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{-x}}}}{z} \]
      13. add-sqr-sqrt1.1%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z} \]
      14. sqrt-unprod35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}}{z} \]
      15. sqr-neg35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\sqrt{\color{blue}{x \cdot x}}}}}{z} \]
      16. sqrt-unprod46.7%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z} \]
      17. add-sqr-sqrt95.9%

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

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

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

Alternative 4: 96.3% accurate, 0.6× speedup?

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

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


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

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)\right)}} \]
      9. sqr-neg87.0%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, z \cdot \color{blue}{\left(z \cdot z\right)}\right)} \]
      10. cube-unmult87.0%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, \color{blue}{{z}^{3}}\right)} \]
    3. Simplified87.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-def66.5%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z + {z}^{3}} \]
      4. cube-mult66.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
      3. remove-double-neg95.8%

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

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

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{z \cdot z}}} \]
      7. sqr-neg43.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{-x}}}}{z} \]
      13. add-sqr-sqrt1.1%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z} \]
      14. sqrt-unprod35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}}{z} \]
      15. sqr-neg35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\sqrt{\color{blue}{x \cdot x}}}}}{z} \]
      16. sqrt-unprod46.7%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z} \]
      17. add-sqr-sqrt95.9%

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

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

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

Alternative 5: 94.5% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 85.6%

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
      3. remove-double-neg95.8%

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

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

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{z \cdot z}}} \]
      7. sqr-neg43.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{-x}}}}{z} \]
      13. add-sqr-sqrt1.1%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z} \]
      14. sqrt-unprod35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}}{z} \]
      15. sqr-neg35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\sqrt{\color{blue}{x \cdot x}}}}}{z} \]
      16. sqrt-unprod46.7%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z} \]
      17. add-sqr-sqrt95.9%

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

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

    if 1 < z

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

Alternative 6: 96.2% accurate, 0.6× speedup?

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

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

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


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

    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/89.5%

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)\right)}} \]
      9. sqr-neg89.5%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, z \cdot \color{blue}{\left(z \cdot z\right)}\right)} \]
      10. cube-unmult89.6%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, \color{blue}{{z}^{3}}\right)} \]
    3. Simplified89.6%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-def40.3%

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

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z + {z}^{3}} \]
      4. cube-mult41.9%

        \[\leadsto \frac{y \cdot x}{z \cdot z + \color{blue}{z \cdot \left(z \cdot z\right)}} \]
      5. distribute-rgt1-in85.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
      3. un-div-inv52.4%

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

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

    if -1 < z < 1

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
      3. remove-double-neg95.8%

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

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

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{z \cdot z}}} \]
      7. sqr-neg43.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{-x}}}}{z} \]
      13. add-sqr-sqrt1.1%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z} \]
      14. sqrt-unprod35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}}{z} \]
      15. sqr-neg35.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\sqrt{\color{blue}{x \cdot x}}}}}{z} \]
      16. sqrt-unprod46.7%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z} \]
      17. add-sqr-sqrt95.9%

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

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

    if 1 < z

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)\right)}} \]
      9. sqr-neg85.2%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, z \cdot \color{blue}{\left(z \cdot z\right)}\right)} \]
      10. cube-unmult85.2%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, \color{blue}{{z}^{3}}\right)} \]
    3. Simplified85.2%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-def85.2%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z + {z}^{3}}} \]
      3. *-commutative84.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z + {z}^{3}} \]
      4. cube-mult84.7%

        \[\leadsto \frac{y \cdot x}{z \cdot z + \color{blue}{z \cdot \left(z \cdot z\right)}} \]
      5. distribute-rgt1-in84.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 80.3% accurate, 0.6× speedup?

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

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


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

    1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{z}}{-z} \cdot \sqrt{\color{blue}{y \cdot y}} \]
      6. sqrt-unprod31.7%

        \[\leadsto \frac{\frac{x}{z}}{-z} \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      7. add-sqr-sqrt63.0%

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

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

    if -1 < z < 3.60000000000000035e72

    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. sqr-neg83.1%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
      3. remove-double-neg88.5%

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

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

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{z \cdot z}}} \]
      7. sqr-neg43.2%

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} \]
      9. add-sqr-sqrt4.9%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{-x}}}}{z} \]
      13. add-sqr-sqrt2.4%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z} \]
      14. sqrt-unprod35.3%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}}{z} \]
      15. sqr-neg35.3%

        \[\leadsto \frac{\frac{y}{\frac{z}{\sqrt{\color{blue}{x \cdot x}}}}}{z} \]
      16. sqrt-unprod43.4%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z} \]
      17. add-sqr-sqrt88.6%

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

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

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

Alternative 8: 44.3% accurate, 0.7× speedup?

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

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


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

    1. Initial program 83.3%

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

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

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

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

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

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

      \[\leadsto \frac{y}{z} \cdot \color{blue}{\left(-1 \cdot x + \frac{x}{z}\right)} \]
    6. Step-by-step derivation
      1. +-commutative57.9%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{z}} \]
    9. Step-by-step derivation
      1. mul-1-neg21.7%

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

        \[\leadsto -\color{blue}{\frac{x}{z} \cdot y} \]
      3. distribute-rgt-neg-out23.7%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    10. Simplified23.7%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    11. Step-by-step derivation
      1. *-commutative23.7%

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

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

        \[\leadsto \color{blue}{\frac{-y}{\frac{z}{x}}} \]
      4. add-sqr-sqrt12.1%

        \[\leadsto \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{z}{x}} \]
      5. sqrt-unprod29.7%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{\frac{z}{x}} \]
      6. sqr-neg29.7%

        \[\leadsto \frac{\sqrt{\color{blue}{y \cdot y}}}{\frac{z}{x}} \]
      7. sqrt-unprod18.5%

        \[\leadsto \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\frac{z}{x}} \]
      8. add-sqr-sqrt41.0%

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

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

    if -1 < z < -4.999999999999985e-310

    1. Initial program 83.5%

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

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

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

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

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

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

      \[\leadsto \frac{y}{z} \cdot \color{blue}{\left(-1 \cdot x + \frac{x}{z}\right)} \]
    6. Step-by-step derivation
      1. +-commutative93.0%

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

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

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

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

      \[\leadsto \frac{y}{z} \cdot \color{blue}{\left(-1 \cdot x\right)} \]
    9. Step-by-step derivation
      1. neg-mul-135.5%

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

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

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

Alternative 9: 76.9% 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 1.75 \cdot 10^{-131}:\\ \;\;\;\;\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 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= x_m 1.75e-131) (* (/ 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 <= 1.75e-131) {
		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 <= 1.75d-131) 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 <= 1.75e-131) {
		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 <= 1.75e-131:
		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 <= 1.75e-131)
		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 <= 1.75e-131)
		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, 1.75e-131], 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 1.75 \cdot 10^{-131}:\\
\;\;\;\;\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 < 1.7500000000000001e-131

    1. Initial program 83.0%

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

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

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

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

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

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

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

    if 1.7500000000000001e-131 < x

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

Alternative 10: 77.2% 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 9.5 \cdot 10^{-133}:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{\frac{z}{y\_m}}\\ \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 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= x_m 9.5e-133) (/ (/ x_m z) (/ z y_m)) (* 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 <= 9.5e-133) {
		tmp = (x_m / z) / (z / y_m);
	} 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 <= 9.5d-133) then
        tmp = (x_m / z) / (z / y_m)
    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 <= 9.5e-133) {
		tmp = (x_m / z) / (z / y_m);
	} 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 <= 9.5e-133:
		tmp = (x_m / z) / (z / y_m)
	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 <= 9.5e-133)
		tmp = Float64(Float64(x_m / z) / Float64(z / y_m));
	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 <= 9.5e-133)
		tmp = (x_m / z) / (z / y_m);
	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, 9.5e-133], N[(N[(x$95$m / z), $MachinePrecision] / N[(z / y$95$m), $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 9.5 \cdot 10^{-133}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{\frac{z}{y\_m}}\\

\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 < 9.4999999999999992e-133

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

    if 9.4999999999999992e-133 < x

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

Alternative 11: 78.1% 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 2.2 \cdot 10^{-131}:\\ \;\;\;\;\frac{\frac{y\_m}{\frac{z}{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 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= x_m 2.2e-131) (/ (/ 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 <= 2.2e-131) {
		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 <= 2.2d-131) 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 <= 2.2e-131) {
		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 <= 2.2e-131:
		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 <= 2.2e-131)
		tmp = Float64(Float64(y_m / Float64(z / 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 <= 2.2e-131)
		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, 2.2e-131], N[(N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $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 2.2 \cdot 10^{-131}:\\
\;\;\;\;\frac{\frac{y\_m}{\frac{z}{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 < 2.2e-131

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z} \cdot x}{z}} \]
      3. remove-double-neg77.1%

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

        \[\leadsto \frac{-\color{blue}{\frac{y}{z} \cdot \left(-x\right)}}{z} \]
      5. add-sqr-sqrt40.9%

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

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

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

        \[\leadsto \frac{-\frac{y}{z} \cdot \left(-x\right)}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} \]
      9. add-sqr-sqrt31.0%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{-x}}}}{z} \]
      13. add-sqr-sqrt23.9%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}}}{z} \]
      14. sqrt-unprod29.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}}}{z} \]
      15. sqr-neg29.8%

        \[\leadsto \frac{\frac{y}{\frac{z}{\sqrt{\color{blue}{x \cdot x}}}}}{z} \]
      16. sqrt-unprod17.1%

        \[\leadsto \frac{\frac{y}{\frac{z}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}}}{z} \]
      17. add-sqr-sqrt78.6%

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

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

    if 2.2e-131 < x

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

Alternative 12: 40.3% accurate, 1.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x_s = \mathsf{copysign}\left(1, x\right) \\ y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \left(-y\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m}{\frac{z}{x\_m}}\\ \end{array}\right) \end{array} \]
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (if (<= z -5e-310) (* (/ x_m z) (- y_m)) (/ y_m (/ 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 (z <= -5e-310) {
		tmp = (x_m / z) * -y_m;
	} else {
		tmp = y_m / (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 (z <= (-5d-310)) then
        tmp = (x_m / z) * -y_m
    else
        tmp = y_m / (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 (z <= -5e-310) {
		tmp = (x_m / z) * -y_m;
	} else {
		tmp = y_m / (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 z <= -5e-310:
		tmp = (x_m / z) * -y_m
	else:
		tmp = y_m / (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 (z <= -5e-310)
		tmp = Float64(Float64(x_m / z) * Float64(-y_m));
	else
		tmp = Float64(y_m / 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 (z <= -5e-310)
		tmp = (x_m / z) * -y_m;
	else
		tmp = y_m / (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[z, -5e-310], N[(N[(x$95$m / z), $MachinePrecision] * (-y$95$m)), $MachinePrecision], N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
[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 -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \left(-y\_m\right)\\

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


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

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{z} \cdot y} \]
      3. distribute-rgt-neg-out35.0%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    10. Simplified35.0%

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

    if -4.999999999999985e-310 < z

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{z}} \]
    9. Step-by-step derivation
      1. mul-1-neg17.7%

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

        \[\leadsto -\color{blue}{\frac{x}{z} \cdot y} \]
      3. distribute-rgt-neg-out17.7%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    10. Simplified17.7%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    11. Step-by-step derivation
      1. *-commutative17.7%

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

        \[\leadsto \left(-y\right) \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      3. un-div-inv18.3%

        \[\leadsto \color{blue}{\frac{-y}{\frac{z}{x}}} \]
      4. add-sqr-sqrt7.2%

        \[\leadsto \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{z}{x}} \]
      5. sqrt-unprod26.6%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{\frac{z}{x}} \]
      6. sqr-neg26.6%

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

        \[\leadsto \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\frac{z}{x}} \]
      8. add-sqr-sqrt39.6%

        \[\leadsto \frac{\color{blue}{y}}{\frac{z}{x}} \]
    12. Applied egg-rr39.6%

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

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

Alternative 13: 95.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

Alternative 14: 96.7% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(z + 1\right) \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)}} \]
    6. distribute-rgt1-in74.0%

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)\right)}} \]
    9. sqr-neg84.5%

      \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, z \cdot \color{blue}{\left(z \cdot z\right)}\right)} \]
    10. cube-unmult84.5%

      \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, \color{blue}{{z}^{3}}\right)} \]
  3. Simplified84.5%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-def73.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z + {z}^{3}}} \]
    3. *-commutative73.9%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z + {z}^{3}} \]
    4. cube-mult73.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 95.8% 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 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (/ (* (/ y_m z) (/ x_m (+ z 1.0))) z))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (((y_m / z) * (x_m / (z + 1.0))) / z));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * (x_s * (((y_m / z) * (x_m / (z + 1.0d0))) / z))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (((y_m / z) * (x_m / (z + 1.0))) / z));
}
x_m = math.fabs(x)
x_s = math.copysign(1.0, x)
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * (((y_m / z) * (x_m / (z + 1.0))) / z))
x_m = abs(x)
x_s = copysign(1.0, x)
y_m = abs(y)
y_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(Float64(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 83.3%

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

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

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

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(z + 1\right) \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)}} \]
    6. distribute-rgt1-in74.0%

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z \cdot \left(\left(-z\right) \cdot \left(-z\right)\right)\right)}} \]
    9. sqr-neg84.5%

      \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, z \cdot \color{blue}{\left(z \cdot z\right)}\right)} \]
    10. cube-unmult84.5%

      \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(z, z, \color{blue}{{z}^{3}}\right)} \]
  3. Simplified84.5%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-def73.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z + {z}^{3}}} \]
    3. *-commutative73.9%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z + {z}^{3}} \]
    4. cube-mult73.9%

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

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

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

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

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

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

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

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

Alternative 16: 73.8% 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 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (* (/ y_m z) (/ x_m z)))))
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 83.3%

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

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

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

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

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

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

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

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

Alternative 17: 33.4% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{z}} \]
  9. Step-by-step derivation
    1. mul-1-neg23.3%

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

      \[\leadsto -\color{blue}{\frac{x}{z} \cdot y} \]
    3. distribute-rgt-neg-out25.3%

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

    \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
  11. Step-by-step derivation
    1. *-commutative25.3%

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

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

      \[\leadsto \color{blue}{\frac{-y}{\frac{z}{x}}} \]
    4. add-sqr-sqrt13.0%

      \[\leadsto \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{z}{x}} \]
    5. sqrt-unprod27.0%

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{\frac{z}{x}} \]
    6. sqr-neg27.0%

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

      \[\leadsto \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\frac{z}{x}} \]
    8. add-sqr-sqrt32.5%

      \[\leadsto \frac{\color{blue}{y}}{\frac{z}{x}} \]
  12. Applied egg-rr32.5%

    \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
  13. Final simplification32.5%

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

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

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

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