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

Percentage Accurate: 89.8% → 99.4%
Time: 13.3s
Alternatives: 11
Speedup: 0.5×

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 11 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.8% 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.4% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\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.5%

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

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

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

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

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

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

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

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

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

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.2%

    \[\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-*r/48.2%

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\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.5%

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

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

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

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

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

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

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

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

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

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.2%

    \[\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.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/48.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-identity48.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. *-commutative48.1%

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

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

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

Alternative 3: 50.0% accurate, 0.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\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.5%

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

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

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

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

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

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

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

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

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

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.8%

      \[\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.2%

    \[\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-*r/48.2%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{{y}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\sqrt{x}} \cdot \frac{\frac{{y}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\sqrt{x}}} \]
  10. Step-by-step derivation
    1. unpow223.6%

      \[\leadsto \color{blue}{{\left(\frac{\frac{{y}^{-0.5}}{\mathsf{hypot}\left(1, z\right)}}{\sqrt{x}}\right)}^{2}} \]
    2. associate-/l/23.6%

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

    \[\leadsto \color{blue}{{\left(\frac{{y}^{-0.5}}{\sqrt{x} \cdot \mathsf{hypot}\left(1, z\right)}\right)}^{2}} \]
  12. Final simplification23.6%

    \[\leadsto {\left(\frac{{y}^{-0.5}}{\mathsf{hypot}\left(1, z\right) \cdot \sqrt{x}}\right)}^{2} \]
  13. Add Preprocessing

Alternative 4: 94.0% accurate, 0.1× speedup?

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

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

      \[\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. *-commutative96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999981e295 < (*.f64 z z)

    1. Initial program 73.6%

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

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

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

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

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

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

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

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

      \[\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.0%

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

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

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

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

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

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

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

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

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

        \[\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-frac44.2%

        \[\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. +-commutative44.2%

        \[\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-undefine44.2%

        \[\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. *-commutative44.2%

        \[\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-prod44.2%

        \[\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-undefine44.2%

        \[\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. +-commutative44.2%

        \[\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-def44.2%

        \[\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. +-commutative44.2%

        \[\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-rr57.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-*r/57.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{{y}^{0.5}}} \cdot \frac{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x}}{z} \]
      4. pow-flip47.0%

        \[\leadsto \color{blue}{{y}^{\left(-0.5\right)}} \cdot \frac{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x}}{z} \]
      5. metadata-eval47.0%

        \[\leadsto {y}^{\color{blue}{-0.5}} \cdot \frac{\frac{\frac{\frac{1}{\sqrt{y}}}{\mathsf{hypot}\left(1, z\right)}}{x}}{z} \]
      6. associate-/l/47.0%

        \[\leadsto {y}^{-0.5} \cdot \frac{\color{blue}{\frac{\frac{1}{\sqrt{y}}}{x \cdot \mathsf{hypot}\left(1, z\right)}}}{z} \]
      7. pow1/247.0%

        \[\leadsto {y}^{-0.5} \cdot \frac{\frac{\frac{1}{\color{blue}{{y}^{0.5}}}}{x \cdot \mathsf{hypot}\left(1, z\right)}}{z} \]
      8. pow-flip47.0%

        \[\leadsto {y}^{-0.5} \cdot \frac{\frac{\color{blue}{{y}^{\left(-0.5\right)}}}{x \cdot \mathsf{hypot}\left(1, z\right)}}{z} \]
      9. metadata-eval47.0%

        \[\leadsto {y}^{-0.5} \cdot \frac{\frac{{y}^{\color{blue}{-0.5}}}{x \cdot \mathsf{hypot}\left(1, z\right)}}{z} \]
    11. Applied egg-rr47.0%

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

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

        \[\leadsto \color{blue}{\frac{{y}^{-0.5} \cdot {y}^{-0.5}}{z \cdot \left(x \cdot \mathsf{hypot}\left(1, z\right)\right)}} \]
      3. pow-sqr77.9%

        \[\leadsto \frac{\color{blue}{{y}^{\left(2 \cdot -0.5\right)}}}{z \cdot \left(x \cdot \mathsf{hypot}\left(1, z\right)\right)} \]
      4. metadata-eval77.9%

        \[\leadsto \frac{{y}^{\color{blue}{-1}}}{z \cdot \left(x \cdot \mathsf{hypot}\left(1, z\right)\right)} \]
    13. Simplified77.9%

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

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

Alternative 5: 96.5% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

    \[\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. *-commutative91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{1 + {z}^{2}}} \cdot \frac{\frac{1}{x}}{y} \]
    6. add-sqr-sqrt91.7%

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

      \[\leadsto \frac{1}{\sqrt{\color{blue}{1 \cdot 1} + {z}^{2}} \cdot \sqrt{1 + {z}^{2}}} \cdot \frac{\frac{1}{x}}{y} \]
    8. unpow291.7%

      \[\leadsto \frac{1}{\sqrt{1 \cdot 1 + \color{blue}{z \cdot z}} \cdot \sqrt{1 + {z}^{2}}} \cdot \frac{\frac{1}{x}}{y} \]
    9. hypot-undefine91.7%

      \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(1, z\right)} \cdot \sqrt{1 + {z}^{2}}} \cdot \frac{\frac{1}{x}}{y} \]
    10. metadata-eval91.7%

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \color{blue}{\mathsf{hypot}\left(1, z\right)}} \cdot \frac{\frac{1}{x}}{y} \]
    13. pow291.7%

      \[\leadsto \frac{1}{\color{blue}{{\left(\mathsf{hypot}\left(1, z\right)\right)}^{2}}} \cdot \frac{\frac{1}{x}}{y} \]
    14. times-frac91.5%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{x}}{{\left(\mathsf{hypot}\left(1, z\right)\right)}^{2} \cdot y}} \]
    15. pow291.5%

      \[\leadsto \frac{1 \cdot \frac{1}{x}}{\color{blue}{\left(\mathsf{hypot}\left(1, z\right) \cdot \mathsf{hypot}\left(1, z\right)\right)} \cdot y} \]
    16. add-sqr-sqrt43.8%

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

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

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

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

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

Alternative 6: 96.8% accurate, 0.1× speedup?

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

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


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

    1. Initial program 97.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
    3. Simplified98.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. *-commutative98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999992e217 < (*.f64 z z)

    1. Initial program 77.5%

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

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

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

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

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

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

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

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

      \[\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*75.7%

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

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

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

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

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

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

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

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

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

        \[\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-frac42.9%

        \[\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. +-commutative42.9%

        \[\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-undefine42.9%

        \[\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. *-commutative42.9%

        \[\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-prod42.9%

        \[\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-undefine42.9%

        \[\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. +-commutative42.9%

        \[\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-def42.9%

        \[\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. +-commutative42.9%

        \[\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-rr54.6%

      \[\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-*r/54.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{\frac{-1}{y \cdot x}}{{z}^{2}}} \]
      6. metadata-eval75.7%

        \[\leadsto -1 \cdot \frac{\frac{\color{blue}{-1}}{y \cdot x}}{{z}^{2}} \]
      7. distribute-neg-frac75.7%

        \[\leadsto -1 \cdot \frac{\color{blue}{-\frac{1}{y \cdot x}}}{{z}^{2}} \]
      8. distribute-frac-neg275.7%

        \[\leadsto -1 \cdot \frac{\color{blue}{\frac{1}{-y \cdot x}}}{{z}^{2}} \]
      9. distribute-rgt-neg-out75.7%

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

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

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

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

        \[\leadsto \frac{\frac{-1}{\color{blue}{-y \cdot x}} \cdot 1}{{z}^{2}} \]
      14. distribute-neg-frac275.7%

        \[\leadsto \frac{\color{blue}{\left(-\frac{-1}{y \cdot x}\right)} \cdot 1}{{z}^{2}} \]
      15. distribute-neg-frac75.7%

        \[\leadsto \frac{\color{blue}{\frac{--1}{y \cdot x}} \cdot 1}{{z}^{2}} \]
      16. metadata-eval75.7%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{{z}^{2}}}}{y} \]
      2. *-un-lft-identity75.0%

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

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

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

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

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

Alternative 7: 97.7% accurate, 0.5× speedup?

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


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

    1. Initial program 95.2%

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

    if 5e307 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 72.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
    3. Simplified79.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*78.5%

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

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

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

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

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

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

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

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

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

        \[\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-frac72.1%

        \[\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. +-commutative72.1%

        \[\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-undefine72.1%

        \[\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. *-commutative72.1%

        \[\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-prod72.1%

        \[\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-undefine72.1%

        \[\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. +-commutative72.1%

        \[\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-def72.1%

        \[\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. +-commutative72.1%

        \[\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.6%

      \[\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-*r/99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{\frac{-1}{y \cdot x}}{{z}^{2}}} \]
      6. metadata-eval78.5%

        \[\leadsto -1 \cdot \frac{\frac{\color{blue}{-1}}{y \cdot x}}{{z}^{2}} \]
      7. distribute-neg-frac78.5%

        \[\leadsto -1 \cdot \frac{\color{blue}{-\frac{1}{y \cdot x}}}{{z}^{2}} \]
      8. distribute-frac-neg278.5%

        \[\leadsto -1 \cdot \frac{\color{blue}{\frac{1}{-y \cdot x}}}{{z}^{2}} \]
      9. distribute-rgt-neg-out78.5%

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

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

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

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

        \[\leadsto \frac{\frac{-1}{\color{blue}{-y \cdot x}} \cdot 1}{{z}^{2}} \]
      14. distribute-neg-frac278.5%

        \[\leadsto \frac{\color{blue}{\left(-\frac{-1}{y \cdot x}\right)} \cdot 1}{{z}^{2}} \]
      15. distribute-neg-frac78.5%

        \[\leadsto \frac{\color{blue}{\frac{--1}{y \cdot x}} \cdot 1}{{z}^{2}} \]
      16. metadata-eval78.5%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{{z}^{2}}}}{y} \]
      2. *-un-lft-identity78.9%

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

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

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

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

    \[\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{1}{z} \cdot \frac{\frac{1}{x}}{z}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 74.4% accurate, 0.7× speedup?

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

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


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

    1. Initial program 94.3%

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

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

    if 6.9999999999999994e-5 < z

    1. Initial program 82.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
    3. Simplified80.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 inf 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z} \cdot \frac{1}{z}}{y \cdot x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 77.4% accurate, 0.7× speedup?

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

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


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

    1. Initial program 94.3%

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

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

    if 6.9999999999999994e-5 < z

    1. Initial program 82.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
    3. Simplified80.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*79.9%

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

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

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

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

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

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

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

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

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

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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-rr43.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-*r/43.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{\frac{-1}{y \cdot x}}{{z}^{2}}} \]
      6. metadata-eval78.4%

        \[\leadsto -1 \cdot \frac{\frac{\color{blue}{-1}}{y \cdot x}}{{z}^{2}} \]
      7. distribute-neg-frac78.4%

        \[\leadsto -1 \cdot \frac{\color{blue}{-\frac{1}{y \cdot x}}}{{z}^{2}} \]
      8. distribute-frac-neg278.4%

        \[\leadsto -1 \cdot \frac{\color{blue}{\frac{1}{-y \cdot x}}}{{z}^{2}} \]
      9. distribute-rgt-neg-out78.4%

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

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

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

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

        \[\leadsto \frac{\frac{-1}{\color{blue}{-y \cdot x}} \cdot 1}{{z}^{2}} \]
      14. distribute-neg-frac278.4%

        \[\leadsto \frac{\color{blue}{\left(-\frac{-1}{y \cdot x}\right)} \cdot 1}{{z}^{2}} \]
      15. distribute-neg-frac78.4%

        \[\leadsto \frac{\color{blue}{\frac{--1}{y \cdot x}} \cdot 1}{{z}^{2}} \]
      16. metadata-eval78.4%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{{z}^{2}}}}{y} \]
      2. *-un-lft-identity80.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z} \cdot \frac{\frac{1}{x}}{z}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 65.2% accurate, 0.9× speedup?

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

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


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

    1. Initial program 94.3%

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

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

    if 6.9999999999999994e-5 < z

    1. Initial program 82.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(z, z, 1\right)}\right)} \]
    3. Simplified80.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*79.9%

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

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

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

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

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

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

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

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

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

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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.5%

        \[\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-rr43.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-*r/43.9%

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

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

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

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

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

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

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

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

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

Alternative 11: 58.7% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

    \[\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 59.7%

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

    \[\leadsto \frac{1}{y \cdot x} \]
  7. Add Preprocessing

Developer target: 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 2024053 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))

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