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

Percentage Accurate: 83.1% → 99.6%
Time: 10.1s
Alternatives: 14
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 83.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \cdot y\_m \leq 10^{-264}:\\ \;\;\;\;\frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\ \mathbf{elif}\;x\_m \cdot y\_m \leq 1.5 \cdot 10^{+130}:\\ \;\;\;\;\frac{\frac{x\_m \cdot y\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \left(\frac{y\_m}{z} \cdot \frac{-1}{-1 - z}\right)\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* x_m y_m) 1e-264)
     (* (/ y_m (fma z z z)) (/ x_m z))
     (if (<= (* x_m y_m) 1.5e+130)
       (/ (/ (* x_m y_m) (fma z z z)) z)
       (* (/ x_m z) (* (/ y_m z) (/ -1.0 (- -1.0 z)))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if ((x_m * y_m) <= 1e-264) {
		tmp = (y_m / fma(z, z, z)) * (x_m / z);
	} else if ((x_m * y_m) <= 1.5e+130) {
		tmp = ((x_m * y_m) / fma(z, z, z)) / z;
	} else {
		tmp = (x_m / z) * ((y_m / z) * (-1.0 / (-1.0 - z)));
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (Float64(x_m * y_m) <= 1e-264)
		tmp = Float64(Float64(y_m / fma(z, z, z)) * Float64(x_m / z));
	elseif (Float64(x_m * y_m) <= 1.5e+130)
		tmp = Float64(Float64(Float64(x_m * y_m) / fma(z, z, z)) / z);
	else
		tmp = Float64(Float64(x_m / z) * Float64(Float64(y_m / z) * Float64(-1.0 / Float64(-1.0 - z))));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 1e-264], N[(N[(y$95$m / N[(z * z + z), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 1.5e+130], N[(N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(z * z + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(N[(y$95$m / z), $MachinePrecision] * N[(-1.0 / N[(-1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot y\_m \leq 10^{-264}:\\
\;\;\;\;\frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\

\mathbf{elif}\;x\_m \cdot y\_m \leq 1.5 \cdot 10^{+130}:\\
\;\;\;\;\frac{\frac{x\_m \cdot y\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \left(\frac{y\_m}{z} \cdot \frac{-1}{-1 - z}\right)\\


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

    1. Initial program 78.7%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z + z \cdot 1}} \cdot \frac{x}{z} \]
      7. *-rgt-identityN/A

        \[\leadsto \frac{y}{z \cdot z + \color{blue}{z}} \cdot \frac{x}{z} \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot \frac{x}{z} \]
      9. /-lowering-/.f6493.1

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

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

    if 1e-264 < (*.f64 x y) < 1.5e130

    1. Initial program 94.0%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}}{z} \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{z \cdot z + z \cdot 1}}}{z} \]
      8. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x \cdot y}{z \cdot z + \color{blue}{z}}}{z} \]
      9. accelerator-lowering-fma.f6499.8

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

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

    if 1.5e130 < (*.f64 x y)

    1. Initial program 66.0%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1}} \]
      2. div-invN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z} \cdot \frac{1}{z + 1}} \]
      3. times-fracN/A

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
      6. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{z}} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
      8. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z} \cdot \left(\color{blue}{\frac{y}{z}} \cdot \frac{1}{z + 1}\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z} \cdot \left(\frac{y}{z} \cdot \color{blue}{\frac{1}{z + 1}}\right) \]
      10. +-lowering-+.f6499.8

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq 10^{-264}:\\ \;\;\;\;\frac{y}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \leq 1.5 \cdot 10^{+130}:\\ \;\;\;\;\frac{\frac{x \cdot y}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(\frac{y}{z} \cdot \frac{-1}{-1 - z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 95.9% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+25}:\\ \;\;\;\;\frac{x\_m}{z \cdot \frac{z \cdot z}{y\_m}}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+133}:\\ \;\;\;\;y\_m \cdot \frac{x\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z \cdot z}\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* (+ z 1.0) (* z z))))
   (*
    y_s
    (*
     x_s
     (if (<= t_0 -1e+25)
       (/ x_m (* z (/ (* z z) y_m)))
       (if (<= t_0 2e-310)
         (* (/ x_m z) (/ y_m z))
         (if (<= t_0 4e+133)
           (* y_m (/ x_m (* z (fma z z z))))
           (* (/ x_m z) (/ y_m (* z z))))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = (z + 1.0) * (z * z);
	double tmp;
	if (t_0 <= -1e+25) {
		tmp = x_m / (z * ((z * z) / y_m));
	} else if (t_0 <= 2e-310) {
		tmp = (x_m / z) * (y_m / z);
	} else if (t_0 <= 4e+133) {
		tmp = y_m * (x_m / (z * fma(z, z, z)));
	} else {
		tmp = (x_m / z) * (y_m / (z * z));
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(Float64(z + 1.0) * Float64(z * z))
	tmp = 0.0
	if (t_0 <= -1e+25)
		tmp = Float64(x_m / Float64(z * Float64(Float64(z * z) / y_m)));
	elseif (t_0 <= 2e-310)
		tmp = Float64(Float64(x_m / z) * Float64(y_m / z));
	elseif (t_0 <= 4e+133)
		tmp = Float64(y_m * Float64(x_m / Float64(z * fma(z, z, z))));
	else
		tmp = Float64(Float64(x_m / z) * Float64(y_m / Float64(z * z)));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$0, -1e+25], N[(x$95$m / N[(z * N[(N[(z * z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-310], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+133], N[(y$95$m * N[(x$95$m / N[(z * N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+25}:\\
\;\;\;\;\frac{x\_m}{z \cdot \frac{z \cdot z}{y\_m}}\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+133}:\\
\;\;\;\;y\_m \cdot \frac{x\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < -1.00000000000000009e25

    1. Initial program 83.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      2. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{\left(z \cdot z\right) \cdot \left(z + 1\right)}{y}}} \]
      3. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{\left(z \cdot z\right) \cdot \left(z + 1\right)}{y}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\frac{\left(z \cdot z\right) \cdot \left(z + 1\right)}{y}}} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{x}{\frac{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}}{y}} \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x}{\frac{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}}{y}} \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{x}{\frac{z \cdot \left(z \cdot z + \color{blue}{z}\right)}{y}} \]
      10. accelerator-lowering-fma.f6487.0

        \[\leadsto \frac{x}{\frac{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z\right)}}{y}} \]
    4. Applied egg-rr87.0%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{{z}^{3}}{y}}} \]
    6. Step-by-step derivation
      1. cube-multN/A

        \[\leadsto \frac{x}{\frac{\color{blue}{z \cdot \left(z \cdot z\right)}}{y}} \]
      2. unpow2N/A

        \[\leadsto \frac{x}{\frac{z \cdot \color{blue}{{z}^{2}}}{y}} \]
      3. associate-/l*N/A

        \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{{z}^{2}}{y}}} \]
      4. *-lft-identityN/A

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{1 \cdot {z}^{2}}}{y}} \]
      5. associate-*l/N/A

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\frac{1}{y} \cdot {z}^{2}\right)}} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(\frac{1}{y} \cdot {z}^{2}\right)}} \]
      7. associate-*l/N/A

        \[\leadsto \frac{x}{z \cdot \color{blue}{\frac{1 \cdot {z}^{2}}{y}}} \]
      8. *-lft-identityN/A

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{{z}^{2}}}{y}} \]
      9. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z \cdot \color{blue}{\frac{{z}^{2}}{y}}} \]
      10. unpow2N/A

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{z \cdot z}}{y}} \]
      11. *-lowering-*.f6488.1

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

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

    if -1.00000000000000009e25 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 1.999999999999994e-310

    1. Initial program 66.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{2}}} \]
      4. unpow2N/A

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} \]
      3. times-fracN/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
      6. /-lowering-/.f6499.9

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

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

    if 1.999999999999994e-310 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 4.0000000000000001e133

    1. Initial program 93.1%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}} \cdot y \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}} \cdot y \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{x}{z \cdot \left(z \cdot z + \color{blue}{z}\right)} \cdot y \]
      10. accelerator-lowering-fma.f6493.0

        \[\leadsto \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot y \]
    4. Applied egg-rr93.0%

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

    if 4.0000000000000001e133 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

    1. Initial program 80.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \frac{x \cdot y}{\color{blue}{{z}^{3}}} \]
    4. Step-by-step derivation
      1. cube-multN/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{x \cdot y}{z \cdot \color{blue}{{z}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot {z}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{x \cdot y}{z \cdot \color{blue}{\left(z \cdot z\right)}} \]
      5. *-lowering-*.f6480.2

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
    6. Step-by-step derivation
      1. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot z}} \cdot \frac{x}{z} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z} \]
      6. /-lowering-/.f6496.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -1 \cdot 10^{+25}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z \cdot z}{y}}\\ \mathbf{elif}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{elif}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 4 \cdot 10^{+133}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 94.2% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := z \cdot \mathsf{fma}\left(z, z, z\right)\\ t_1 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+25}:\\ \;\;\;\;x\_m \cdot \frac{y\_m}{t\_0}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+133}:\\ \;\;\;\;y\_m \cdot \frac{x\_m}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z \cdot z}\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* z (fma z z z))) (t_1 (* (+ z 1.0) (* z z))))
   (*
    y_s
    (*
     x_s
     (if (<= t_1 -1e+25)
       (* x_m (/ y_m t_0))
       (if (<= t_1 2e-310)
         (* (/ x_m z) (/ y_m z))
         (if (<= t_1 4e+133)
           (* y_m (/ x_m t_0))
           (* (/ x_m z) (/ y_m (* z z))))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = z * fma(z, z, z);
	double t_1 = (z + 1.0) * (z * z);
	double tmp;
	if (t_1 <= -1e+25) {
		tmp = x_m * (y_m / t_0);
	} else if (t_1 <= 2e-310) {
		tmp = (x_m / z) * (y_m / z);
	} else if (t_1 <= 4e+133) {
		tmp = y_m * (x_m / t_0);
	} else {
		tmp = (x_m / z) * (y_m / (z * z));
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(z * fma(z, z, z))
	t_1 = Float64(Float64(z + 1.0) * Float64(z * z))
	tmp = 0.0
	if (t_1 <= -1e+25)
		tmp = Float64(x_m * Float64(y_m / t_0));
	elseif (t_1 <= 2e-310)
		tmp = Float64(Float64(x_m / z) * Float64(y_m / z));
	elseif (t_1 <= 4e+133)
		tmp = Float64(y_m * Float64(x_m / t_0));
	else
		tmp = Float64(Float64(x_m / z) * Float64(y_m / Float64(z * z)));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[(z * z + z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$1, -1e+25], N[(x$95$m * N[(y$95$m / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-310], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+133], N[(y$95$m * N[(x$95$m / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := z \cdot \mathsf{fma}\left(z, z, z\right)\\
t_1 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+25}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{t\_0}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+133}:\\
\;\;\;\;y\_m \cdot \frac{x\_m}{t\_0}\\

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < -1.00000000000000009e25

    1. Initial program 83.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \color{blue}{\frac{y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot x} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot x} \]
      4. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}} \cdot x \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto \frac{y}{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}} \cdot x \]
      8. *-rgt-identityN/A

        \[\leadsto \frac{y}{z \cdot \left(z \cdot z + \color{blue}{z}\right)} \cdot x \]
      9. accelerator-lowering-fma.f6487.0

        \[\leadsto \frac{y}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot x \]
    4. Applied egg-rr87.0%

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

    if -1.00000000000000009e25 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 1.999999999999994e-310

    1. Initial program 66.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{2}}} \]
      4. unpow2N/A

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} \]
      3. times-fracN/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
      6. /-lowering-/.f6499.9

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

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

    if 1.999999999999994e-310 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 4.0000000000000001e133

    1. Initial program 93.1%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}} \cdot y \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}} \cdot y \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{x}{z \cdot \left(z \cdot z + \color{blue}{z}\right)} \cdot y \]
      10. accelerator-lowering-fma.f6493.0

        \[\leadsto \frac{x}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot y \]
    4. Applied egg-rr93.0%

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

    if 4.0000000000000001e133 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

    1. Initial program 80.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \frac{x \cdot y}{\color{blue}{{z}^{3}}} \]
    4. Step-by-step derivation
      1. cube-multN/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{x \cdot y}{z \cdot \color{blue}{{z}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot {z}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{x \cdot y}{z \cdot \color{blue}{\left(z \cdot z\right)}} \]
      5. *-lowering-*.f6480.2

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
    6. Step-by-step derivation
      1. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{y}{z \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot z} \cdot \frac{x}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot z}} \cdot \frac{x}{z} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \frac{y}{\color{blue}{z \cdot z}} \cdot \frac{x}{z} \]
      6. /-lowering-/.f6496.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -1 \cdot 10^{+25}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \mathbf{elif}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{elif}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 4 \cdot 10^{+133}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.3% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := z \cdot \mathsf{fma}\left(z, z, z\right)\\ t_1 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+25}:\\ \;\;\;\;x\_m \cdot \frac{y\_m}{t\_0}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot \frac{x\_m}{t\_0}\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* z (fma z z z))) (t_1 (* (+ z 1.0) (* z z))))
   (*
    y_s
    (*
     x_s
     (if (<= t_1 -1e+25)
       (* x_m (/ y_m t_0))
       (if (<= t_1 2e-310) (* (/ x_m z) (/ y_m z)) (* y_m (/ x_m t_0))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = z * fma(z, z, z);
	double t_1 = (z + 1.0) * (z * z);
	double tmp;
	if (t_1 <= -1e+25) {
		tmp = x_m * (y_m / t_0);
	} else if (t_1 <= 2e-310) {
		tmp = (x_m / z) * (y_m / z);
	} else {
		tmp = y_m * (x_m / t_0);
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(z * fma(z, z, z))
	t_1 = Float64(Float64(z + 1.0) * Float64(z * z))
	tmp = 0.0
	if (t_1 <= -1e+25)
		tmp = Float64(x_m * Float64(y_m / t_0));
	elseif (t_1 <= 2e-310)
		tmp = Float64(Float64(x_m / z) * Float64(y_m / z));
	else
		tmp = Float64(y_m * Float64(x_m / t_0));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[(z * z + z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$1, -1e+25], N[(x$95$m * N[(y$95$m / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-310], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(x$95$m / t$95$0), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := z \cdot \mathsf{fma}\left(z, z, z\right)\\
t_1 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+25}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{t\_0}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{x\_m}{t\_0}\\


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < -1.00000000000000009e25

    1. Initial program 83.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \color{blue}{\frac{y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot x} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot x} \]
      4. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}} \cdot x \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto \frac{y}{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}} \cdot x \]
      8. *-rgt-identityN/A

        \[\leadsto \frac{y}{z \cdot \left(z \cdot z + \color{blue}{z}\right)} \cdot x \]
      9. accelerator-lowering-fma.f6487.0

        \[\leadsto \frac{y}{z \cdot \color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot x \]
    4. Applied egg-rr87.0%

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

    if -1.00000000000000009e25 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 1.999999999999994e-310

    1. Initial program 66.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{2}}} \]
      4. unpow2N/A

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} \]
      3. times-fracN/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
      6. /-lowering-/.f6499.9

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

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

    if 1.999999999999994e-310 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

    1. Initial program 87.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}} \cdot y \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}} \cdot y \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{x}{z \cdot \left(z \cdot z + \color{blue}{z}\right)} \cdot y \]
      10. accelerator-lowering-fma.f6490.3

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

      \[\leadsto \color{blue}{\frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -1 \cdot 10^{+25}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \mathbf{elif}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.2% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+25}:\\ \;\;\;\;x\_m \cdot \frac{y\_m}{z \cdot \left(z \cdot z\right)}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot \frac{x\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* (+ z 1.0) (* z z))))
   (*
    y_s
    (*
     x_s
     (if (<= t_0 -1e+25)
       (* x_m (/ y_m (* z (* z z))))
       (if (<= t_0 2e-310)
         (* (/ x_m z) (/ y_m z))
         (* y_m (/ x_m (* z (fma z z z))))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = (z + 1.0) * (z * z);
	double tmp;
	if (t_0 <= -1e+25) {
		tmp = x_m * (y_m / (z * (z * z)));
	} else if (t_0 <= 2e-310) {
		tmp = (x_m / z) * (y_m / z);
	} else {
		tmp = y_m * (x_m / (z * fma(z, z, z)));
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(Float64(z + 1.0) * Float64(z * z))
	tmp = 0.0
	if (t_0 <= -1e+25)
		tmp = Float64(x_m * Float64(y_m / Float64(z * Float64(z * z))));
	elseif (t_0 <= 2e-310)
		tmp = Float64(Float64(x_m / z) * Float64(y_m / z));
	else
		tmp = Float64(y_m * Float64(x_m / Float64(z * fma(z, z, z))));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[t$95$0, -1e+25], N[(x$95$m * N[(y$95$m / N[(z * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-310], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(x$95$m / N[(z * N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+25}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{z \cdot \left(z \cdot z\right)}\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z}\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{x\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < -1.00000000000000009e25

    1. Initial program 83.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{3}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{3}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{3}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{3}}} \]
      4. cube-multN/A

        \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
      5. unpow2N/A

        \[\leadsto x \cdot \frac{y}{z \cdot \color{blue}{{z}^{2}}} \]
      6. *-lowering-*.f64N/A

        \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot {z}^{2}}} \]
      7. unpow2N/A

        \[\leadsto x \cdot \frac{y}{z \cdot \color{blue}{\left(z \cdot z\right)}} \]
      8. *-lowering-*.f6486.2

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

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

    if -1.00000000000000009e25 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 1.999999999999994e-310

    1. Initial program 66.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{2}}} \]
      4. unpow2N/A

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z \cdot z} \]
      3. times-fracN/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z}} \cdot \frac{x}{z} \]
      6. /-lowering-/.f6499.9

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

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

    if 1.999999999999994e-310 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

    1. Initial program 87.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}} \cdot y \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}} \cdot y \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{x}{z \cdot \left(z \cdot z + \color{blue}{z}\right)} \cdot y \]
      10. accelerator-lowering-fma.f6490.3

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

      \[\leadsto \color{blue}{\frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -1 \cdot 10^{+25}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot \left(z \cdot z\right)}\\ \mathbf{elif}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 2 \cdot 10^{-310}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.6% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \cdot y\_m \leq 10^{-264}:\\ \;\;\;\;\frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\ \mathbf{elif}\;x\_m \cdot y\_m \leq 1.5 \cdot 10^{+130}:\\ \;\;\;\;\frac{\frac{x\_m \cdot y\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{\frac{y\_m}{z + 1}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* x_m y_m) 1e-264)
     (* (/ y_m (fma z z z)) (/ x_m z))
     (if (<= (* x_m y_m) 1.5e+130)
       (/ (/ (* x_m y_m) (fma z z z)) z)
       (* (/ x_m z) (/ (/ y_m (+ z 1.0)) z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if ((x_m * y_m) <= 1e-264) {
		tmp = (y_m / fma(z, z, z)) * (x_m / z);
	} else if ((x_m * y_m) <= 1.5e+130) {
		tmp = ((x_m * y_m) / fma(z, z, z)) / z;
	} else {
		tmp = (x_m / z) * ((y_m / (z + 1.0)) / z);
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (Float64(x_m * y_m) <= 1e-264)
		tmp = Float64(Float64(y_m / fma(z, z, z)) * Float64(x_m / z));
	elseif (Float64(x_m * y_m) <= 1.5e+130)
		tmp = Float64(Float64(Float64(x_m * y_m) / fma(z, z, z)) / z);
	else
		tmp = Float64(Float64(x_m / z) * Float64(Float64(y_m / Float64(z + 1.0)) / z));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 1e-264], N[(N[(y$95$m / N[(z * z + z), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 1.5e+130], N[(N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(z * z + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(N[(y$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot y\_m \leq 10^{-264}:\\
\;\;\;\;\frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\

\mathbf{elif}\;x\_m \cdot y\_m \leq 1.5 \cdot 10^{+130}:\\
\;\;\;\;\frac{\frac{x\_m \cdot y\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\

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


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

    1. Initial program 78.7%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z + z \cdot 1}} \cdot \frac{x}{z} \]
      7. *-rgt-identityN/A

        \[\leadsto \frac{y}{z \cdot z + \color{blue}{z}} \cdot \frac{x}{z} \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot \frac{x}{z} \]
      9. /-lowering-/.f6493.1

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

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

    if 1e-264 < (*.f64 x y) < 1.5e130

    1. Initial program 94.0%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}}{z} \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{z \cdot z + z \cdot 1}}}{z} \]
      8. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x \cdot y}{z \cdot z + \color{blue}{z}}}{z} \]
      9. accelerator-lowering-fma.f6499.8

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

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

    if 1.5e130 < (*.f64 x y)

    1. Initial program 66.0%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot z}}{z + 1}} \]
      2. div-invN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{z \cdot z} \cdot \frac{1}{z + 1}} \]
      3. times-fracN/A

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
      6. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{z}} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
      8. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z} \cdot \left(\color{blue}{\frac{y}{z}} \cdot \frac{1}{z + 1}\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z} \cdot \left(\frac{y}{z} \cdot \color{blue}{\frac{1}{z + 1}}\right) \]
      10. +-lowering-+.f6499.8

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(\frac{y}{z} \cdot \frac{1}{z + 1}\right)} \]
    5. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{y \cdot \frac{1}{z + 1}}{z}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{y \cdot \frac{1}{z + 1}}{z}} \]
      3. un-div-invN/A

        \[\leadsto \frac{x}{z} \cdot \frac{\color{blue}{\frac{y}{z + 1}}}{z} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z} \cdot \frac{\color{blue}{\frac{y}{z + 1}}}{z} \]
      5. +-lowering-+.f6499.8

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

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

Alternative 7: 97.5% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := \frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \cdot y\_m \leq 10^{-264}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x\_m \cdot y\_m \leq 4 \cdot 10^{+278}:\\ \;\;\;\;\frac{\frac{x\_m \cdot y\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* (/ y_m (fma z z z)) (/ x_m z))))
   (*
    y_s
    (*
     x_s
     (if (<= (* x_m y_m) 1e-264)
       t_0
       (if (<= (* x_m y_m) 4e+278) (/ (/ (* x_m y_m) (fma z z z)) z) t_0))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = (y_m / fma(z, z, z)) * (x_m / z);
	double tmp;
	if ((x_m * y_m) <= 1e-264) {
		tmp = t_0;
	} else if ((x_m * y_m) <= 4e+278) {
		tmp = ((x_m * y_m) / fma(z, z, z)) / z;
	} else {
		tmp = t_0;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(Float64(y_m / fma(z, z, z)) * Float64(x_m / z))
	tmp = 0.0
	if (Float64(x_m * y_m) <= 1e-264)
		tmp = t_0;
	elseif (Float64(x_m * y_m) <= 4e+278)
		tmp = Float64(Float64(Float64(x_m * y_m) / fma(z, z, z)) / z);
	else
		tmp = t_0;
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(y$95$m / N[(z * z + z), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 1e-264], t$95$0, If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 4e+278], N[(N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(z * z + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], t$95$0]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot y\_m \leq 10^{-264}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x\_m \cdot y\_m \leq 4 \cdot 10^{+278}:\\
\;\;\;\;\frac{\frac{x\_m \cdot y\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < 1e-264 or 3.99999999999999985e278 < (*.f64 x y)

    1. Initial program 76.5%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z + z \cdot 1}} \cdot \frac{x}{z} \]
      7. *-rgt-identityN/A

        \[\leadsto \frac{y}{z \cdot z + \color{blue}{z}} \cdot \frac{x}{z} \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot \frac{x}{z} \]
      9. /-lowering-/.f6493.4

        \[\leadsto \frac{y}{\mathsf{fma}\left(z, z, z\right)} \cdot \color{blue}{\frac{x}{z}} \]
    4. Applied egg-rr93.4%

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

    if 1e-264 < (*.f64 x y) < 3.99999999999999985e278

    1. Initial program 91.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}{z}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{z \cdot \left(z + 1\right)}}}{z} \]
      6. *-lowering-*.f64N/A

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

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{z \cdot z + z \cdot 1}}}{z} \]
      8. *-rgt-identityN/A

        \[\leadsto \frac{\frac{x \cdot y}{z \cdot z + \color{blue}{z}}}{z} \]
      9. accelerator-lowering-fma.f6498.8

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

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\mathsf{fma}\left(z, z, z\right)}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 95.9% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := \frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \cdot y\_m \leq 5 \cdot 10^{-75}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x\_m \cdot y\_m \leq 5 \cdot 10^{+61}:\\ \;\;\;\;\frac{x\_m \cdot y\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* (/ y_m (fma z z z)) (/ x_m z))))
   (*
    y_s
    (*
     x_s
     (if (<= (* x_m y_m) 5e-75)
       t_0
       (if (<= (* x_m y_m) 5e+61) (/ (* x_m y_m) (* z (fma z z z))) t_0))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = (y_m / fma(z, z, z)) * (x_m / z);
	double tmp;
	if ((x_m * y_m) <= 5e-75) {
		tmp = t_0;
	} else if ((x_m * y_m) <= 5e+61) {
		tmp = (x_m * y_m) / (z * fma(z, z, z));
	} else {
		tmp = t_0;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(Float64(y_m / fma(z, z, z)) * Float64(x_m / z))
	tmp = 0.0
	if (Float64(x_m * y_m) <= 5e-75)
		tmp = t_0;
	elseif (Float64(x_m * y_m) <= 5e+61)
		tmp = Float64(Float64(x_m * y_m) / Float64(z * fma(z, z, z)));
	else
		tmp = t_0;
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(y$95$m / N[(z * z + z), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 5e-75], t$95$0, If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 5e+61], N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(z * N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \frac{y\_m}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x\_m}{z}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot y\_m \leq 5 \cdot 10^{-75}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x\_m \cdot y\_m \leq 5 \cdot 10^{+61}:\\
\;\;\;\;\frac{x\_m \cdot y\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < 4.99999999999999979e-75 or 5.00000000000000018e61 < (*.f64 x y)

    1. Initial program 78.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

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

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{z \cdot \left(z + 1\right)} \cdot \frac{x}{z}} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot z + z \cdot 1}} \cdot \frac{x}{z} \]
      7. *-rgt-identityN/A

        \[\leadsto \frac{y}{z \cdot z + \color{blue}{z}} \cdot \frac{x}{z} \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(z, z, z\right)}} \cdot \frac{x}{z} \]
      9. /-lowering-/.f6494.4

        \[\leadsto \frac{y}{\mathsf{fma}\left(z, z, z\right)} \cdot \color{blue}{\frac{x}{z}} \]
    4. Applied egg-rr94.4%

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

    if 4.99999999999999979e-75 < (*.f64 x y) < 5.00000000000000018e61

    1. Initial program 99.7%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*N/A

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(z \cdot \left(z + 1\right)\right) \cdot z}} \]
      3. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(z \cdot z + z \cdot 1\right)} \cdot z} \]
      5. *-rgt-identityN/A

        \[\leadsto \frac{x \cdot y}{\left(z \cdot z + \color{blue}{z}\right) \cdot z} \]
      6. accelerator-lowering-fma.f6499.8

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{\mathsf{fma}\left(z, z, z\right) \cdot z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq 5 \cdot 10^{-75}:\\ \;\;\;\;\frac{y}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+61}:\\ \;\;\;\;\frac{x \cdot y}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 95.4% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -4 \cdot 10^{+57}:\\ \;\;\;\;\frac{x\_m}{z \cdot \frac{z \cdot z}{y\_m}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m \cdot \frac{x\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* (+ z 1.0) (* z z)) -4e+57)
     (/ x_m (* z (/ (* z z) y_m)))
     (/ (* y_m (/ x_m (fma z z z))) z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (((z + 1.0) * (z * z)) <= -4e+57) {
		tmp = x_m / (z * ((z * z) / y_m));
	} else {
		tmp = (y_m * (x_m / fma(z, z, z))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (Float64(Float64(z + 1.0) * Float64(z * z)) <= -4e+57)
		tmp = Float64(x_m / Float64(z * Float64(Float64(z * z) / y_m)));
	else
		tmp = Float64(Float64(y_m * Float64(x_m / fma(z, z, z))) / z);
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision], -4e+57], N[(x$95$m / N[(z * N[(N[(z * z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * N[(x$95$m / N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -4 \cdot 10^{+57}:\\
\;\;\;\;\frac{x\_m}{z \cdot \frac{z \cdot z}{y\_m}}\\

\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{x\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < -4.00000000000000019e57

    1. Initial program 82.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}} \]
      2. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{\left(z \cdot z\right) \cdot \left(z + 1\right)}{y}}} \]
      3. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{\left(z \cdot z\right) \cdot \left(z + 1\right)}{y}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\frac{\left(z \cdot z\right) \cdot \left(z + 1\right)}{y}}} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{x}{\frac{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}}{y}} \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x}{\frac{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}}{y}} \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{x}{\frac{z \cdot \left(z \cdot z + \color{blue}{z}\right)}{y}} \]
      10. accelerator-lowering-fma.f6486.2

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

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

      \[\leadsto \frac{x}{\color{blue}{\frac{{z}^{3}}{y}}} \]
    6. Step-by-step derivation
      1. cube-multN/A

        \[\leadsto \frac{x}{\frac{\color{blue}{z \cdot \left(z \cdot z\right)}}{y}} \]
      2. unpow2N/A

        \[\leadsto \frac{x}{\frac{z \cdot \color{blue}{{z}^{2}}}{y}} \]
      3. associate-/l*N/A

        \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{{z}^{2}}{y}}} \]
      4. *-lft-identityN/A

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{1 \cdot {z}^{2}}}{y}} \]
      5. associate-*l/N/A

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\frac{1}{y} \cdot {z}^{2}\right)}} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(\frac{1}{y} \cdot {z}^{2}\right)}} \]
      7. associate-*l/N/A

        \[\leadsto \frac{x}{z \cdot \color{blue}{\frac{1 \cdot {z}^{2}}{y}}} \]
      8. *-lft-identityN/A

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{{z}^{2}}}{y}} \]
      9. /-lowering-/.f64N/A

        \[\leadsto \frac{x}{z \cdot \color{blue}{\frac{{z}^{2}}{y}}} \]
      10. unpow2N/A

        \[\leadsto \frac{x}{z \cdot \frac{\color{blue}{z \cdot z}}{y}} \]
      11. *-lowering-*.f6488.2

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

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

    if -4.00000000000000019e57 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

    1. Initial program 80.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot \left(z + 1\right)}}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot \left(z + 1\right)}}{z}} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{z \cdot \left(z + 1\right)}}}{z} \]
      7. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z \cdot 1}}}{z} \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{y \cdot \frac{x}{z \cdot z + \color{blue}{z}}}{z} \]
      10. accelerator-lowering-fma.f6495.5

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -4 \cdot 10^{+57}:\\ \;\;\;\;\frac{x}{z \cdot \frac{z \cdot z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 86.6% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -4 \cdot 10^{+57}:\\ \;\;\;\;x\_m \cdot \frac{y\_m}{z \cdot \left(z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;y\_m \cdot \frac{x\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= (* (+ z 1.0) (* z z)) -4e+57)
     (* x_m (/ y_m (* z (* z z))))
     (* y_m (/ x_m (* z (fma z z z))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (((z + 1.0) * (z * z)) <= -4e+57) {
		tmp = x_m * (y_m / (z * (z * z)));
	} else {
		tmp = y_m * (x_m / (z * fma(z, z, z)));
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (Float64(Float64(z + 1.0) * Float64(z * z)) <= -4e+57)
		tmp = Float64(x_m * Float64(y_m / Float64(z * Float64(z * z))));
	else
		tmp = Float64(y_m * Float64(x_m / Float64(z * fma(z, z, z))));
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision], -4e+57], N[(x$95$m * N[(y$95$m / N[(z * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(x$95$m / N[(z * N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -4 \cdot 10^{+57}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{z \cdot \left(z \cdot z\right)}\\

\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{x\_m}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < -4.00000000000000019e57

    1. Initial program 82.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{3}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{3}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{3}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{3}}} \]
      4. cube-multN/A

        \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
      5. unpow2N/A

        \[\leadsto x \cdot \frac{y}{z \cdot \color{blue}{{z}^{2}}} \]
      6. *-lowering-*.f64N/A

        \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot {z}^{2}}} \]
      7. unpow2N/A

        \[\leadsto x \cdot \frac{y}{z \cdot \color{blue}{\left(z \cdot z\right)}} \]
      8. *-lowering-*.f6486.2

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

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

    if -4.00000000000000019e57 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64)))

    1. Initial program 80.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \cdot y} \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(z \cdot \left(z + 1\right)\right)}} \cdot y \]
      7. *-lowering-*.f64N/A

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

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(z \cdot z + z \cdot 1\right)}} \cdot y \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{x}{z \cdot \left(z \cdot z + \color{blue}{z}\right)} \cdot y \]
      10. accelerator-lowering-fma.f6481.9

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

      \[\leadsto \color{blue}{\frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)} \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq -4 \cdot 10^{+57}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot \left(z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot \mathsf{fma}\left(z, z, z\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 95.8% accurate, 0.7× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+18}:\\ \;\;\;\;\frac{x\_m}{z \cdot \left(z \cdot \frac{z}{y\_m}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y\_m \cdot \frac{x\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \end{array}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (*
  y_s
  (*
   x_s
   (if (<= z -1e+18)
     (/ x_m (* z (* z (/ z y_m))))
     (/ (* y_m (/ x_m (fma z z z))) z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double tmp;
	if (z <= -1e+18) {
		tmp = x_m / (z * (z * (z / y_m)));
	} else {
		tmp = (y_m * (x_m / fma(z, z, z))) / z;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	tmp = 0.0
	if (z <= -1e+18)
		tmp = Float64(x_m / Float64(z * Float64(z * Float64(z / y_m))));
	else
		tmp = Float64(Float64(y_m * Float64(x_m / fma(z, z, z))) / z);
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1e+18], N[(x$95$m / N[(z * N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * N[(x$95$m / N[(z * z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+18}:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(z \cdot \frac{z}{y\_m}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{x\_m}{\mathsf{fma}\left(z, z, z\right)}}{z}\\


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

    1. Initial program 82.8%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \frac{x \cdot y}{\color{blue}{{z}^{3}}} \]
    4. Step-by-step derivation
      1. cube-multN/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{x \cdot y}{z \cdot \color{blue}{{z}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot {z}^{2}}} \]
      4. unpow2N/A

        \[\leadsto \frac{x \cdot y}{z \cdot \color{blue}{\left(z \cdot z\right)}} \]
      5. *-lowering-*.f6482.8

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
    6. Step-by-step derivation
      1. associate-/l/N/A

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

        \[\leadsto \frac{\color{blue}{x \cdot \frac{y}{z \cdot z}}}{z} \]
      3. clear-numN/A

        \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{z \cdot z}{y}}}}{z} \]
      4. un-div-invN/A

        \[\leadsto \frac{\color{blue}{\frac{x}{\frac{z \cdot z}{y}}}}{z} \]
      5. frac-2negN/A

        \[\leadsto \frac{\color{blue}{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\frac{z \cdot z}{y}\right)}}}{z} \]
      6. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{z \cdot \left(\mathsf{neg}\left(\frac{z \cdot z}{y}\right)\right)}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{z \cdot \left(\mathsf{neg}\left(\frac{z \cdot z}{y}\right)\right)}} \]
      8. neg-lowering-neg.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{z \cdot \left(\mathsf{neg}\left(\frac{z \cdot z}{y}\right)\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{\color{blue}{z \cdot \left(\mathsf{neg}\left(\frac{z \cdot z}{y}\right)\right)}} \]
      10. associate-/l*N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \left(\mathsf{neg}\left(\color{blue}{z \cdot \frac{z}{y}}\right)\right)} \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \color{blue}{\left(z \cdot \left(\mathsf{neg}\left(\frac{z}{y}\right)\right)\right)}} \]
      12. *-lowering-*.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \color{blue}{\left(z \cdot \left(\mathsf{neg}\left(\frac{z}{y}\right)\right)\right)}} \]
      13. distribute-neg-frac2N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \left(z \cdot \color{blue}{\frac{z}{\mathsf{neg}\left(y\right)}}\right)} \]
      14. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \left(z \cdot \color{blue}{\frac{z}{\mathsf{neg}\left(y\right)}}\right)} \]
      15. neg-lowering-neg.f6489.7

        \[\leadsto \frac{-x}{z \cdot \left(z \cdot \frac{z}{\color{blue}{-y}}\right)} \]
    7. Applied egg-rr89.7%

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

    if -1e18 < z

    1. Initial program 80.3%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot \left(z + 1\right)}}{z}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z \cdot \left(z + 1\right)}}{z}} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{z \cdot \left(z + 1\right)}}}{z} \]
      7. /-lowering-/.f64N/A

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

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{z \cdot z + z \cdot 1}}}{z} \]
      9. *-rgt-identityN/A

        \[\leadsto \frac{y \cdot \frac{x}{z \cdot z + \color{blue}{z}}}{z} \]
      10. accelerator-lowering-fma.f6495.5

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+18}:\\ \;\;\;\;\frac{x}{z \cdot \left(z \cdot \frac{z}{y}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 86.4% accurate, 0.8× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ \begin{array}{l} t_0 := x\_m \cdot \frac{y\_m}{z \cdot \left(z \cdot z\right)}\\ y\_s \cdot \left(x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -64:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y\_m \cdot \frac{x\_m}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array}\right) \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (let* ((t_0 (* x_m (/ y_m (* z (* z z))))))
   (*
    y_s
    (*
     x_s
     (if (<= z -64.0) t_0 (if (<= z 1.0) (* y_m (/ x_m (* z z))) t_0))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = x_m * (y_m / (z * (z * z)));
	double tmp;
	if (z <= -64.0) {
		tmp = t_0;
	} else if (z <= 1.0) {
		tmp = y_m * (x_m / (z * z));
	} else {
		tmp = t_0;
	}
	return y_s * (x_s * tmp);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x_m * (y_m / (z * (z * z)))
    if (z <= (-64.0d0)) then
        tmp = t_0
    else if (z <= 1.0d0) then
        tmp = y_m * (x_m / (z * z))
    else
        tmp = t_0
    end if
    code = y_s * (x_s * tmp)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	double t_0 = x_m * (y_m / (z * (z * z)));
	double tmp;
	if (z <= -64.0) {
		tmp = t_0;
	} else if (z <= 1.0) {
		tmp = y_m * (x_m / (z * z));
	} else {
		tmp = t_0;
	}
	return y_s * (x_s * tmp);
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	t_0 = x_m * (y_m / (z * (z * z)))
	tmp = 0
	if z <= -64.0:
		tmp = t_0
	elif z <= 1.0:
		tmp = y_m * (x_m / (z * z))
	else:
		tmp = t_0
	return y_s * (x_s * tmp)
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	t_0 = Float64(x_m * Float64(y_m / Float64(z * Float64(z * z))))
	tmp = 0.0
	if (z <= -64.0)
		tmp = t_0;
	elseif (z <= 1.0)
		tmp = Float64(y_m * Float64(x_m / Float64(z * z)));
	else
		tmp = t_0;
	end
	return Float64(y_s * Float64(x_s * tmp))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
	t_0 = x_m * (y_m / (z * (z * z)));
	tmp = 0.0;
	if (z <= -64.0)
		tmp = t_0;
	elseif (z <= 1.0)
		tmp = y_m * (x_m / (z * z));
	else
		tmp = t_0;
	end
	tmp_2 = y_s * (x_s * tmp);
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(x$95$m * N[(y$95$m / N[(z * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[z, -64.0], t$95$0, If[LessEqual[z, 1.0], N[(y$95$m * N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := x\_m \cdot \frac{y\_m}{z \cdot \left(z \cdot z\right)}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -64:\\
\;\;\;\;t\_0\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 82.6%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{3}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{3}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{3}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{3}}} \]
      4. cube-multN/A

        \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot \left(z \cdot z\right)}} \]
      5. unpow2N/A

        \[\leadsto x \cdot \frac{y}{z \cdot \color{blue}{{z}^{2}}} \]
      6. *-lowering-*.f64N/A

        \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot {z}^{2}}} \]
      7. unpow2N/A

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

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

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

    if -64 < z < 1

    1. Initial program 79.2%

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{2}}} \]
      4. unpow2N/A

        \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot z}} \]
      5. *-lowering-*.f6476.3

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z \cdot z}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z \cdot z}{y}}} \]
      2. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{z \cdot z}{y}}} \]
      3. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot y} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot y} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{z \cdot z}} \cdot y \]
      6. *-lowering-*.f6476.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -64:\\ \;\;\;\;x \cdot \frac{y}{z \cdot \left(z \cdot z\right)}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y \cdot \frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z \cdot \left(z \cdot z\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 75.7% accurate, 1.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \left(y\_m \cdot \frac{x\_m}{z \cdot z}\right)\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (* y_m (/ x_m (* z z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (y_m * (x_m / (z * z))));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * (x_s * (y_m * (x_m / (z * z))))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (y_m * (x_m / (z * z))));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * (y_m * (x_m / (z * z))))
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(y_m * Float64(x_m / Float64(z * z)))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * (y_m * (x_m / (z * z))));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(y$95$m * N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \left(y\_m \cdot \frac{x\_m}{z \cdot z}\right)\right)
\end{array}
Derivation
  1. Initial program 80.9%

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0

    \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}}} \]
  4. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
    3. /-lowering-/.f64N/A

      \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{2}}} \]
    4. unpow2N/A

      \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot z}} \]
    5. *-lowering-*.f6471.4

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

    \[\leadsto \color{blue}{x \cdot \frac{y}{z \cdot z}} \]
  6. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z \cdot z}{y}}} \]
    2. un-div-invN/A

      \[\leadsto \color{blue}{\frac{x}{\frac{z \cdot z}{y}}} \]
    3. associate-/r/N/A

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot y} \]
    4. *-lowering-*.f64N/A

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot y} \]
    5. /-lowering-/.f64N/A

      \[\leadsto \color{blue}{\frac{x}{z \cdot z}} \cdot y \]
    6. *-lowering-*.f6470.6

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

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

    \[\leadsto y \cdot \frac{x}{z \cdot z} \]
  9. Add Preprocessing

Alternative 14: 69.9% accurate, 1.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ y\_m = \left|y\right| \\ y\_s = \mathsf{copysign}\left(1, y\right) \\ [x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\ \\ y\_s \cdot \left(x\_s \cdot \left(x\_m \cdot \frac{y\_m}{z \cdot z}\right)\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
 :precision binary64
 (* y_s (* x_s (* x_m (/ y_m (* z z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
y\_m = fabs(y);
y\_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (x_m * (y_m / (z * z))));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    code = y_s * (x_s * (x_m * (y_m / (z * z))))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
	return y_s * (x_s * (x_m * (y_m / (z * z))));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
y\_m = math.fabs(y)
y\_s = math.copysign(1.0, y)
[x_m, y_m, z] = sort([x_m, y_m, z])
def code(y_s, x_s, x_m, y_m, z):
	return y_s * (x_s * (x_m * (y_m / (z * z))))
x\_m = abs(x)
x\_s = copysign(1.0, x)
y\_m = abs(y)
y\_s = copysign(1.0, y)
x_m, y_m, z = sort([x_m, y_m, z])
function code(y_s, x_s, x_m, y_m, z)
	return Float64(y_s * Float64(x_s * Float64(x_m * Float64(y_m / Float64(z * z)))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
y\_m = abs(y);
y\_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
	tmp = y_s * (x_s * (x_m * (y_m / (z * z))));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(x$95$m * N[(y$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \left(x\_m \cdot \frac{y\_m}{z \cdot z}\right)\right)
\end{array}
Derivation
  1. Initial program 80.9%

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0

    \[\leadsto \color{blue}{\frac{x \cdot y}{{z}^{2}}} \]
  4. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \color{blue}{x \cdot \frac{y}{{z}^{2}}} \]
    3. /-lowering-/.f64N/A

      \[\leadsto x \cdot \color{blue}{\frac{y}{{z}^{2}}} \]
    4. unpow2N/A

      \[\leadsto x \cdot \frac{y}{\color{blue}{z \cdot z}} \]
    5. *-lowering-*.f6471.4

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

    \[\leadsto \color{blue}{x \cdot \frac{y}{z \cdot z}} \]
  6. Add Preprocessing

Developer Target 1: 96.9% accurate, 0.6× 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 2024199 
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< z 2496182814532307/10000000000000) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1 z)) x) z)))

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