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

Percentage Accurate: 83.6% → 99.0%
Time: 11.5s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 83.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.0% accurate, 0.4× speedup?

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

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


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

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

    if 200 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))))

    1. Initial program 49.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.6% 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{y\_m \cdot x\_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 4000000:\\ \;\;\;\;t\_0 \cdot \frac{\frac{y\_m}{z}}{z}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;y\_m \cdot \frac{\frac{\frac{x\_m}{z}}{z + 1}}{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 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (/ x_m (+ z 1.0))) (t_1 (/ (* y_m x_m) (* (+ z 1.0) (* z z)))))
   (*
    y_s
    (*
     x_s
     (if (<= t_1 4000000.0)
       (* t_0 (/ (/ y_m z) z))
       (if (<= t_1 INFINITY)
         (* y_m (/ (/ (/ x_m z) (+ z 1.0)) 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 = (y_m * x_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_1 <= 4000000.0) {
		tmp = t_0 * ((y_m / z) / z);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = y_m * (((x_m / z) / (z + 1.0)) / 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 = (y_m * x_m) / ((z + 1.0) * (z * z));
	double tmp;
	if (t_1 <= 4000000.0) {
		tmp = t_0 * ((y_m / z) / z);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = y_m * (((x_m / z) / (z + 1.0)) / 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 = (y_m * x_m) / ((z + 1.0) * (z * z))
	tmp = 0
	if t_1 <= 4000000.0:
		tmp = t_0 * ((y_m / z) / z)
	elif t_1 <= math.inf:
		tmp = y_m * (((x_m / z) / (z + 1.0)) / 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(y_m * x_m) / Float64(Float64(z + 1.0) * Float64(z * z)))
	tmp = 0.0
	if (t_1 <= 4000000.0)
		tmp = Float64(t_0 * Float64(Float64(y_m / z) / z));
	elseif (t_1 <= Inf)
		tmp = Float64(y_m * Float64(Float64(Float64(x_m / z) / Float64(z + 1.0)) / 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 = (y_m * x_m) / ((z + 1.0) * (z * z));
	tmp = 0.0;
	if (t_1 <= 4000000.0)
		tmp = t_0 * ((y_m / z) / z);
	elseif (t_1 <= Inf)
		tmp = y_m * (((x_m / z) / (z + 1.0)) / 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[(y$95$m * x$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, 4000000.0], N[(t$95$0 * N[(N[(y$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(y$95$m * N[(N[(N[(x$95$m / z), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $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{y\_m \cdot x\_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 4000000:\\
\;\;\;\;t\_0 \cdot \frac{\frac{y\_m}{z}}{z}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;y\_m \cdot \frac{\frac{\frac{x\_m}{z}}{z + 1}}{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 #s(literal 1 binary64)))) < 4e6

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

    if 4e6 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))) < +inf.0

    1. Initial program 84.0%

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

        \[\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}{y \cdot \frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      3. sqr-neg86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))))

    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-times15.1%

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

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

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

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

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

Alternative 4: 98.1% accurate, 0.4× 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 := y\_m \cdot \frac{\frac{x\_m}{z \cdot z}}{z + 1}\\ t_1 := \frac{\frac{\frac{y\_m}{z}}{\frac{z}{x\_m}}}{z}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.42 \cdot 10^{+85}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-132}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-162}:\\ \;\;\;\;\frac{\frac{y\_m}{\frac{z}{x\_m}}}{z}\\ \mathbf{elif}\;z \leq 10^{+26}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* y_m (/ (/ x_m (* z z)) (+ z 1.0))))
        (t_1 (/ (/ (/ y_m z) (/ z x_m)) z)))
   (*
    y_s
    (*
     x_s
     (if (<= z -1.42e+85)
       t_1
       (if (<= z -2e-132)
         t_0
         (if (<= z 9.5e-162)
           (/ (/ y_m (/ z x_m)) z)
           (if (<= z 1e+26) t_0 t_1))))))))
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 = y_m * ((x_m / (z * z)) / (z + 1.0));
	double t_1 = ((y_m / z) / (z / x_m)) / z;
	double tmp;
	if (z <= -1.42e+85) {
		tmp = t_1;
	} else if (z <= -2e-132) {
		tmp = t_0;
	} else if (z <= 9.5e-162) {
		tmp = (y_m / (z / x_m)) / z;
	} else if (z <= 1e+26) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y_m * ((x_m / (z * z)) / (z + 1.0d0))
    t_1 = ((y_m / z) / (z / x_m)) / z
    if (z <= (-1.42d+85)) then
        tmp = t_1
    else if (z <= (-2d-132)) then
        tmp = t_0
    else if (z <= 9.5d-162) then
        tmp = (y_m / (z / x_m)) / z
    else if (z <= 1d+26) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = y_m * ((x_m / (z * z)) / (z + 1.0));
	double t_1 = ((y_m / z) / (z / x_m)) / z;
	double tmp;
	if (z <= -1.42e+85) {
		tmp = t_1;
	} else if (z <= -2e-132) {
		tmp = t_0;
	} else if (z <= 9.5e-162) {
		tmp = (y_m / (z / x_m)) / z;
	} else if (z <= 1e+26) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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 = y_m * ((x_m / (z * z)) / (z + 1.0))
	t_1 = ((y_m / z) / (z / x_m)) / z
	tmp = 0
	if z <= -1.42e+85:
		tmp = t_1
	elif z <= -2e-132:
		tmp = t_0
	elif z <= 9.5e-162:
		tmp = (y_m / (z / x_m)) / z
	elif z <= 1e+26:
		tmp = t_0
	else:
		tmp = t_1
	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(y_m * Float64(Float64(x_m / Float64(z * z)) / Float64(z + 1.0)))
	t_1 = Float64(Float64(Float64(y_m / z) / Float64(z / x_m)) / z)
	tmp = 0.0
	if (z <= -1.42e+85)
		tmp = t_1;
	elseif (z <= -2e-132)
		tmp = t_0;
	elseif (z <= 9.5e-162)
		tmp = Float64(Float64(y_m / Float64(z / x_m)) / z);
	elseif (z <= 1e+26)
		tmp = t_0;
	else
		tmp = t_1;
	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 = y_m * ((x_m / (z * z)) / (z + 1.0));
	t_1 = ((y_m / z) / (z / x_m)) / z;
	tmp = 0.0;
	if (z <= -1.42e+85)
		tmp = t_1;
	elseif (z <= -2e-132)
		tmp = t_0;
	elseif (z <= 9.5e-162)
		tmp = (y_m / (z / x_m)) / z;
	elseif (z <= 1e+26)
		tmp = t_0;
	else
		tmp = t_1;
	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[(y$95$m * N[(N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(y$95$m / z), $MachinePrecision] / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.42e+85], t$95$1, If[LessEqual[z, -2e-132], t$95$0, If[LessEqual[z, 9.5e-162], N[(N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1e+26], t$95$0, t$95$1]]]]), $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 := y\_m \cdot \frac{\frac{x\_m}{z \cdot z}}{z + 1}\\
t_1 := \frac{\frac{\frac{y\_m}{z}}{\frac{z}{x\_m}}}{z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.42 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2 \cdot 10^{-132}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-162}:\\
\;\;\;\;\frac{\frac{y\_m}{\frac{z}{x\_m}}}{z}\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.42e85 < z < -2e-132 or 9.5000000000000004e-162 < z < 1.00000000000000005e26

    1. Initial program 88.6%

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

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

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

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

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

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

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

    if -2e-132 < z < 9.5000000000000004e-162

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{x}}}}{z} \]
    11. Simplified97.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.42 \cdot 10^{+85}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{\frac{z}{x}}}{z}\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-132}:\\ \;\;\;\;y \cdot \frac{\frac{x}{z \cdot z}}{z + 1}\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-162}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \mathbf{elif}\;z \leq 10^{+26}:\\ \;\;\;\;y \cdot \frac{\frac{x}{z \cdot z}}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{\frac{z}{x}}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 97.8% accurate, 0.4× 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 := y\_m \cdot \frac{\frac{\frac{x\_m}{z}}{z + 1}}{z}\\ t_1 := \frac{\frac{\frac{y\_m}{z}}{\frac{z}{x\_m}}}{z}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.42 \cdot 10^{+85}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-129}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 10^{-285}:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{\frac{z}{y\_m}}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+40}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* y_m (/ (/ (/ x_m z) (+ z 1.0)) z)))
        (t_1 (/ (/ (/ y_m z) (/ z x_m)) z)))
   (*
    y_s
    (*
     x_s
     (if (<= z -1.42e+85)
       t_1
       (if (<= z -8.5e-129)
         t_0
         (if (<= z 1e-285)
           (/ (/ x_m z) (/ z y_m))
           (if (<= z 1.9e+40) t_0 t_1))))))))
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 = y_m * (((x_m / z) / (z + 1.0)) / z);
	double t_1 = ((y_m / z) / (z / x_m)) / z;
	double tmp;
	if (z <= -1.42e+85) {
		tmp = t_1;
	} else if (z <= -8.5e-129) {
		tmp = t_0;
	} else if (z <= 1e-285) {
		tmp = (x_m / z) / (z / y_m);
	} else if (z <= 1.9e+40) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y_m * (((x_m / z) / (z + 1.0d0)) / z)
    t_1 = ((y_m / z) / (z / x_m)) / z
    if (z <= (-1.42d+85)) then
        tmp = t_1
    else if (z <= (-8.5d-129)) then
        tmp = t_0
    else if (z <= 1d-285) then
        tmp = (x_m / z) / (z / y_m)
    else if (z <= 1.9d+40) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = y_m * (((x_m / z) / (z + 1.0)) / z);
	double t_1 = ((y_m / z) / (z / x_m)) / z;
	double tmp;
	if (z <= -1.42e+85) {
		tmp = t_1;
	} else if (z <= -8.5e-129) {
		tmp = t_0;
	} else if (z <= 1e-285) {
		tmp = (x_m / z) / (z / y_m);
	} else if (z <= 1.9e+40) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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 = y_m * (((x_m / z) / (z + 1.0)) / z)
	t_1 = ((y_m / z) / (z / x_m)) / z
	tmp = 0
	if z <= -1.42e+85:
		tmp = t_1
	elif z <= -8.5e-129:
		tmp = t_0
	elif z <= 1e-285:
		tmp = (x_m / z) / (z / y_m)
	elif z <= 1.9e+40:
		tmp = t_0
	else:
		tmp = t_1
	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(y_m * Float64(Float64(Float64(x_m / z) / Float64(z + 1.0)) / z))
	t_1 = Float64(Float64(Float64(y_m / z) / Float64(z / x_m)) / z)
	tmp = 0.0
	if (z <= -1.42e+85)
		tmp = t_1;
	elseif (z <= -8.5e-129)
		tmp = t_0;
	elseif (z <= 1e-285)
		tmp = Float64(Float64(x_m / z) / Float64(z / y_m));
	elseif (z <= 1.9e+40)
		tmp = t_0;
	else
		tmp = t_1;
	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 = y_m * (((x_m / z) / (z + 1.0)) / z);
	t_1 = ((y_m / z) / (z / x_m)) / z;
	tmp = 0.0;
	if (z <= -1.42e+85)
		tmp = t_1;
	elseif (z <= -8.5e-129)
		tmp = t_0;
	elseif (z <= 1e-285)
		tmp = (x_m / z) / (z / y_m);
	elseif (z <= 1.9e+40)
		tmp = t_0;
	else
		tmp = t_1;
	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[(y$95$m * N[(N[(N[(x$95$m / z), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(y$95$m / z), $MachinePrecision] / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.42e+85], t$95$1, If[LessEqual[z, -8.5e-129], t$95$0, If[LessEqual[z, 1e-285], N[(N[(x$95$m / z), $MachinePrecision] / N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+40], t$95$0, t$95$1]]]]), $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 := y\_m \cdot \frac{\frac{\frac{x\_m}{z}}{z + 1}}{z}\\
t_1 := \frac{\frac{\frac{y\_m}{z}}{\frac{z}{x\_m}}}{z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.42 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -8.5 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 10^{-285}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{\frac{z}{y\_m}}\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+40}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 80.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.42e85 < z < -8.49999999999999937e-129 or 1.00000000000000007e-285 < z < 1.90000000000000002e40

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.49999999999999937e-129 < z < 1.00000000000000007e-285

    1. Initial program 63.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{y} \cdot \sqrt{y}}{z \cdot z}} \cdot \frac{x}{z + 1} \]
      3. add-sqr-sqrt64.7%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.42 \cdot 10^{+85}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{\frac{z}{x}}}{z}\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-129}:\\ \;\;\;\;y \cdot \frac{\frac{\frac{x}{z}}{z + 1}}{z}\\ \mathbf{elif}\;z \leq 10^{-285}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+40}:\\ \;\;\;\;y \cdot \frac{\frac{\frac{x}{z}}{z + 1}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{\frac{z}{x}}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 96.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{\frac{\frac{y\_m}{z}}{\frac{z}{x\_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 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (or (<= z -1.0) (not (<= z 1.0)))
     (/ (/ (/ y_m z) (/ z x_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 = ((y_m / z) / (z / x_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 = ((y_m / z) / (z / x_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 = ((y_m / z) / (z / x_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 = ((y_m / z) / (z / x_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(y_m / z) / Float64(z / x_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 = ((y_m / z) / (z / x_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[(y$95$m / z), $MachinePrecision] / N[(z / x$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{y\_m}{z}}{\frac{z}{x\_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 82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{\frac{z}{x}}}}{z} \]
    11. Simplified90.8%

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

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

Alternative 7: 82.4% accurate, 0.8× speedup?

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

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < 2.0000000000000001e-210

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{y} \cdot \sqrt{y}}{z \cdot z}} \cdot \frac{x}{z + 1} \]
      3. add-sqr-sqrt80.9%

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e-210 < (*.f64 x y)

    1. Initial program 87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 78.8%

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

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

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

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

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

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

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

    if 2.8e16 < y

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.5% accurate, 0.9× speedup?

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

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


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

    1. Initial program 78.6%

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

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

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

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

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

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

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

    if 1e-3 < y

    1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 81.4% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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