?

Average Accuracy: 90.9% → 97.7%
Time: 12.5s
Precision: binary64
Cost: 13892

?

\[ \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} \mathbf{if}\;\frac{1}{x} \leq -5 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{\frac{1}{y}}{\mathsf{hypot}\left(1, z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{\frac{1}{x \cdot y}}{\mathsf{hypot}\left(1, z\right)}\\ \end{array} \]
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
(FPCore (x y z)
 :precision binary64
 (if (<= (/ 1.0 x) -5e-95)
   (* (/ (/ 1.0 x) (hypot 1.0 z)) (/ (/ 1.0 y) (hypot 1.0 z)))
   (* (/ 1.0 (hypot 1.0 z)) (/ (/ 1.0 (* x y)) (hypot 1.0 z)))))
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 tmp;
	if ((1.0 / x) <= -5e-95) {
		tmp = ((1.0 / x) / hypot(1.0, z)) * ((1.0 / y) / hypot(1.0, z));
	} else {
		tmp = (1.0 / hypot(1.0, z)) * ((1.0 / (x * y)) / hypot(1.0, z));
	}
	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 tmp;
	if ((1.0 / x) <= -5e-95) {
		tmp = ((1.0 / x) / Math.hypot(1.0, z)) * ((1.0 / y) / Math.hypot(1.0, z));
	} else {
		tmp = (1.0 / Math.hypot(1.0, z)) * ((1.0 / (x * y)) / Math.hypot(1.0, z));
	}
	return tmp;
}
def code(x, y, z):
	return (1.0 / x) / (y * (1.0 + (z * z)))
def code(x, y, z):
	tmp = 0
	if (1.0 / x) <= -5e-95:
		tmp = ((1.0 / x) / math.hypot(1.0, z)) * ((1.0 / y) / math.hypot(1.0, z))
	else:
		tmp = (1.0 / math.hypot(1.0, z)) * ((1.0 / (x * y)) / math.hypot(1.0, z))
	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)
	tmp = 0.0
	if (Float64(1.0 / x) <= -5e-95)
		tmp = Float64(Float64(Float64(1.0 / x) / hypot(1.0, z)) * Float64(Float64(1.0 / y) / hypot(1.0, z)));
	else
		tmp = Float64(Float64(1.0 / hypot(1.0, z)) * Float64(Float64(1.0 / Float64(x * y)) / hypot(1.0, z)));
	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)
	tmp = 0.0;
	if ((1.0 / x) <= -5e-95)
		tmp = ((1.0 / x) / hypot(1.0, z)) * ((1.0 / y) / hypot(1.0, z));
	else
		tmp = (1.0 / hypot(1.0, z)) * ((1.0 / (x * y)) / hypot(1.0, z));
	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_] := If[LessEqual[N[(1.0 / x), $MachinePrecision], -5e-95], N[(N[(N[(1.0 / x), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;\frac{1}{x} \leq -5 \cdot 10^{-95}:\\
\;\;\;\;\frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{\frac{1}{y}}{\mathsf{hypot}\left(1, z\right)}\\

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


\end{array}

Error?

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original90.9%
Target93.1%
Herbie97.7%
\[\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 (/.f64 1 x) < -4.9999999999999998e-95

    1. Initial program 83.3%

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

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

      [Start]83.3

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

      associate-/r* [=>]86.5

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

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

      [Start]86.5

      \[ \frac{\frac{\frac{1}{x}}{y}}{1 + z \cdot z} \]

      div-inv [=>]86.4

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

      add-sqr-sqrt [=>]86.4

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

      times-frac [=>]87.5

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

      hypot-1-def [=>]87.5

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

      hypot-1-def [=>]98.5

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

    if -4.9999999999999998e-95 < (/.f64 1 x)

    1. Initial program 92.5%

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

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

      [Start]92.5

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

      associate-/r* [=>]92.5

      \[ \color{blue}{\frac{\frac{\frac{1}{x}}{y}}{1 + z \cdot z}} \]
    3. Applied egg-rr97.2%

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

      [Start]92.5

      \[ \frac{\frac{\frac{1}{x}}{y}}{1 + z \cdot z} \]

      *-un-lft-identity [=>]92.5

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

      add-sqr-sqrt [=>]92.5

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

      times-frac [=>]92.5

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

      hypot-1-def [=>]92.5

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

      associate-/l/ [=>]92.3

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

      *-commutative [=>]92.3

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

      hypot-1-def [=>]97.2

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

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

Alternatives

Alternative 1
Accuracy99.3%
Cost1736
\[\begin{array}{l} t_0 := y \cdot \left(1 + z \cdot z\right)\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;\frac{1}{x \cdot z} \cdot \frac{\frac{1}{y}}{z}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1}{x}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{y}}{x \cdot z}}{z}\\ \end{array} \]
Alternative 2
Accuracy97.4%
Cost968
\[\begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{+44}:\\ \;\;\;\;\frac{\frac{\frac{1}{y}}{x \cdot z}}{z}\\ \mathbf{elif}\;z \leq 12500000000000:\\ \;\;\;\;\frac{1}{x \cdot \left(y + y \cdot \left(z \cdot z\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{z \cdot y}}{x}}{z}\\ \end{array} \]
Alternative 3
Accuracy97.7%
Cost968
\[\begin{array}{l} \mathbf{if}\;z \leq -8.2 \cdot 10^{+38}:\\ \;\;\;\;\frac{\frac{\frac{1}{y}}{x \cdot z}}{z}\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+146}:\\ \;\;\;\;\frac{\frac{\frac{1}{x}}{y}}{1 + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot y} \cdot \frac{\frac{1}{x}}{z}\\ \end{array} \]
Alternative 4
Accuracy95.4%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -85:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(x \cdot z\right)\right)}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot \left(z \cdot \left(x \cdot y\right)\right)}\\ \end{array} \]
Alternative 5
Accuracy96.6%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -85:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(x \cdot z\right)\right)}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(x \cdot z\right) \cdot \left(z \cdot y\right)}\\ \end{array} \]
Alternative 6
Accuracy96.7%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -85:\\ \;\;\;\;\frac{\frac{\frac{1}{y}}{x \cdot z}}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(x \cdot z\right) \cdot \left(z \cdot y\right)}\\ \end{array} \]
Alternative 7
Accuracy96.8%
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -85:\\ \;\;\;\;\frac{\frac{\frac{1}{y}}{x \cdot z}}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{z \cdot y}}{x}}{z}\\ \end{array} \]
Alternative 8
Accuracy89.9%
Cost836
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 1:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(x \cdot \left(z \cdot z\right)\right)}\\ \end{array} \]
Alternative 9
Accuracy97.0%
Cost836
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 0.02:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(x \cdot z\right)\right)}\\ \end{array} \]
Alternative 10
Accuracy58.6%
Cost320
\[\frac{1}{x \cdot y} \]
Alternative 11
Accuracy58.6%
Cost320
\[\frac{\frac{1}{x}}{y} \]

Error

Reproduce?

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