Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2

Percentage Accurate: 89.7% → 99.6%
Time: 12.3s
Alternatives: 10
Speedup: 0.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 89.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\ \\ \begin{array}{l} t_0 := y \cdot \left(1 + z\_m \cdot z\_m\right)\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\ \;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt{\frac{1}{y}}}{z\_m}}{x\_m \cdot \left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\_m\right)\right)}\\ \end{array} \end{array} \end{array} \]
z_m = (fabs.f64 z)
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z_m)
 :precision binary64
 (let* ((t_0 (* y (+ 1.0 (* z_m z_m)))))
   (*
    x_s
    (if (<= t_0 5e+307)
      (/ (/ 1.0 x_m) t_0)
      (/ (/ (sqrt (/ 1.0 y)) z_m) (* x_m (* (sqrt y) (hypot 1.0 z_m))))))))
z_m = fabs(z);
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z_m);
double code(double x_s, double x_m, double y, double z_m) {
	double t_0 = y * (1.0 + (z_m * z_m));
	double tmp;
	if (t_0 <= 5e+307) {
		tmp = (1.0 / x_m) / t_0;
	} else {
		tmp = (sqrt((1.0 / y)) / z_m) / (x_m * (sqrt(y) * hypot(1.0, z_m)));
	}
	return x_s * tmp;
}
z_m = Math.abs(z);
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z_m;
public static double code(double x_s, double x_m, double y, double z_m) {
	double t_0 = y * (1.0 + (z_m * z_m));
	double tmp;
	if (t_0 <= 5e+307) {
		tmp = (1.0 / x_m) / t_0;
	} else {
		tmp = (Math.sqrt((1.0 / y)) / z_m) / (x_m * (Math.sqrt(y) * Math.hypot(1.0, z_m)));
	}
	return x_s * tmp;
}
z_m = math.fabs(z)
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z_m] = sort([x_m, y, z_m])
def code(x_s, x_m, y, z_m):
	t_0 = y * (1.0 + (z_m * z_m))
	tmp = 0
	if t_0 <= 5e+307:
		tmp = (1.0 / x_m) / t_0
	else:
		tmp = (math.sqrt((1.0 / y)) / z_m) / (x_m * (math.sqrt(y) * math.hypot(1.0, z_m)))
	return x_s * tmp
z_m = abs(z)
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z_m = sort([x_m, y, z_m])
function code(x_s, x_m, y, z_m)
	t_0 = Float64(y * Float64(1.0 + Float64(z_m * z_m)))
	tmp = 0.0
	if (t_0 <= 5e+307)
		tmp = Float64(Float64(1.0 / x_m) / t_0);
	else
		tmp = Float64(Float64(sqrt(Float64(1.0 / y)) / z_m) / Float64(x_m * Float64(sqrt(y) * hypot(1.0, z_m))));
	end
	return Float64(x_s * tmp)
end
z_m = abs(z);
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z_m = num2cell(sort([x_m, y, z_m])){:}
function tmp_2 = code(x_s, x_m, y, z_m)
	t_0 = y * (1.0 + (z_m * z_m));
	tmp = 0.0;
	if (t_0 <= 5e+307)
		tmp = (1.0 / x_m) / t_0;
	else
		tmp = (sqrt((1.0 / y)) / z_m) / (x_m * (sqrt(y) * hypot(1.0, z_m)));
	end
	tmp_2 = x_s * tmp;
end
z_m = N[Abs[z], $MachinePrecision]
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z_m should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z$95$m_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 5e+307], N[(N[(1.0 / x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] / z$95$m), $MachinePrecision] / N[(x$95$m * N[(N[Sqrt[y], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + z$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z_m] = \mathsf{sort}([x_m, y, z_m])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z\_m \cdot z\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{\frac{1}{x\_m}}{t\_0}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307

    1. Initial program 94.3%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing

    if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      14. *-commutative61.4%

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + z \cdot z}} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      18. hypot-1-def61.4%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      19. +-commutative61.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \]
    6. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}} \]
    7. Step-by-step derivation
      1. associate-/l/99.5%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      2. associate-*r/99.5%

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      5. associate-/r*99.5%

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

        \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\color{blue}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    8. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    9. Taylor expanded in z around inf 81.5%

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

        \[\leadsto \frac{\color{blue}{\frac{\sqrt{\frac{1}{y}} \cdot 1}{z}}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)} \]
      2. *-rgt-identity81.6%

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{\frac{1}{y}}}}{z}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)} \]
    11. Simplified81.6%

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

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

Alternative 2: 99.4% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
    14. *-commutative43.4%

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

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

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

      \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + z \cdot z}} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
    18. hypot-1-def43.4%

      \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
    19. +-commutative43.4%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \]
  6. Applied egg-rr48.9%

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}} \]
  7. Step-by-step derivation
    1. associate-/l/48.9%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
    2. associate-*r/48.9%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot 1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
    3. *-rgt-identity48.9%

      \[\leadsto \frac{\color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
    4. *-commutative48.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
    5. associate-/r*48.9%

      \[\leadsto \frac{\color{blue}{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
    6. *-commutative48.9%

      \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\color{blue}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
  8. Simplified48.9%

    \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
  9. Final simplification48.9%

    \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)\right)} \]
  10. Add Preprocessing

Alternative 3: 99.3% accurate, 0.0× speedup?

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307

    1. Initial program 94.3%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing

    if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      14. *-commutative61.4%

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + z \cdot z}} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      18. hypot-1-def61.4%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      19. +-commutative61.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \]
    6. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}} \]
    7. Step-by-step derivation
      1. associate-/l/99.5%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      2. associate-*r/99.5%

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      5. associate-/r*99.5%

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

        \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\color{blue}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    8. Simplified99.5%

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

      \[\leadsto \color{blue}{1 \cdot \frac{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}^{-2}}{x}} \]
    10. Step-by-step derivation
      1. *-lft-identity72.4%

        \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}^{-2}}{x}} \]
      2. *-commutative72.4%

        \[\leadsto \frac{{\color{blue}{\left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)\right)}}^{-2}}{x} \]
    11. Simplified72.4%

      \[\leadsto \color{blue}{\frac{{\left(\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)\right)}^{-2}}{x}} \]
    12. Taylor expanded in z around inf 72.4%

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

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

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

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

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

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

        \[\leadsto \frac{1}{z \cdot \sqrt{y}} \cdot \frac{{\left(\sqrt{y} \cdot z\right)}^{\color{blue}{-1}}}{x} \]
      7. unpow-199.4%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x} \cdot 1}{z \cdot \sqrt{y}}}}{z \cdot \sqrt{y}} \]
      5. *-rgt-identity99.6%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{1}{z \cdot x}}}{\sqrt{y}}}{z \cdot \sqrt{y}} \]
    16. Simplified99.5%

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

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

Alternative 4: 97.8% accurate, 0.1× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 4e303

    1. Initial program 95.7%

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

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

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

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

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

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

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

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

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

    if 4e303 < (*.f64 z z)

    1. Initial program 70.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      14. *-commutative28.7%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      15. sqrt-prod28.7%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{y}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      16. fma-undefine28.7%

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      19. +-commutative28.7%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \]
    6. Applied egg-rr44.1%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}} \]
    7. Step-by-step derivation
      1. associate-/l/44.1%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      2. associate-*r/44.1%

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

        \[\leadsto \frac{\color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      4. *-commutative44.1%

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      5. associate-/r*44.1%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      6. *-commutative44.1%

        \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\color{blue}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    8. Simplified44.1%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    9. Taylor expanded in z around inf 70.0%

      \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot {z}^{2}\right)}} \]
    10. Step-by-step derivation
      1. associate-*r*69.3%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{x}}}{{z}^{2}} \]
      5. associate-/l/70.0%

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

        \[\leadsto \frac{\frac{1}{y}}{\color{blue}{x \cdot {z}^{2}}} \]
    11. Simplified70.0%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{x}}{{z}^{2}}} \]
      2. div-inv69.1%

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

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

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

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

Alternative 5: 98.0% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z))) < 5e307

    1. Initial program 94.3%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Add Preprocessing

    if 5e307 < (*.f64 y (+.f64 #s(literal 1 binary64) (*.f64 z z)))

    1. Initial program 61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      14. *-commutative61.4%

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + z \cdot z}} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      18. hypot-1-def61.4%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      19. +-commutative61.4%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \]
    6. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}} \]
    7. Step-by-step derivation
      1. associate-/l/99.5%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      2. associate-*r/99.5%

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

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

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      5. associate-/r*99.5%

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

        \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\color{blue}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    8. Simplified99.5%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    9. Taylor expanded in z around inf 61.4%

      \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot {z}^{2}\right)}} \]
    10. Step-by-step derivation
      1. associate-*r*73.4%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{x}}}{{z}^{2}} \]
      5. associate-/l/74.3%

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

        \[\leadsto \frac{\frac{1}{y}}{\color{blue}{x \cdot {z}^{2}}} \]
    11. Simplified74.3%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{x}}{{z}^{2}}} \]
      2. div-inv73.2%

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

        \[\leadsto \frac{\frac{1}{y} \cdot \frac{1}{x}}{\color{blue}{z \cdot z}} \]
      4. times-frac99.0%

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

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

Alternative 6: 97.1% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 3.99999999999999982e-6

    1. Initial program 99.7%

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

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

    if 3.99999999999999982e-6 < (*.f64 z z)

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      14. *-commutative37.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      15. sqrt-prod37.0%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{y}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      16. fma-undefine37.0%

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + z \cdot z}} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      18. hypot-1-def37.0%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      19. +-commutative37.0%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \]
    6. Applied egg-rr47.8%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}} \]
    7. Step-by-step derivation
      1. associate-/l/47.8%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      2. associate-*r/47.8%

        \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot 1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      3. *-rgt-identity47.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      4. *-commutative47.8%

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      5. associate-/r*47.8%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      6. *-commutative47.8%

        \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\color{blue}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    8. Simplified47.8%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    9. Taylor expanded in z around inf 79.9%

      \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot {z}^{2}\right)}} \]
    10. Step-by-step derivation
      1. associate-*r*83.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{x}}}{{z}^{2}} \]
      5. associate-/l/80.0%

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

        \[\leadsto \frac{\frac{1}{y}}{\color{blue}{x \cdot {z}^{2}}} \]
    11. Simplified80.0%

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{1}{y}}{x}}{{z}^{2}}} \]
      2. div-inv83.2%

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

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

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

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

Alternative 7: 94.1% accurate, 0.7× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 3.99999999999999982e-6

    1. Initial program 99.7%

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

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

    if 3.99999999999999982e-6 < (*.f64 z z)

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{\color{blue}{1}}{\sqrt{y \cdot \left(x \cdot {z}^{2}\right)}}\right)}^{2} \]
      5. associate-*r*43.6%

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

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

        \[\leadsto {\left(\frac{1}{\color{blue}{\sqrt{x \cdot y} \cdot \sqrt{{z}^{2}}}}\right)}^{2} \]
      8. *-commutative43.6%

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

        \[\leadsto {\left(\frac{1}{\sqrt{y \cdot x} \cdot \color{blue}{{z}^{\left(\frac{2}{2}\right)}}}\right)}^{2} \]
      10. metadata-eval46.8%

        \[\leadsto {\left(\frac{1}{\sqrt{y \cdot x} \cdot {z}^{\color{blue}{1}}}\right)}^{2} \]
      11. pow146.8%

        \[\leadsto {\left(\frac{1}{\sqrt{y \cdot x} \cdot \color{blue}{z}}\right)}^{2} \]
    7. Applied egg-rr46.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{x}}}{{z}^{2}} \]
      12. unpow283.2%

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

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

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

Alternative 8: 91.0% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.7%

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

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

    if 1 < (*.f64 z z)

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{y \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      14. *-commutative37.0%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      15. sqrt-prod37.0%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{y}}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      16. fma-undefine37.0%

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{1 + z \cdot z}} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      18. hypot-1-def37.0%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \left(1 + z \cdot z\right)}} \]
      19. +-commutative37.0%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\sqrt{y \cdot \color{blue}{\left(z \cdot z + 1\right)}}} \]
    6. Applied egg-rr47.8%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}} \]
    7. Step-by-step derivation
      1. associate-/l/47.8%

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot \color{blue}{\frac{1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      2. associate-*r/47.8%

        \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}} \cdot 1}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x}} \]
      3. *-rgt-identity47.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      4. *-commutative47.8%

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{y} \cdot \mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      5. associate-/r*47.8%

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}}{\left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right) \cdot x} \]
      6. *-commutative47.8%

        \[\leadsto \frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{\color{blue}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    8. Simplified47.8%

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\right)}} \]
    9. Taylor expanded in z around inf 79.9%

      \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y \cdot {z}^{2}\right)}} \]
    10. Step-by-step derivation
      1. associate-*r*83.8%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{y}}{x}}}{{z}^{2}} \]
      5. associate-/l/80.0%

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

        \[\leadsto \frac{\frac{1}{y}}{\color{blue}{x \cdot {z}^{2}}} \]
    11. Simplified80.0%

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

        \[\leadsto \frac{\frac{1}{y}}{x \cdot \color{blue}{\left(z \cdot z\right)}} \]
    13. Applied egg-rr80.0%

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

Alternative 9: 90.8% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.7%

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

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

    if 1 < (*.f64 z z)

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 58.4% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

Developer Target 1: 92.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + z \cdot z\\ t_1 := y \cdot t\_0\\ t_2 := \frac{\frac{1}{y}}{t\_0 \cdot x}\\ \mathbf{if}\;t\_1 < -\infty:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 < 8.680743250567252 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1}{x}}{t\_0 \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* z z))) (t_1 (* y t_0)) (t_2 (/ (/ 1.0 y) (* t_0 x))))
   (if (< t_1 (- INFINITY))
     t_2
     (if (< t_1 8.680743250567252e+305) (/ (/ 1.0 x) (* t_0 y)) t_2))))
double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * z);
	double t_1 = y * t_0;
	double t_2 = (1.0 / y) / (t_0 * x);
	double tmp;
	if (t_1 < -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_1 < 8.680743250567252e+305) {
		tmp = (1.0 / x) / (t_0 * y);
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	double t_0 = 1.0 + (z * z);
	double t_1 = y * t_0;
	double t_2 = (1.0 / y) / (t_0 * x);
	double tmp;
	if (t_1 < -Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else if (t_1 < 8.680743250567252e+305) {
		tmp = (1.0 / x) / (t_0 * y);
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 + (z * z)
	t_1 = y * t_0
	t_2 = (1.0 / y) / (t_0 * x)
	tmp = 0
	if t_1 < -math.inf:
		tmp = t_2
	elif t_1 < 8.680743250567252e+305:
		tmp = (1.0 / x) / (t_0 * y)
	else:
		tmp = t_2
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 + Float64(z * z))
	t_1 = Float64(y * t_0)
	t_2 = Float64(Float64(1.0 / y) / Float64(t_0 * x))
	tmp = 0.0
	if (t_1 < Float64(-Inf))
		tmp = t_2;
	elseif (t_1 < 8.680743250567252e+305)
		tmp = Float64(Float64(1.0 / x) / Float64(t_0 * y));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 + (z * z);
	t_1 = y * t_0;
	t_2 = (1.0 / y) / (t_0 * x);
	tmp = 0.0;
	if (t_1 < -Inf)
		tmp = t_2;
	elseif (t_1 < 8.680743250567252e+305)
		tmp = (1.0 / x) / (t_0 * y);
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, (-Infinity)], t$95$2, If[Less[t$95$1, 8.680743250567252e+305], N[(N[(1.0 / x), $MachinePrecision] / N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + z \cdot z\\
t_1 := y \cdot t\_0\\
t_2 := \frac{\frac{1}{y}}{t\_0 \cdot x}\\
\mathbf{if}\;t\_1 < -\infty:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 < 8.680743250567252 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t\_0 \cdot y}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024118 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (* y (+ 1 (* z z))) -inf.0) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 868074325056725200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x)))))

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