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

Percentage Accurate: 83.5% → 95.5%
Time: 11.7s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 83.5% 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.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\ t_1 := \frac{\frac{y \cdot \frac{x}{z}}{z}}{z}\\ \mathbf{if}\;t_0 \leq -2 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-291}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+124}:\\ \;\;\;\;\frac{y \cdot x}{t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (+ z 1.0) (* z z))) (t_1 (/ (/ (* y (/ x z)) z) z)))
   (if (<= t_0 -2e+32)
     t_1
     (if (<= t_0 5e-291)
       (* (/ x z) (/ y z))
       (if (<= t_0 2e+124) (/ (* y x) t_0) t_1)))))
double code(double x, double y, double z) {
	double t_0 = (z + 1.0) * (z * z);
	double t_1 = ((y * (x / z)) / z) / z;
	double tmp;
	if (t_0 <= -2e+32) {
		tmp = t_1;
	} else if (t_0 <= 5e-291) {
		tmp = (x / z) * (y / z);
	} else if (t_0 <= 2e+124) {
		tmp = (y * x) / t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (z + 1.0d0) * (z * z)
    t_1 = ((y * (x / z)) / z) / z
    if (t_0 <= (-2d+32)) then
        tmp = t_1
    else if (t_0 <= 5d-291) then
        tmp = (x / z) * (y / z)
    else if (t_0 <= 2d+124) then
        tmp = (y * x) / t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (z + 1.0) * (z * z);
	double t_1 = ((y * (x / z)) / z) / z;
	double tmp;
	if (t_0 <= -2e+32) {
		tmp = t_1;
	} else if (t_0 <= 5e-291) {
		tmp = (x / z) * (y / z);
	} else if (t_0 <= 2e+124) {
		tmp = (y * x) / t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (z + 1.0) * (z * z)
	t_1 = ((y * (x / z)) / z) / z
	tmp = 0
	if t_0 <= -2e+32:
		tmp = t_1
	elif t_0 <= 5e-291:
		tmp = (x / z) * (y / z)
	elif t_0 <= 2e+124:
		tmp = (y * x) / t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(z + 1.0) * Float64(z * z))
	t_1 = Float64(Float64(Float64(y * Float64(x / z)) / z) / z)
	tmp = 0.0
	if (t_0 <= -2e+32)
		tmp = t_1;
	elseif (t_0 <= 5e-291)
		tmp = Float64(Float64(x / z) * Float64(y / z));
	elseif (t_0 <= 2e+124)
		tmp = Float64(Float64(y * x) / t_0);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (z + 1.0) * (z * z);
	t_1 = ((y * (x / z)) / z) / z;
	tmp = 0.0;
	if (t_0 <= -2e+32)
		tmp = t_1;
	elseif (t_0 <= 5e-291)
		tmp = (x / z) * (y / z);
	elseif (t_0 <= 2e+124)
		tmp = (y * x) / t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+32], t$95$1, If[LessEqual[t$95$0, 5e-291], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+124], N[(N[(y * x), $MachinePrecision] / t$95$0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
t_1 := \frac{\frac{y \cdot \frac{x}{z}}{z}}{z}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+32}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+124}:\\
\;\;\;\;\frac{y \cdot x}{t_0}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z 1)) < -2.00000000000000011e32 or 1.9999999999999999e124 < (*.f64 (*.f64 z z) (+.f64 z 1))

    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000011e32 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 5.0000000000000003e-291

    1. Initial program 76.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000003e-291 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 1.9999999999999999e124

    1. Initial program 96.5%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.5%

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

Alternative 2: 41.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -45000000000:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-310} \lor \neg \left(z \leq 1.18 \cdot 10^{+139}\right) \land z \leq 1.18 \cdot 10^{+232}:\\ \;\;\;\;\frac{-x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -45000000000.0)
   (/ y (/ z x))
   (if (or (<= z -1e-310) (and (not (<= z 1.18e+139)) (<= z 1.18e+232)))
     (/ (- x) (/ z y))
     (* y (/ x z)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -45000000000.0) {
		tmp = y / (z / x);
	} else if ((z <= -1e-310) || (!(z <= 1.18e+139) && (z <= 1.18e+232))) {
		tmp = -x / (z / y);
	} else {
		tmp = y * (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 <= (-45000000000.0d0)) then
        tmp = y / (z / x)
    else if ((z <= (-1d-310)) .or. (.not. (z <= 1.18d+139)) .and. (z <= 1.18d+232)) then
        tmp = -x / (z / y)
    else
        tmp = y * (x / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -45000000000.0) {
		tmp = y / (z / x);
	} else if ((z <= -1e-310) || (!(z <= 1.18e+139) && (z <= 1.18e+232))) {
		tmp = -x / (z / y);
	} else {
		tmp = y * (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -45000000000.0:
		tmp = y / (z / x)
	elif (z <= -1e-310) or (not (z <= 1.18e+139) and (z <= 1.18e+232)):
		tmp = -x / (z / y)
	else:
		tmp = y * (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -45000000000.0)
		tmp = Float64(y / Float64(z / x));
	elseif ((z <= -1e-310) || (!(z <= 1.18e+139) && (z <= 1.18e+232)))
		tmp = Float64(Float64(-x) / Float64(z / y));
	else
		tmp = Float64(y * Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -45000000000.0)
		tmp = y / (z / x);
	elseif ((z <= -1e-310) || (~((z <= 1.18e+139)) && (z <= 1.18e+232)))
		tmp = -x / (z / y);
	else
		tmp = y * (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -45000000000.0], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1e-310], And[N[Not[LessEqual[z, 1.18e+139]], $MachinePrecision], LessEqual[z, 1.18e+232]]], N[((-x) / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1 \cdot 10^{-310} \lor \neg \left(z \leq 1.18 \cdot 10^{+139}\right) \land z \leq 1.18 \cdot 10^{+232}:\\
\;\;\;\;\frac{-x}{\frac{z}{y}}\\

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


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

    1. Initial program 82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{-y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt18.1%

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{z} \]
      5. add-sqr-sqrt43.3%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      7. *-commutative36.9%

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

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

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

    if -4.5e10 < z < -9.999999999999969e-311 or 1.18e139 < z < 1.18e232

    1. Initial program 86.1%

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \frac{y}{z} + \frac{y}{{z}^{2}}\right)} \]
    5. Step-by-step derivation
      1. +-commutative74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < z < 1.18e139 or 1.18e232 < z

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{-y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt9.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -45000000000:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-310} \lor \neg \left(z \leq 1.18 \cdot 10^{+139}\right) \land z \leq 1.18 \cdot 10^{+232}:\\ \;\;\;\;\frac{-x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]

Alternative 3: 92.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

    if -4.5e10 < z < 1

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

Alternative 4: 94.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4.5e10 < z < 1

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

Alternative 5: 94.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.5e10 < z < 1

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

Alternative 6: 94.4% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 82.3%

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

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

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

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

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

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

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

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

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

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

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

    if -4.5e10 < z < 1

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 97.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{+132}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1}\\

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


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

    1. Initial program 84.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999996e132 < y

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 41.0% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq 3.65 \cdot 10^{+139} \lor \neg \left(z \leq 1.8 \cdot 10^{+232}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\

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


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

    1. Initial program 85.8%

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \frac{y}{z} + \frac{y}{{z}^{2}}\right)} \]
    5. Step-by-step derivation
      1. +-commutative63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < z < 3.64999999999999989e139 or 1.79999999999999996e232 < z

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{-y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt9.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.64999999999999989e139 < z < 1.79999999999999996e232

    1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\frac{z}{y}}} \]
    12. Simplified52.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{-y}{\frac{z}{x}}\\ \mathbf{elif}\;z \leq 3.65 \cdot 10^{+139} \lor \neg \left(z \leq 1.8 \cdot 10^{+232}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{\frac{z}{y}}\\ \end{array} \]

Alternative 9: 96.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 76.9% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{+65}:\\
\;\;\;\;\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 < 4.5e65

    1. Initial program 84.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.5e65 < y

    1. Initial program 85.6%

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

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

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

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

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

Alternative 11: 77.3% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.85000000000000003e-78 < y

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 77.3% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4e-78 < y

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 32.6% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 86.0%

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \frac{y}{z} + \frac{y}{{z}^{2}}\right)} \]
    5. Step-by-step derivation
      1. +-commutative58.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5000000000000003e-174 < y

    1. Initial program 82.6%

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

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

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \frac{y}{z} + \frac{y}{{z}^{2}}\right)} \]
    5. Step-by-step derivation
      1. +-commutative54.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{-y}{z}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt0.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      7. *-commutative29.9%

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

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

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

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

Alternative 14: 72.7% accurate, 1.6× speedup?

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

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

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

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

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

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

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

Alternative 15: 31.4% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \left(\frac{y}{{z}^{2}} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
    3. unsub-neg56.4%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{-y}{z}} \]
  10. Step-by-step derivation
    1. add-sqr-sqrt18.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Developer target: 95.4% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023174 
(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))))