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

Percentage Accurate: 83.3% → 97.3%
Time: 9.1s
Alternatives: 10
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 10 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.3% accurate, 1.0× speedup?

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

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

Alternative 1: 97.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* (/ y (+ z 1.0)) (/ x z)) z))
double code(double x, double y, double z) {
	return ((y / (z + 1.0)) * (x / z)) / z;
}
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 + 1.0d0)) * (x / z)) / z
end function
public static double code(double x, double y, double z) {
	return ((y / (z + 1.0)) * (x / z)) / z;
}
def code(x, y, z):
	return ((y / (z + 1.0)) * (x / z)) / z
function code(x, y, z)
	return Float64(Float64(Float64(y / Float64(z + 1.0)) * Float64(x / z)) / z)
end
function tmp = code(x, y, z)
	tmp = ((y / (z + 1.0)) * (x / z)) / z;
end
code[x_, y_, z_] := N[(N[(N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}
\end{array}
Derivation
  1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/80.6%

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

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

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

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

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

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

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

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

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

Alternative 2: 95.1% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 79.1%

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

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

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

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

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

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

    if -1 < z < 1

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 79.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/79.1%

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.0)
   (* (/ x z) (/ (/ y z) z))
   (if (<= z 1.0) (/ (/ y (/ z x)) z) (/ (* (/ x z) (/ y z)) z))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = (x / z) * ((y / z) / z);
	} else if (z <= 1.0) {
		tmp = (y / (z / x)) / z;
	} else {
		tmp = ((x / z) * (y / z)) / 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 <= (-1.0d0)) then
        tmp = (x / z) * ((y / z) / z)
    else if (z <= 1.0d0) then
        tmp = (y / (z / x)) / z
    else
        tmp = ((x / z) * (y / z)) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.0) {
		tmp = (x / z) * ((y / z) / z);
	} else if (z <= 1.0) {
		tmp = (y / (z / x)) / z;
	} else {
		tmp = ((x / z) * (y / z)) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -1.0:
		tmp = (x / z) * ((y / z) / z)
	elif z <= 1.0:
		tmp = (y / (z / x)) / z
	else:
		tmp = ((x / z) * (y / z)) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z));
	elseif (z <= 1.0)
		tmp = Float64(Float64(y / Float64(z / x)) / z);
	else
		tmp = Float64(Float64(Float64(x / z) * Float64(y / z)) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.0)
		tmp = (x / z) * ((y / z) / z);
	elseif (z <= 1.0)
		tmp = (y / (z / x)) / z;
	else
		tmp = ((x / z) * (y / z)) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\

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

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


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

    1. Initial program 78.3%

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

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

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

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

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

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

    if -1 < z < 1

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/79.7%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 41.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{\frac{z}{x}}\\ \mathbf{if}\;z \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-310}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-75}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ y (/ z x))))
   (if (<= z -1.0)
     t_0
     (if (<= z -4e-310)
       (* x (/ (- y) z))
       (if (<= z 2e-75) (/ x (/ z y)) t_0)))))
double code(double x, double y, double z) {
	double t_0 = y / (z / x);
	double tmp;
	if (z <= -1.0) {
		tmp = t_0;
	} else if (z <= -4e-310) {
		tmp = x * (-y / z);
	} else if (z <= 2e-75) {
		tmp = x / (z / y);
	} else {
		tmp = t_0;
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = y / (z / x)
    if (z <= (-1.0d0)) then
        tmp = t_0
    else if (z <= (-4d-310)) then
        tmp = x * (-y / z)
    else if (z <= 2d-75) then
        tmp = x / (z / y)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y / (z / x);
	double tmp;
	if (z <= -1.0) {
		tmp = t_0;
	} else if (z <= -4e-310) {
		tmp = x * (-y / z);
	} else if (z <= 2e-75) {
		tmp = x / (z / y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y / (z / x)
	tmp = 0
	if z <= -1.0:
		tmp = t_0
	elif z <= -4e-310:
		tmp = x * (-y / z)
	elif z <= 2e-75:
		tmp = x / (z / y)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(y / Float64(z / x))
	tmp = 0.0
	if (z <= -1.0)
		tmp = t_0;
	elseif (z <= -4e-310)
		tmp = Float64(x * Float64(Float64(-y) / z));
	elseif (z <= 2e-75)
		tmp = Float64(x / Float64(z / y));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y / (z / x);
	tmp = 0.0;
	if (z <= -1.0)
		tmp = t_0;
	elseif (z <= -4e-310)
		tmp = x * (-y / z);
	elseif (z <= 2e-75)
		tmp = x / (z / y);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$0, If[LessEqual[z, -4e-310], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e-75], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y}{\frac{z}{x}}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t_0\\

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

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

\mathbf{else}:\\
\;\;\;\;t_0\\


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

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < -3.999999999999988e-310

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/83.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.999999999999988e-310 < z < 1.9999999999999999e-75

    1. Initial program 75.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{-y}}} \]
      3. add-sqr-sqrt0.3%

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

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

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

        \[\leadsto \frac{x}{\frac{z}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}} \]
      7. add-sqr-sqrt40.2%

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

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

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

Alternative 6: 76.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot x \leq 10^{-69}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (* y x) 1e-69) (* (/ x z) (/ y z)) (* y (/ x (* z z)))))
double code(double x, double y, double z) {
	double tmp;
	if ((y * x) <= 1e-69) {
		tmp = (x / z) * (y / z);
	} else {
		tmp = y * (x / (z * 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 ((y * x) <= 1d-69) then
        tmp = (x / z) * (y / z)
    else
        tmp = y * (x / (z * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y * x) <= 1e-69) {
		tmp = (x / z) * (y / z);
	} else {
		tmp = y * (x / (z * z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y * x) <= 1e-69:
		tmp = (x / z) * (y / z)
	else:
		tmp = y * (x / (z * z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (Float64(y * x) <= 1e-69)
		tmp = Float64(Float64(x / z) * Float64(y / z));
	else
		tmp = Float64(y * Float64(x / Float64(z * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y * x) <= 1e-69)
		tmp = (x / z) * (y / z);
	else
		tmp = y * (x / (z * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[(y * x), $MachinePrecision], 1e-69], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq 10^{-69}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\

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


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

    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. frac-times83.7%

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

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

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

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

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

    if 9.9999999999999996e-70 < (*.f64 x y)

    1. Initial program 80.2%

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

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

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

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

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

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

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

Alternative 7: 96.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (* (/ x z) (/ (/ y (+ z 1.0)) z)))
double code(double x, double y, double z) {
	return (x / z) * ((y / (z + 1.0)) / z);
}
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 + 1.0d0)) / z)
end function
public static double code(double x, double y, double z) {
	return (x / z) * ((y / (z + 1.0)) / z);
}
def code(x, y, z):
	return (x / z) * ((y / (z + 1.0)) / z)
function code(x, y, z)
	return Float64(Float64(x / z) * Float64(Float64(y / Float64(z + 1.0)) / z))
end
function tmp = code(x, y, z)
	tmp = (x / z) * ((y / (z + 1.0)) / z);
end
code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}
\end{array}
Derivation
  1. Initial program 80.6%

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

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

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

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

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

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

Alternative 8: 74.4% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \frac{x}{z} \cdot \frac{y}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (* (/ x z) (/ y z)))
double code(double x, double y, double z) {
	return (x / z) * (y / z);
}
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)
end function
public static double code(double x, double y, double z) {
	return (x / z) * (y / z);
}
def code(x, y, z):
	return (x / z) * (y / z)
function code(x, y, z)
	return Float64(Float64(x / z) * Float64(y / z))
end
function tmp = code(x, y, z)
	tmp = (x / z) * (y / z);
end
code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{z} \cdot \frac{y}{z}
\end{array}
Derivation
  1. Initial program 80.6%

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

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

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

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

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

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

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

Alternative 9: 31.9% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \frac{x}{\frac{z}{y}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ x (/ z y)))
double code(double x, double y, double z) {
	return x / (z / y);
}
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)
end function
public static double code(double x, double y, double z) {
	return x / (z / y);
}
def code(x, y, z):
	return x / (z / y)
function code(x, y, z)
	return Float64(x / Float64(z / y))
end
function tmp = code(x, y, z)
	tmp = x / (z / y);
end
code[x_, y_, z_] := N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{\frac{z}{y}}
\end{array}
Derivation
  1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 31.9% accurate, 2.2× speedup?

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

\\
\frac{y}{\frac{z}{x}}
\end{array}
Derivation
  1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(z, z, {z}^{3}\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
  14. Final simplification27.3%

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

Developer target: 95.7% 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 2023322 
(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))))