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

Percentage Accurate: 90.9% → 97.7%
Time: 11.2s
Alternatives: 10
Speedup: 0.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 90.9% 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: 97.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+119}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(z \cdot z + 1\right)}\\

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


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

    1. Initial program 99.6%

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

    if 3.99999999999999978e119 < (*.f64 z z)

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity86.3%

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

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

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

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

Alternative 2: 96.8% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    7. Step-by-step derivation
      1. un-div-inv99.3%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    8. Applied egg-rr99.3%

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

    if 4.9999999999999999e-13 < (*.f64 z z)

    1. Initial program 79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity89.2%

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

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

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

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

Alternative 3: 76.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv70.4%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    7. Step-by-step derivation
      1. un-div-inv70.4%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    8. Applied egg-rr70.4%

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

    if 1 < z

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 75.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv70.4%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    7. Step-by-step derivation
      1. un-div-inv70.4%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    8. Applied egg-rr70.4%

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

    if 1 < z

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 77.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv70.4%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    7. Step-by-step derivation
      1. un-div-inv70.4%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    8. Applied egg-rr70.4%

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

    if 1 < z

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u83.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}\right)\right)} \]
      2. expm1-udef52.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}\right)} - 1} \]
      3. associate-/l/52.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\left(z \cdot \left(y \cdot z\right)\right) \cdot x}}\right)} - 1 \]
    8. Applied egg-rr52.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\left(z \cdot \left(y \cdot z\right)\right) \cdot x}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def82.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\left(z \cdot \left(y \cdot z\right)\right) \cdot x}\right)\right)} \]
      2. expm1-log1p90.8%

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

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

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

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

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

Alternative 6: 77.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv70.4%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    7. Step-by-step derivation
      1. un-div-inv70.4%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    8. Applied egg-rr70.4%

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

    if 1 < z

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \left(x \cdot y\right)}} \]
      2. un-div-inv86.7%

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

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

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

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

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

Alternative 7: 64.2% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
      2. div-inv70.4%

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
    7. Step-by-step derivation
      1. un-div-inv70.4%

        \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    8. Applied egg-rr70.4%

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

    if 1 < z

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \left(x \cdot y\right)}} \]
      2. un-div-inv86.7%

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

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

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

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

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

Alternative 8: 58.4% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 58.4% accurate, 2.2× speedup?

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

\\
\frac{\frac{1}{x}}{y}
\end{array}
Derivation
  1. Initial program 90.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    2. div-inv59.9%

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{y} \]
  8. Applied egg-rr60.0%

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y}} \]
  9. Final simplification60.0%

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

Alternative 10: 58.4% accurate, 2.2× speedup?

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

\\
\frac{\frac{1}{y}}{x}
\end{array}
Derivation
  1. Initial program 90.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
    2. div-inv59.9%

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

    \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{1}{x}} \]
  7. Step-by-step derivation
    1. un-div-inv59.9%

      \[\leadsto \color{blue}{\frac{\frac{1}{y}}{x}} \]
  8. Applied egg-rr59.9%

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

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

Developer target: 91.8% accurate, 0.4× 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 2023274 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (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)))))