?

Average Accuracy: 90.0% → 97.6%
Time: 12.0s
Precision: binary64
Cost: 1736

?

\[ \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 := y \cdot \left(1 + z \cdot z\right)\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;\frac{1}{y \cdot z} \cdot \frac{1}{z \cdot x}\\ \mathbf{elif}\;t_0 \leq 10^{+287}:\\ \;\;\;\;\frac{\frac{1}{x}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\ \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 (* y (+ 1.0 (* z z)))))
   (if (<= t_0 (- INFINITY))
     (* (/ 1.0 (* y z)) (/ 1.0 (* z x)))
     (if (<= t_0 1e+287) (/ (/ 1.0 x) t_0) (/ 1.0 (* z (* y (* z x))))))))
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 = y * (1.0 + (z * z));
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (1.0 / (y * z)) * (1.0 / (z * x));
	} else if (t_0 <= 1e+287) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = 1.0 / (z * (y * (z * x)));
	}
	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 = y * (1.0 + (z * z));
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (1.0 / (y * z)) * (1.0 / (z * x));
	} else if (t_0 <= 1e+287) {
		tmp = (1.0 / x) / t_0;
	} else {
		tmp = 1.0 / (z * (y * (z * x)));
	}
	return tmp;
}
def code(x, y, z):
	return (1.0 / x) / (y * (1.0 + (z * z)))
def code(x, y, z):
	t_0 = y * (1.0 + (z * z))
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (1.0 / (y * z)) * (1.0 / (z * x))
	elif t_0 <= 1e+287:
		tmp = (1.0 / x) / t_0
	else:
		tmp = 1.0 / (z * (y * (z * x)))
	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(y * Float64(1.0 + Float64(z * z)))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(1.0 / Float64(y * z)) * Float64(1.0 / Float64(z * x)));
	elseif (t_0 <= 1e+287)
		tmp = Float64(Float64(1.0 / x) / t_0);
	else
		tmp = Float64(1.0 / Float64(z * Float64(y * Float64(z * x))));
	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 = y * (1.0 + (z * z));
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (1.0 / (y * z)) * (1.0 / (z * x));
	elseif (t_0 <= 1e+287)
		tmp = (1.0 / x) / t_0;
	else
		tmp = 1.0 / (z * (y * (z * x)));
	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[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(1.0 / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+287], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(1.0 / N[(z * N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{1}{y \cdot z} \cdot \frac{1}{z \cdot x}\\

\mathbf{elif}\;t_0 \leq 10^{+287}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original90.0%
Target92.1%
Herbie97.6%
\[\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 3 regimes
  2. if (*.f64 y (+.f64 1 (*.f64 z z))) < -inf.0

    1. Initial program 76.1%

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)} \]
    2. Taylor expanded in z around inf 76.1%

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

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

      [Start]76.1

      \[ \frac{\frac{1}{x}}{y \cdot {z}^{2}} \]

      unpow2 [=>]76.1

      \[ \frac{\frac{1}{x}}{y \cdot \color{blue}{\left(z \cdot z\right)}} \]
    4. Applied egg-rr97.9%

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

      [Start]76.1

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

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

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

      associate-*r* [=>]96.2

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

      times-frac [=>]98.4

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

      associate-/l/ [=>]97.9

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

      *-commutative [=>]97.9

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

    if -inf.0 < (*.f64 y (+.f64 1 (*.f64 z z))) < 1.0000000000000001e287

    1. Initial program 99.5%

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

    if 1.0000000000000001e287 < (*.f64 y (+.f64 1 (*.f64 z z)))

    1. Initial program 73.0%

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

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

      [Start]73.0

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

      associate-/l/ [=>]73.0

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

      associate-*l* [=>]80.0

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

      +-commutative [=>]80.0

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

      fma-def [=>]80.0

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

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

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

      [Start]74.4

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

      *-commutative [=>]74.4

      \[ \frac{1}{y \cdot \color{blue}{\left(x \cdot {z}^{2}\right)}} \]

      unpow2 [=>]74.4

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

      associate-*r* [=>]75.0

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

      *-commutative [=>]75.0

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

      associate-*l* [=>]87.4

      \[ \frac{1}{\color{blue}{z \cdot \left(z \cdot \left(y \cdot x\right)\right)}} \]
    5. Taylor expanded in z around 0 93.2%

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

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

Alternatives

Alternative 1
Accuracy98.3%
Cost13764
\[\begin{array}{l} \mathbf{if}\;y \leq 10000000:\\ \;\;\;\;\frac{1}{\frac{y \cdot \mathsf{hypot}\left(1, z\right)}{\frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(1, z\right) \cdot \left(y \cdot x\right)}}{\mathsf{hypot}\left(1, z\right)}\\ \end{array} \]
Alternative 2
Accuracy97.1%
Cost7492
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 10^{+287}:\\ \;\;\;\;\frac{1}{x \cdot \mathsf{fma}\left(y \cdot z, z, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\ \end{array} \]
Alternative 3
Accuracy97.4%
Cost7492
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 10^{+287}:\\ \;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot z, z, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\ \end{array} \]
Alternative 4
Accuracy97.1%
Cost969
\[\begin{array}{l} \mathbf{if}\;z \leq -10000000000 \lor \neg \left(z \leq 1.36 \cdot 10^{+46}\right):\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y \cdot \left(x + x \cdot \left(z \cdot z\right)\right)}\\ \end{array} \]
Alternative 5
Accuracy93.3%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \end{array} \]
Alternative 6
Accuracy96.5%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{1}{z \cdot \left(x \cdot \left(y \cdot z\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \end{array} \]
Alternative 7
Accuracy96.5%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y}\\ \end{array} \]
Alternative 8
Accuracy96.4%
Cost836
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 0.0001:\\ \;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\ \end{array} \]
Alternative 9
Accuracy54.7%
Cost320
\[\frac{1}{y \cdot x} \]

Error

Reproduce?

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