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

Percentage Accurate: 82.9% → 96.3%
Time: 13.0s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 82.9% accurate, 1.0× speedup?

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

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

Alternative 1: 96.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{y}{z}}{z \cdot \frac{z + 1}{x}} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (/ (/ y z) (* z (/ (+ z 1.0) x))))
assert(x < y);
double code(double x, double y, double z) {
	return (y / z) / (z * ((z + 1.0) / x));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (y / z) / (z * ((z + 1.0d0) / x))
end function
assert x < y;
public static double code(double x, double y, double z) {
	return (y / z) / (z * ((z + 1.0) / x));
}
[x, y] = sort([x, y])
def code(x, y, z):
	return (y / z) / (z * ((z + 1.0) / x))
x, y = sort([x, y])
function code(x, y, z)
	return Float64(Float64(y / z) / Float64(z * Float64(Float64(z + 1.0) / x)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = (y / z) / (z * ((z + 1.0) / x));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] / N[(z * N[(N[(z + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{z}}{z \cdot \frac{z + 1}{x}}
\end{array}
Derivation
  1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 94.8% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{\frac{z}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.0) (not (<= z 1.0)))
   (* (/ y z) (/ (/ x z) z))
   (/ (/ y z) (/ z x))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.0) || !(z <= 1.0)) {
		tmp = (y / z) * ((x / z) / z);
	} else {
		tmp = (y / z) / (z / x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
        tmp = (y / z) * ((x / z) / z)
    else
        tmp = (y / z) / (z / x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.0) || !(z <= 1.0)) {
		tmp = (y / z) * ((x / z) / z);
	} else {
		tmp = (y / z) / (z / x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z <= -1.0) or not (z <= 1.0):
		tmp = (y / z) * ((x / z) / z)
	else:
		tmp = (y / z) / (z / x)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.0) || !(z <= 1.0))
		tmp = Float64(Float64(y / z) * Float64(Float64(x / z) / z));
	else
		tmp = Float64(Float64(y / z) / Float64(z / x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.0) || ~((z <= 1.0)))
		tmp = (y / z) * ((x / z) / z);
	else
		tmp = (y / z) / (z / x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\

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


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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 94.8% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{y}{z}}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.0)
   (* (/ y z) (/ (/ x z) z))
   (if (<= z 1.0) (/ (/ y z) (/ z x)) (* (/ x z) (/ (/ y z) z)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = (y / z) * ((x / z) / z);
	} else if (z <= 1.0) {
		tmp = (y / z) / (z / x);
	} else {
		tmp = (x / z) * ((y / z) / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 <= (-1.0d0)) then
        tmp = (y / z) * ((x / z) / z)
    else if (z <= 1.0d0) then
        tmp = (y / z) / (z / x)
    else
        tmp = (x / z) * ((y / z) / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = (y / z) * ((x / z) / z);
	} else if (z <= 1.0) {
		tmp = (y / z) / (z / x);
	} else {
		tmp = (x / z) * ((y / z) / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -1.0:
		tmp = (y / z) * ((x / z) / z)
	elif z <= 1.0:
		tmp = (y / z) / (z / x)
	else:
		tmp = (x / z) * ((y / z) / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(Float64(y / z) * Float64(Float64(x / z) / z));
	elseif (z <= 1.0)
		tmp = Float64(Float64(y / z) / Float64(z / x));
	else
		tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = (y / z) * ((x / z) / z);
	elseif (z <= 1.0)
		tmp = (y / z) / (z / x);
	else
		tmp = (x / z) * ((y / z) / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y / z), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\

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

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


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

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{y}{z}}{z}}{\frac{z}{x}}} \]
      2. div-inv97.9%

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

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

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

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

Alternative 4: 95.1% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\ \mathbf{elif}\;z \leq 0.76:\\ \;\;\;\;\frac{\frac{x}{z} - x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.0)
   (* (/ y z) (/ (/ x z) z))
   (if (<= z 0.76) (/ (- (/ x z) x) (/ z y)) (* (/ x z) (/ (/ y z) z)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = (y / z) * ((x / z) / z);
	} else if (z <= 0.76) {
		tmp = ((x / z) - x) / (z / y);
	} else {
		tmp = (x / z) * ((y / z) / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 <= (-1.0d0)) then
        tmp = (y / z) * ((x / z) / z)
    else if (z <= 0.76d0) then
        tmp = ((x / z) - x) / (z / y)
    else
        tmp = (x / z) * ((y / z) / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = (y / z) * ((x / z) / z);
	} else if (z <= 0.76) {
		tmp = ((x / z) - x) / (z / y);
	} else {
		tmp = (x / z) * ((y / z) / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -1.0:
		tmp = (y / z) * ((x / z) / z)
	elif z <= 0.76:
		tmp = ((x / z) - x) / (z / y)
	else:
		tmp = (x / z) * ((y / z) / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(Float64(y / z) * Float64(Float64(x / z) / z));
	elseif (z <= 0.76)
		tmp = Float64(Float64(Float64(x / z) - x) / Float64(z / y));
	else
		tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = (y / z) * ((x / z) / z);
	elseif (z <= 0.76)
		tmp = ((x / z) - x) / (z / y);
	else
		tmp = (x / z) * ((y / z) / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.76], N[(N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\

\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{\frac{x}{z} - x}{\frac{z}{y}}\\

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


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

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 0.76000000000000001

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{z} - x}}{\frac{z}{y}} \]
    10. Simplified97.0%

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

    if 0.76000000000000001 < z

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{y}{z}}{z}}{\frac{z}{x}}} \]
      2. div-inv97.9%

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

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

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

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

Alternative 5: 96.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{y}{z} \cdot \frac{\frac{x}{z + 1}}{z} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* (/ y z) (/ (/ x (+ z 1.0)) z)))
assert(x < y);
double code(double x, double y, double z) {
	return (y / z) * ((x / (z + 1.0)) / z);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (y / z) * ((x / (z + 1.0d0)) / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return (y / z) * ((x / (z + 1.0)) / z);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return (y / z) * ((x / (z + 1.0)) / z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(Float64(y / z) * Float64(Float64(x / Float64(z + 1.0)) / z))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = (y / z) * ((x / (z + 1.0)) / z);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(N[(x / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{z} \cdot \frac{\frac{x}{z + 1}}{z}
\end{array}
Derivation
  1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.2% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= x -1.5e-13) (* x (/ y (* z z))) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = x * (y / (z * z));
	} else {
		tmp = y * ((x / z) / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (x <= (-1.5d-13)) then
        tmp = x * (y / (z * z))
    else
        tmp = y * ((x / z) / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -1.5e-13) {
		tmp = x * (y / (z * z));
	} else {
		tmp = y * ((x / z) / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if x <= -1.5e-13:
		tmp = x * (y / (z * z))
	else:
		tmp = y * ((x / z) / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (x <= -1.5e-13)
		tmp = Float64(x * Float64(y / Float64(z * z)));
	else
		tmp = Float64(y * Float64(Float64(x / z) / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -1.5e-13)
		tmp = x * (y / (z * z));
	else
		tmp = y * ((x / z) / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[x, -1.5e-13], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.49999999999999992e-13

    1. Initial program 85.2%

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

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

        \[\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. Taylor expanded in z around 0 76.7%

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

    if -1.49999999999999992e-13 < x

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{{z}^{2}}} \]
    7. Step-by-step derivation
      1. unpow274.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\ \end{array} \]

Alternative 7: 79.8% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-72}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y 4.3e-72) (/ x (* z (/ z y))) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 4.3e-72) {
		tmp = x / (z * (z / y));
	} else {
		tmp = y * ((x / z) / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (y <= 4.3d-72) then
        tmp = x / (z * (z / y))
    else
        tmp = y * ((x / z) / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 4.3e-72) {
		tmp = x / (z * (z / y));
	} else {
		tmp = y * ((x / z) / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if y <= 4.3e-72:
		tmp = x / (z * (z / y))
	else:
		tmp = y * ((x / z) / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (y <= 4.3e-72)
		tmp = Float64(x / Float64(z * Float64(z / y)));
	else
		tmp = Float64(y * Float64(Float64(x / z) / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 4.3e-72)
		tmp = x / (z * (z / y));
	else
		tmp = y * ((x / z) / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, 4.3e-72], N[(x / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{-72}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.2999999999999999e-72

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.8%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Taylor expanded in z around 0 72.7%

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

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

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

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

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

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

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

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

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

    if 4.2999999999999999e-72 < y

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-72}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\ \end{array} \]

Alternative 8: 80.1% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y 4.3e-74) (/ x (* z (/ z y))) (/ y (* z (/ z x)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 4.3e-74) {
		tmp = x / (z * (z / y));
	} else {
		tmp = y / (z * (z / x));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (y <= 4.3d-74) then
        tmp = x / (z * (z / y))
    else
        tmp = y / (z * (z / x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 4.3e-74) {
		tmp = x / (z * (z / y));
	} else {
		tmp = y / (z * (z / x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if y <= 4.3e-74:
		tmp = x / (z * (z / y))
	else:
		tmp = y / (z * (z / x))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (y <= 4.3e-74)
		tmp = Float64(x / Float64(z * Float64(z / y)));
	else
		tmp = Float64(y / Float64(z * Float64(z / x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 4.3e-74)
		tmp = x / (z * (z / y));
	else
		tmp = y / (z * (z / x));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, 4.3e-74], N[(x / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.29999999999999972e-74

    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-*r/85.8%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.8%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Taylor expanded in z around 0 73.1%

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

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

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

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

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

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

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

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

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

    if 4.29999999999999972e-74 < y

    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-*r/88.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Taylor expanded in z around 0 78.9%

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{z \cdot z}} \]
    6. Simplified78.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\ \end{array} \]

Alternative 9: 78.3% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5.2 \cdot 10^{+74}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= x -5.2e+74) (* x (/ y (* z z))) (/ (/ x z) (/ z y))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (x <= -5.2e+74) {
		tmp = x * (y / (z * z));
	} else {
		tmp = (x / z) / (z / y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (x <= (-5.2d+74)) then
        tmp = x * (y / (z * z))
    else
        tmp = (x / z) / (z / y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -5.2e+74) {
		tmp = x * (y / (z * z));
	} else {
		tmp = (x / z) / (z / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if x <= -5.2e+74:
		tmp = x * (y / (z * z))
	else:
		tmp = (x / z) / (z / y)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (x <= -5.2e+74)
		tmp = Float64(x * Float64(y / Float64(z * z)));
	else
		tmp = Float64(Float64(x / z) / Float64(z / y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -5.2e+74)
		tmp = x * (y / (z * z));
	else
		tmp = (x / z) / (z / y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[x, -5.2e+74], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+74}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.2000000000000001e74

    1. Initial program 83.1%

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

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

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

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

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

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

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

    if -5.2000000000000001e74 < x

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
      10. *-rgt-identity85.8%

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
    4. Taylor expanded in z around 0 76.1%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 40.5% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-310}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= z -1e-310) (* y (/ (- x) z)) (* (/ y z) x)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1e-310) {
		tmp = y * (-x / z);
	} else {
		tmp = (y / z) * x;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 <= (-1d-310)) then
        tmp = y * (-x / z)
    else
        tmp = (y / z) * x
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1e-310) {
		tmp = y * (-x / z);
	} else {
		tmp = (y / z) * x;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -1e-310:
		tmp = y * (-x / z)
	else:
		tmp = (y / z) * x
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -1e-310)
		tmp = Float64(y * Float64(Float64(-x) / z));
	else
		tmp = Float64(Float64(y / z) * x);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1e-310)
		tmp = y * (-x / z);
	else
		tmp = (y / z) * x;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[z, -1e-310], N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-310}:\\
\;\;\;\;y \cdot \frac{-x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.999999999999969e-311

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < z

    1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{z} \cdot \frac{y}{z} + \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
      9. distribute-lft-out66.6%

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
    10. Step-by-step derivation
      1. clear-num16.4%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-310}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array} \]

Alternative 11: 72.4% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ y \cdot \frac{x}{z \cdot z} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* y (/ x (* z z))))
assert(x < y);
double code(double x, double y, double z) {
	return y * (x / (z * z));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = y * (x / (z * z))
end function
assert x < y;
public static double code(double x, double y, double z) {
	return y * (x / (z * z));
}
[x, y] = sort([x, y])
def code(x, y, z):
	return y * (x / (z * z))
x, y = sort([x, y])
function code(x, y, z)
	return Float64(y * Float64(x / Float64(z * z)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = y * (x / (z * z));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y \cdot \frac{x}{z \cdot z}
\end{array}
Derivation
  1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z \cdot 1\right)}} \]
    10. *-rgt-identity86.4%

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

    \[\leadsto \color{blue}{y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}} \]
  4. Taylor expanded in z around 0 74.5%

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

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

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

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

Alternative 12: 74.3% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ y \cdot \frac{\frac{x}{z}}{z} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* y (/ (/ x z) z)))
assert(x < y);
double code(double x, double y, double z) {
	return y * ((x / z) / z);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = y * ((x / z) / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return y * ((x / z) / z);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return y * ((x / z) / z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(y * Float64(Float64(x / z) / z))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = y * ((x / z) / z);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y \cdot \frac{\frac{x}{z}}{z}
\end{array}
Derivation
  1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 31.4% accurate, 2.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ y \cdot \frac{x}{z} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* y (/ x z)))
assert(x < y);
double code(double x, double y, double z) {
	return y * (x / z);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = y * (x / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return y * (x / z);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return y * (x / z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(y * Float64(x / z))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = y * (x / z);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y \cdot \frac{x}{z}
\end{array}
Derivation
  1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
  10. Step-by-step derivation
    1. clear-num29.4%

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

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

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

      \[\leadsto \frac{1}{\frac{z}{x}} \cdot \sqrt{\color{blue}{y \cdot y}} \]
    5. sqrt-unprod13.4%

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

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

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

      \[\leadsto \frac{\color{blue}{y}}{\frac{z}{x}} \]
  11. Applied egg-rr29.8%

    \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
  12. Step-by-step derivation
    1. associate-/l*24.6%

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

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

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

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

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

Alternative 14: 31.2% accurate, 2.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{y}{z} \cdot x \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* (/ y z) x))
assert(x < y);
double code(double x, double y, double z) {
	return (y / z) * x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (y / z) * x
end function
assert x < y;
public static double code(double x, double y, double z) {
	return (y / z) * x;
}
[x, y] = sort([x, y])
def code(x, y, z):
	return (y / z) * x
x, y = sort([x, y])
function code(x, y, z)
	return Float64(Float64(y / z) * x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = (y / z) * x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{z} \cdot x
\end{array}
Derivation
  1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(-y\right)} \]
  10. Step-by-step derivation
    1. clear-num29.4%

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

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

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

      \[\leadsto \frac{1}{\frac{z}{x}} \cdot \sqrt{\color{blue}{y \cdot y}} \]
    5. sqrt-unprod13.4%

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

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

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

      \[\leadsto \frac{\color{blue}{y}}{\frac{z}{x}} \]
  11. Applied egg-rr29.8%

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

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

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

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

Developer target: 95.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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

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

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