Average Error: 6.6 → 0.9
Time: 10.9s
Precision: binary64
Cost: 26692
\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ \end{array} \]
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
\[\begin{array}{l} t_0 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\\ \mathbf{if}\;x \leq -5 \cdot 10^{-161}:\\ \;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0} \cdot \frac{\frac{1}{x}}{t_0}\\ \end{array} \]
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (hypot 1.0 z) (sqrt y))))
   (if (<= x -5e-161)
     (/ (/ 1.0 (hypot 1.0 z)) (* x (* (hypot 1.0 z) y)))
     (* (/ 1.0 t_0) (/ (/ 1.0 x) t_0)))))
double code(double x, double y, double z) {
	return (1.0 / x) / (y * (1.0 + (z * z)));
}
double code(double x, double y, double z) {
	double t_0 = hypot(1.0, z) * sqrt(y);
	double tmp;
	if (x <= -5e-161) {
		tmp = (1.0 / hypot(1.0, z)) / (x * (hypot(1.0, z) * y));
	} else {
		tmp = (1.0 / t_0) * ((1.0 / x) / t_0);
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	return (1.0 / x) / (y * (1.0 + (z * z)));
}
public static double code(double x, double y, double z) {
	double t_0 = Math.hypot(1.0, z) * Math.sqrt(y);
	double tmp;
	if (x <= -5e-161) {
		tmp = (1.0 / Math.hypot(1.0, z)) / (x * (Math.hypot(1.0, z) * y));
	} else {
		tmp = (1.0 / t_0) * ((1.0 / x) / t_0);
	}
	return tmp;
}
def code(x, y, z):
	return (1.0 / x) / (y * (1.0 + (z * z)))
def code(x, y, z):
	t_0 = math.hypot(1.0, z) * math.sqrt(y)
	tmp = 0
	if x <= -5e-161:
		tmp = (1.0 / math.hypot(1.0, z)) / (x * (math.hypot(1.0, z) * y))
	else:
		tmp = (1.0 / t_0) * ((1.0 / x) / t_0)
	return tmp
function code(x, y, z)
	return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z))))
end
function code(x, y, z)
	t_0 = Float64(hypot(1.0, z) * sqrt(y))
	tmp = 0.0
	if (x <= -5e-161)
		tmp = Float64(Float64(1.0 / hypot(1.0, z)) / Float64(x * Float64(hypot(1.0, z) * y)));
	else
		tmp = Float64(Float64(1.0 / t_0) * Float64(Float64(1.0 / x) / t_0));
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = (1.0 / x) / (y * (1.0 + (z * z)));
end
function tmp_2 = code(x, y, z)
	t_0 = hypot(1.0, z) * sqrt(y);
	tmp = 0.0;
	if (x <= -5e-161)
		tmp = (1.0 / hypot(1.0, z)) / (x * (hypot(1.0, z) * y));
	else
		tmp = (1.0 / t_0) * ((1.0 / x) / t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5e-161], N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[(x * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\\
\mathbf{if}\;x \leq -5 \cdot 10^{-161}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot y\right)}\\

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.6
Target5.3
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) < -\infty:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \mathbf{elif}\;y \cdot \left(1 + z \cdot z\right) < 8.680743250567252 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(1 + z \cdot z\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \end{array} \]

Derivation

  1. Split input into 2 regimes
  2. if x < -4.9999999999999999e-161

    1. Initial program 4.1

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

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

      [Start]4.1

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

      associate-/r* [=>]4.5

      \[ \color{blue}{\frac{\frac{\frac{1}{x}}{y}}{1 + z \cdot z}} \]
    3. Applied egg-rr1.7

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

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

    if -4.9999999999999999e-161 < x

    1. Initial program 11.1

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Applied egg-rr1.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-161}:\\ \;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right)}}{x \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot y\right)}\\ \mathbf{else}:\\ \;\;\;\;\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}}\\ \end{array} \]

Alternatives

Alternative 1
Error1.7
Cost14148
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 2 \cdot 10^{+296}:\\ \;\;\;\;\frac{1}{x \cdot \mathsf{hypot}\left(1, z\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, z\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(x \cdot z\right)} \cdot \frac{1}{z}\\ \end{array} \]
Alternative 2
Error2.1
Cost968
\[\begin{array}{l} \mathbf{if}\;z \leq -3.5 \cdot 10^{+72}:\\ \;\;\;\;\frac{1}{y \cdot \left(x \cdot z\right)} \cdot \frac{1}{z}\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+132}:\\ \;\;\;\;\frac{1}{y \cdot \left(x + x \cdot \left(z \cdot z\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{z}}{y}}{x \cdot z}\\ \end{array} \]
Alternative 3
Error4.6
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(x \cdot z\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot y}\\ \end{array} \]
Alternative 4
Error2.4
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(x \cdot z\right)\right)}\\ \mathbf{elif}\;z \leq 0.98:\\ \;\;\;\;\frac{1}{x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{z}}{y}}{x \cdot z}\\ \end{array} \]
Alternative 5
Error2.4
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;\frac{1}{y \cdot \left(x \cdot z\right)} \cdot \frac{1}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{1}{x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{z}}{y}}{x \cdot z}\\ \end{array} \]
Alternative 6
Error2.5
Cost836
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 1:\\ \;\;\;\;\frac{1}{x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(x \cdot z\right)\right)}\\ \end{array} \]
Alternative 7
Error28.5
Cost320
\[\frac{1}{x \cdot y} \]

Error

Reproduce

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