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

Percentage Accurate: 82.7% → 95.6%
Time: 11.2s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 82.7% 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: 95.6% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \left(1 + z\right) \cdot \left(z \cdot z\right)\\ \mathbf{if}\;t_0 \leq -2 \cdot 10^{+23}:\\ \;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-193}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{z} \cdot \frac{y}{1 + 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
 (let* ((t_0 (* (+ 1.0 z) (* z z))))
   (if (<= t_0 -2e+23)
     (/ (/ x z) (* z (/ z y)))
     (if (<= t_0 5e-193)
       (/ (/ x z) (/ z y))
       (* (/ (/ x z) z) (/ y (+ 1.0 z)))))))
assert(x < y);
double code(double x, double y, double z) {
	double t_0 = (1.0 + z) * (z * z);
	double tmp;
	if (t_0 <= -2e+23) {
		tmp = (x / z) / (z * (z / y));
	} else if (t_0 <= 5e-193) {
		tmp = (x / z) / (z / y);
	} else {
		tmp = ((x / z) / z) * (y / (1.0 + 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) :: t_0
    real(8) :: tmp
    t_0 = (1.0d0 + z) * (z * z)
    if (t_0 <= (-2d+23)) then
        tmp = (x / z) / (z * (z / y))
    else if (t_0 <= 5d-193) then
        tmp = (x / z) / (z / y)
    else
        tmp = ((x / z) / z) * (y / (1.0d0 + z))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double t_0 = (1.0 + z) * (z * z);
	double tmp;
	if (t_0 <= -2e+23) {
		tmp = (x / z) / (z * (z / y));
	} else if (t_0 <= 5e-193) {
		tmp = (x / z) / (z / y);
	} else {
		tmp = ((x / z) / z) * (y / (1.0 + z));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	t_0 = (1.0 + z) * (z * z)
	tmp = 0
	if t_0 <= -2e+23:
		tmp = (x / z) / (z * (z / y))
	elif t_0 <= 5e-193:
		tmp = (x / z) / (z / y)
	else:
		tmp = ((x / z) / z) * (y / (1.0 + z))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	t_0 = Float64(Float64(1.0 + z) * Float64(z * z))
	tmp = 0.0
	if (t_0 <= -2e+23)
		tmp = Float64(Float64(x / z) / Float64(z * Float64(z / y)));
	elseif (t_0 <= 5e-193)
		tmp = Float64(Float64(x / z) / Float64(z / y));
	else
		tmp = Float64(Float64(Float64(x / z) / z) * Float64(y / Float64(1.0 + z)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	t_0 = (1.0 + z) * (z * z);
	tmp = 0.0;
	if (t_0 <= -2e+23)
		tmp = (x / z) / (z * (z / y));
	elseif (t_0 <= 5e-193)
		tmp = (x / z) / (z / y);
	else
		tmp = ((x / z) / z) * (y / (1.0 + z));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 + z), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+23], N[(N[(x / z), $MachinePrecision] / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-193], N[(N[(x / z), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision] * N[(y / N[(1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(1 + z\right) \cdot \left(z \cdot z\right)\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+23}:\\
\;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z 1)) < -1.9999999999999998e23

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999998e23 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 5.0000000000000005e-193

    1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000005e-193 < (*.f64 (*.f64 z z) (+.f64 z 1))

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

Alternative 2: 92.7% 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 6.5 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{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 (<= z -1.0) (not (<= z 6.5e-12)))
   (* (/ x z) (/ y (* z z)))
   (/ (/ y (/ z x)) z)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.0) || !(z <= 6.5e-12)) {
		tmp = (x / z) * (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 ((z <= (-1.0d0)) .or. (.not. (z <= 6.5d-12))) then
        tmp = (x / z) * (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 ((z <= -1.0) || !(z <= 6.5e-12)) {
		tmp = (x / z) * (y / (z * z));
	} else {
		tmp = (y / (z / x)) / z;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z <= -1.0) or not (z <= 6.5e-12):
		tmp = (x / z) * (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 ((z <= -1.0) || !(z <= 6.5e-12))
		tmp = Float64(Float64(x / z) * Float64(y / Float64(z * z)));
	else
		tmp = Float64(Float64(y / Float64(z / x)) / 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 <= 6.5e-12)))
		tmp = (x / z) * (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[z, -1.0], N[Not[LessEqual[z, 6.5e-12]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z / x), $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 6.5 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot 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 6.5000000000000002e-12 < 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. associate-*l*87.0%

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

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

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

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

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

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

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

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

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

    if -1 < z < 6.5000000000000002e-12

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.0% 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 6.5 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{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 (<= z -1.0) (not (<= z 6.5e-12)))
   (* (/ x z) (/ (/ y z) z))
   (/ (/ y (/ z x)) z)))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.0) || !(z <= 6.5e-12)) {
		tmp = (x / z) * ((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 ((z <= (-1.0d0)) .or. (.not. (z <= 6.5d-12))) then
        tmp = (x / z) * ((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 ((z <= -1.0) || !(z <= 6.5e-12)) {
		tmp = (x / z) * ((y / z) / z);
	} else {
		tmp = (y / (z / x)) / z;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (z <= -1.0) or not (z <= 6.5e-12):
		tmp = (x / z) * ((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 ((z <= -1.0) || !(z <= 6.5e-12))
		tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z));
	else
		tmp = Float64(Float64(y / Float64(z / x)) / 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 <= 6.5e-12)))
		tmp = (x / z) * ((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[z, -1.0], N[Not[LessEqual[z, 6.5e-12]], $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}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 6.5 \cdot 10^{-12}\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 6.5000000000000002e-12 < 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. associate-*l*87.0%

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 6.5000000000000002e-12

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 93.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{x \cdot y}{z + 1}}}{z}}{z} \]
      10. *-commutative90.8%

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

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

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

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

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

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

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

    if -1 < z < 6.5000000000000002e-12

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000002e-12 < z

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 95.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 6.5000000000000002e-12

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000002e-12 < z

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 94.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 6.5000000000000002e-12

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000002e-12 < z

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 94.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 6.5000000000000002e-12

    1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000002e-12 < z

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 94.2% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq -5.9 \cdot 10^{-61}:\\ \;\;\;\;\frac{y}{1 + z} \cdot \frac{x}{z \cdot z}\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-12}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{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 (<= z -5.9e-61)
   (* (/ y (+ 1.0 z)) (/ x (* z z)))
   (if (<= z 6.5e-12) (/ (/ y (/ z x)) z) (/ (/ y z) (* z (/ z x))))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.9e-61) {
		tmp = (y / (1.0 + z)) * (x / (z * z));
	} else if (z <= 6.5e-12) {
		tmp = (y / (z / x)) / z;
	} else {
		tmp = (y / z) / (z * (z / x));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-5.9d-61)) then
        tmp = (y / (1.0d0 + z)) * (x / (z * z))
    else if (z <= 6.5d-12) then
        tmp = (y / (z / x)) / z
    else
        tmp = (y / z) / (z * (z / x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.9e-61) {
		tmp = (y / (1.0 + z)) * (x / (z * z));
	} else if (z <= 6.5e-12) {
		tmp = (y / (z / x)) / z;
	} else {
		tmp = (y / z) / (z * (z / x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if z <= -5.9e-61:
		tmp = (y / (1.0 + z)) * (x / (z * z))
	elif z <= 6.5e-12:
		tmp = (y / (z / x)) / z
	else:
		tmp = (y / z) / (z * (z / x))
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (z <= -5.9e-61)
		tmp = Float64(Float64(y / Float64(1.0 + z)) * Float64(x / Float64(z * z)));
	elseif (z <= 6.5e-12)
		tmp = Float64(Float64(y / Float64(z / x)) / z);
	else
		tmp = Float64(Float64(y / z) / 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 (z <= -5.9e-61)
		tmp = (y / (1.0 + z)) * (x / (z * z));
	elseif (z <= 6.5e-12)
		tmp = (y / (z / x)) / z;
	else
		tmp = (y / z) / (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[z, -5.9e-61], N[(N[(y / N[(1.0 + z), $MachinePrecision]), $MachinePrecision] * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e-12], N[(N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.9 \cdot 10^{-61}:\\
\;\;\;\;\frac{y}{1 + z} \cdot \frac{x}{z \cdot z}\\

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

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


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

    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. times-frac96.0%

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

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

    if -5.89999999999999972e-61 < z < 6.5000000000000002e-12

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000002e-12 < z

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.9 \cdot 10^{-61}:\\ \;\;\;\;\frac{y}{1 + z} \cdot \frac{x}{z \cdot z}\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-12}:\\ \;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\ \end{array} \]

Alternative 9: 96.9% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{z} \cdot \frac{y}{\color{blue}{z \cdot z + z}} \]
    2. *-rgt-identity96.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 96.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x}{z}} \]
    2. associate-*l/95.6%

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

      \[\leadsto \frac{y \cdot \frac{x}{z}}{\color{blue}{z \cdot z + z}} \]
    4. distribute-lft1-in95.6%

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

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

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

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

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

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

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

Alternative 11: 78.1% accurate, 1.2× speedup?

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

    1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.1e-6 < y

    1. Initial program 89.3%

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

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

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

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

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

Alternative 12: 77.9% accurate, 1.2× speedup?

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

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


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

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e18 < x

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 79.5% accurate, 1.2× speedup?

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

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


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

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{z \cdot z + z \cdot 1}}{y}} \]
      10. fma-def94.2%

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

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

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

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

    if -1.4e-119 < x

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

Alternative 14: 79.7% accurate, 1.2× speedup?

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

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{z \cdot z + z \cdot 1}}{y}} \]
      10. fma-def94.2%

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

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

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

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

    if -4.2000000000000001e-120 < x

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 77.9% accurate, 1.2× speedup?

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

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


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

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6e20 < x

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 72.3% accurate, 1.6× speedup?

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

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

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

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

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

    \[\leadsto y \cdot \frac{x}{z \cdot 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 2023196 
(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))))