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

Percentage Accurate: 83.1% → 96.1%
Time: 9.4s
Alternatives: 15
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 15 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.1% 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.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{\frac{x}{\frac{z}{y}}}}{z}}{z + 1} \]
  9. Final simplification97.0%

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

Alternative 2: 79.0% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5000 \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-49}\right):\\ \;\;\;\;x \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{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 (or (<= (* x y) -5000.0) (not (<= (* x y) 5e-49)))
   (* x (/ y (* z z)))
   (* (/ y z) (/ x z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (((x * y) <= -5000.0) || !((x * y) <= 5e-49)) {
		tmp = x * (y / (z * z));
	} else {
		tmp = (y / z) * (x / 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 * y) <= (-5000.0d0)) .or. (.not. ((x * y) <= 5d-49))) then
        tmp = x * (y / (z * z))
    else
        tmp = (y / z) * (x / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (((x * y) <= -5000.0) || !((x * y) <= 5e-49)) {
		tmp = x * (y / (z * z));
	} else {
		tmp = (y / z) * (x / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if ((x * y) <= -5000.0) or not ((x * y) <= 5e-49):
		tmp = x * (y / (z * z))
	else:
		tmp = (y / z) * (x / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((Float64(x * y) <= -5000.0) || !(Float64(x * y) <= 5e-49))
		tmp = Float64(x * Float64(y / Float64(z * z)));
	else
		tmp = Float64(Float64(y / z) * Float64(x / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((x * y) <= -5000.0) || ~(((x * y) <= 5e-49)))
		tmp = x * (y / (z * z));
	else
		tmp = (y / z) * (x / 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[Or[LessEqual[N[(x * y), $MachinePrecision], -5000.0], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e-49]], $MachinePrecision]], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5000 \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-49}\right):\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5e3 or 4.9999999999999999e-49 < (*.f64 x y)

    1. Initial program 86.8%

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

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

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

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

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

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

    if -5e3 < (*.f64 x y) < 4.9999999999999999e-49

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 93.8% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{-46} \lor \neg \left(z \leq 5.5 \cdot 10^{-131}\right):\\ \;\;\;\;\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\frac{z}{y}}}{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 (or (<= z -4.8e-46) (not (<= z 5.5e-131)))
   (* (/ y (* z z)) (/ x (+ z 1.0)))
   (/ (/ x (/ z y)) z)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -4.8e-46) || !(z <= 5.5e-131)) {
		tmp = (y / (z * z)) * (x / (z + 1.0));
	} else {
		tmp = (x / (z / y)) / 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 <= (-4.8d-46)) .or. (.not. (z <= 5.5d-131))) then
        tmp = (y / (z * z)) * (x / (z + 1.0d0))
    else
        tmp = (x / (z / y)) / z
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -4.8e-46) || !(z <= 5.5e-131)) {
		tmp = (y / (z * z)) * (x / (z + 1.0));
	} else {
		tmp = (x / (z / y)) / z;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z <= -4.8e-46) or not (z <= 5.5e-131):
		tmp = (y / (z * z)) * (x / (z + 1.0))
	else:
		tmp = (x / (z / y)) / z
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((z <= -4.8e-46) || !(z <= 5.5e-131))
		tmp = Float64(Float64(y / Float64(z * z)) * Float64(x / Float64(z + 1.0)));
	else
		tmp = Float64(Float64(x / Float64(z / y)) / z);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -4.8e-46) || ~((z <= 5.5e-131)))
		tmp = (y / (z * z)) * (x / (z + 1.0));
	else
		tmp = (x / (z / y)) / 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[Or[LessEqual[z, -4.8e-46], N[Not[LessEqual[z, 5.5e-131]], $MachinePrecision]], N[(N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision] * N[(x / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-46} \lor \neg \left(z \leq 5.5 \cdot 10^{-131}\right):\\
\;\;\;\;\frac{y}{z \cdot z} \cdot \frac{x}{z + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.80000000000000027e-46 or 5.4999999999999997e-131 < z

    1. Initial program 87.0%

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

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

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

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

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

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

    if -4.80000000000000027e-46 < z < 5.4999999999999997e-131

    1. Initial program 65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 79.1% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5000:\\ \;\;\;\;\frac{x}{\frac{z \cdot z}{y}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-49}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot 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 y) -5000.0)
   (/ x (/ (* z z) y))
   (if (<= (* x y) 5e-49) (* (/ y z) (/ x z)) (* x (/ y (* z z))))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((x * y) <= -5000.0) {
		tmp = x / ((z * z) / y);
	} else if ((x * y) <= 5e-49) {
		tmp = (y / z) * (x / z);
	} else {
		tmp = x * (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 ((x * y) <= (-5000.0d0)) then
        tmp = x / ((z * z) / y)
    else if ((x * y) <= 5d-49) then
        tmp = (y / z) * (x / z)
    else
        tmp = x * (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 ((x * y) <= -5000.0) {
		tmp = x / ((z * z) / y);
	} else if ((x * y) <= 5e-49) {
		tmp = (y / z) * (x / z);
	} else {
		tmp = x * (y / (z * z));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (x * y) <= -5000.0:
		tmp = x / ((z * z) / y)
	elif (x * y) <= 5e-49:
		tmp = (y / z) * (x / z)
	else:
		tmp = x * (y / (z * z))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (Float64(x * y) <= -5000.0)
		tmp = Float64(x / Float64(Float64(z * z) / y));
	elseif (Float64(x * y) <= 5e-49)
		tmp = Float64(Float64(y / z) * Float64(x / z));
	else
		tmp = Float64(x * Float64(y / Float64(z * z)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x * y) <= -5000.0)
		tmp = x / ((z * z) / y);
	elseif ((x * y) <= 5e-49)
		tmp = (y / z) * (x / z);
	else
		tmp = x * (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[N[(x * y), $MachinePrecision], -5000.0], N[(x / N[(N[(z * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-49], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5000:\\
\;\;\;\;\frac{x}{\frac{z \cdot z}{y}}\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-49}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -5e3

    1. Initial program 89.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e3 < (*.f64 x y) < 4.9999999999999999e-49

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999999e-49 < (*.f64 x y)

    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-frac91.7%

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

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

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

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

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

Alternative 5: 92.5% 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 3.6 \cdot 10^{-9}\right):\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\frac{z}{y}}}{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 (or (<= z -1.0) (not (<= z 3.6e-9)))
   (* (/ x z) (/ y (* z z)))
   (/ (/ x (/ z y)) z)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.0) || !(z <= 3.6e-9)) {
		tmp = (x / z) * (y / (z * z));
	} else {
		tmp = (x / (z / y)) / 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)) .or. (.not. (z <= 3.6d-9))) then
        tmp = (x / z) * (y / (z * z))
    else
        tmp = (x / (z / y)) / 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) || !(z <= 3.6e-9)) {
		tmp = (x / z) * (y / (z * z));
	} else {
		tmp = (x / (z / y)) / z;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z <= -1.0) or not (z <= 3.6e-9):
		tmp = (x / z) * (y / (z * z))
	else:
		tmp = (x / (z / y)) / z
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.0) || !(z <= 3.6e-9))
		tmp = Float64(Float64(x / z) * Float64(y / Float64(z * z)));
	else
		tmp = Float64(Float64(x / Float64(z / y)) / 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) || ~((z <= 3.6e-9)))
		tmp = (x / z) * (y / (z * z));
	else
		tmp = (x / (z / y)) / 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[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 3.6e-9]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 3.6 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\

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


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

    1. Initial program 85.8%

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

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

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

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

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

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

    if -1 < z < 3.6e-9

    1. Initial program 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.7 \cdot 10^{-178}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+99}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot 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.7e-178)
   (/ x (* z (/ z y)))
   (if (<= y 1.9e+99) (* (/ y z) (/ x z)) (* y (/ x (* z z))))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 4.7e-178) {
		tmp = x / (z * (z / y));
	} else if (y <= 1.9e+99) {
		tmp = (y / z) * (x / 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 (y <= 4.7d-178) then
        tmp = x / (z * (z / y))
    else if (y <= 1.9d+99) then
        tmp = (y / z) * (x / 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 (y <= 4.7e-178) {
		tmp = x / (z * (z / y));
	} else if (y <= 1.9e+99) {
		tmp = (y / z) * (x / z);
	} else {
		tmp = y * (x / (z * z));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if y <= 4.7e-178:
		tmp = x / (z * (z / y))
	elif y <= 1.9e+99:
		tmp = (y / z) * (x / z)
	else:
		tmp = y * (x / (z * z))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (y <= 4.7e-178)
		tmp = Float64(x / Float64(z * Float64(z / y)));
	elseif (y <= 1.9e+99)
		tmp = Float64(Float64(y / z) * Float64(x / z));
	else
		tmp = Float64(y * Float64(x / Float64(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.7e-178)
		tmp = x / (z * (z / y));
	elseif (y <= 1.9e+99)
		tmp = (y / z) * (x / 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[y, 4.7e-178], N[(x / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+99], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.7 \cdot 10^{-178}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{+99}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\

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


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

    1. Initial program 78.0%

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

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

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

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

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

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

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

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

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

        \[\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} \]
    6. Applied egg-rr80.5%

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

    if 4.69999999999999999e-178 < y < 1.9e99

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9e99 < y

    1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{1}} \]
      4. /-rgt-identity78.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.7 \cdot 10^{-178}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+99}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \end{array} \]

Alternative 7: 96.7% accurate, 1.0× speedup?

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

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

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

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

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

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

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

Alternative 8: 96.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 9: 40.2% accurate, 1.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{y}{z} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{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 (/ x z))
   (if (<= z -1e-309) (* (/ y z) (- x)) (* x (/ y z)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = y * (x / z);
	} else if (z <= -1e-309) {
		tmp = (y / z) * -x;
	} else {
		tmp = x * (y / 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 * (x / z)
    else if (z <= (-1d-309)) then
        tmp = (y / z) * -x
    else
        tmp = x * (y / 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 * (x / z);
	} else if (z <= -1e-309) {
		tmp = (y / z) * -x;
	} else {
		tmp = x * (y / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -1.0:
		tmp = y * (x / z)
	elif z <= -1e-309:
		tmp = (y / z) * -x
	else:
		tmp = x * (y / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(y * Float64(x / z));
	elseif (z <= -1e-309)
		tmp = Float64(Float64(y / z) * Float64(-x));
	else
		tmp = Float64(x * Float64(y / 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 * (x / z);
	elseif (z <= -1e-309)
		tmp = (y / z) * -x;
	else
		tmp = x * (y / 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[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1e-309], N[(N[(y / z), $MachinePrecision] * (-x)), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{elif}\;z \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{y}{z} \cdot \left(-x\right)\\

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


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

    1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt15.8%

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

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

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

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

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

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

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

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

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

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

    if -1 < z < -1.000000000000002e-309

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{z}} \]
      3. distribute-lft-neg-in32.8%

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

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

    if -1.000000000000002e-309 < z

    1. Initial program 78.1%

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
      2. associate-*r/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-*l*82.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*81.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{z}} \]
      3. distribute-lft-neg-in16.2%

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

      \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt10.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    12. Step-by-step derivation
      1. div-inv39.3%

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

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

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

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

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

Alternative 10: 77.7% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.85 \cdot 10^{+99}:\\ \;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot 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 1.85e+99) (* (/ y z) (/ x z)) (* y (/ x (* z z)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.85e+99) {
		tmp = (y / z) * (x / 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 (y <= 1.85d+99) then
        tmp = (y / z) * (x / 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 (y <= 1.85e+99) {
		tmp = (y / z) * (x / z);
	} else {
		tmp = y * (x / (z * z));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if y <= 1.85e+99:
		tmp = (y / z) * (x / z)
	else:
		tmp = y * (x / (z * z))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.85e+99)
		tmp = Float64(Float64(y / z) * Float64(x / z));
	else
		tmp = Float64(y * Float64(x / Float64(z * z)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.85e+99)
		tmp = (y / z) * (x / 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[y, 1.85e+99], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{+99}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.85000000000000005e99

    1. Initial program 78.9%

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(-z\right) \cdot \left(-z\right)\right)} \cdot \left(z + 1\right)} \]
      4. associate-*l*82.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*82.3%

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

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

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

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

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

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

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

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

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

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

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

    if 1.85000000000000005e99 < y

    1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{1}} \]
      4. /-rgt-identity78.2%

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

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

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

Alternative 11: 80.0% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 10^{-90}:\\ \;\;\;\;\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 1e-90) (/ x (* z (/ z y))) (/ y (* z (/ z x)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1e-90) {
		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 <= 1d-90) 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 <= 1e-90) {
		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 <= 1e-90:
		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 <= 1e-90)
		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 <= 1e-90)
		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, 1e-90], 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 10^{-90}:\\
\;\;\;\;\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 < 9.99999999999999995e-91

    1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999995e-91 < y

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 39.4% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-309}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{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 -1e-309) (* y (/ (- x) z)) (* x (/ y z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1e-309) {
		tmp = y * (-x / z);
	} else {
		tmp = x * (y / 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 <= (-1d-309)) then
        tmp = y * (-x / z)
    else
        tmp = x * (y / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1e-309) {
		tmp = y * (-x / z);
	} else {
		tmp = x * (y / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -1e-309:
		tmp = y * (-x / z)
	else:
		tmp = x * (y / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -1e-309)
		tmp = Float64(y * Float64(Float64(-x) / z));
	else
		tmp = Float64(x * Float64(y / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1e-309)
		tmp = y * (-x / z);
	else
		tmp = x * (y / 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, -1e-309], N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-309}:\\
\;\;\;\;y \cdot \frac{-x}{z}\\

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


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

    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. *-commutative80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{z}} \]
      3. distribute-lft-neg-in36.6%

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

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

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

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

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

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

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

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

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

    if -1.000000000000002e-309 < z

    1. Initial program 78.1%

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
      2. associate-*r/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-*l*82.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*81.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{z}} \]
      3. distribute-lft-neg-in16.2%

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

      \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt10.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    12. Step-by-step derivation
      1. div-inv39.3%

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

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

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

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

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

Alternative 13: 32.3% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 10^{+171}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{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 1e+171) (* x (/ y z)) (* y (/ x z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1e+171) {
		tmp = x * (y / z);
	} else {
		tmp = y * (x / 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 <= 1d+171) then
        tmp = x * (y / z)
    else
        tmp = y * (x / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 1e+171) {
		tmp = x * (y / z);
	} else {
		tmp = y * (x / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if y <= 1e+171:
		tmp = x * (y / z)
	else:
		tmp = y * (x / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (y <= 1e+171)
		tmp = Float64(x * Float64(y / z));
	else
		tmp = Float64(y * Float64(x / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1e+171)
		tmp = x * (y / z);
	else
		tmp = y * (x / 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, 1e+171], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+171}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 9.99999999999999954e170

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{z}} \]
      3. distribute-lft-neg-in26.9%

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

      \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt13.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    12. Step-by-step derivation
      1. div-inv34.3%

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

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

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

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

    if 9.99999999999999954e170 < y

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{z}} \]
      3. distribute-lft-neg-in22.5%

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

      \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt12.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 74.4% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{y}{z} \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 z) (/ x z)))
assert(x < y);
double code(double x, double y, double z) {
	return (y / z) * (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 / z) * (x / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return (y / z) * (x / z);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return (y / z) * (x / z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(Float64(y / z) * Float64(x / z))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = (y / z) * (x / 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[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{z} \cdot \frac{x}{z}
\end{array}
Derivation
  1. Initial program 79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 30.7% 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 79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{y}{z}} \]
  10. Step-by-step derivation
    1. add-sqr-sqrt13.2%

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

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

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

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

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

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

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

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

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

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

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

Developer target: 95.4% 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 2023293 
(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))))