?

Average Accuracy: 88.3% → 96.5%
Time: 19.0s
Precision: binary64
Cost: 3784

?

\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
\[\begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{x + \frac{y \cdot z - x}{t_1}}{x + 1}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;\frac{y}{t_1} \cdot \frac{z}{x + 1}\\ \mathbf{elif}\;t_2 \leq 4 \cdot 10^{+202}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{\left(z \cdot t\right) \cdot \left(x + 1\right)}\\ \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
   (if (<= t_2 (- INFINITY))
     (* (/ y t_1) (/ z (+ x 1.0)))
     (if (<= t_2 4e+202)
       t_2
       (-
        (+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
        (/ x (* (* z t) (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
	return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = (y / t_1) * (z / (x + 1.0));
	} else if (t_2 <= 4e+202) {
		tmp = t_2;
	} else {
		tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0)));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * t) - x;
	double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = (y / t_1) * (z / (x + 1.0));
	} else if (t_2 <= 4e+202) {
		tmp = t_2;
	} else {
		tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0)));
	}
	return tmp;
}
def code(x, y, z, t):
	return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
def code(x, y, z, t):
	t_1 = (z * t) - x
	t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0)
	tmp = 0
	if t_2 <= -math.inf:
		tmp = (y / t_1) * (z / (x + 1.0))
	elif t_2 <= 4e+202:
		tmp = t_2
	else:
		tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0)))
	return tmp
function code(x, y, z, t)
	return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0))
end
function code(x, y, z, t)
	t_1 = Float64(Float64(z * t) - x)
	t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(Float64(y / t_1) * Float64(z / Float64(x + 1.0)));
	elseif (t_2 <= 4e+202)
		tmp = t_2;
	else
		tmp = Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))) - Float64(x / Float64(Float64(z * t) * Float64(x + 1.0))));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * t) - x;
	t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = (y / t_1) * (z / (x + 1.0));
	elseif (t_2 <= 4e+202)
		tmp = t_2;
	else
		tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / ((z * t) * (x + 1.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(y / t$95$1), $MachinePrecision] * N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+202], t$95$2, N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(z * t), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{y \cdot z - x}{t_1}}{x + 1}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\frac{y}{t_1} \cdot \frac{z}{x + 1}\\

\mathbf{elif}\;t_2 \leq 4 \cdot 10^{+202}:\\
\;\;\;\;t_2\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original88.3%
Target99.4%
Herbie96.5%
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1} \]

Derivation?

  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -inf.0

    1. Initial program 0.0%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Simplified0.0%

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

      [Start]0.0

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

      *-commutative [=>]0.0

      \[ \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Taylor expanded in y around inf 0.0%

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

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

      [Start]0.0

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

      times-frac [=>]71.7

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

      +-commutative [=>]71.7

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

    if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 3.9999999999999996e202

    1. Initial program 99.0%

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

    if 3.9999999999999996e202 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 17.7%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Simplified17.7%

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

      [Start]17.7

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

      *-commutative [=>]17.7

      \[ \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Taylor expanded in t around inf 81.4%

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

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

Alternatives

Alternative 1
Accuracy96.5%
Cost3400
\[\begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{x + \frac{y \cdot z - x}{t_1}}{x + 1}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;\frac{y}{t_1} \cdot \frac{z}{x + 1}\\ \mathbf{elif}\;t_2 \leq 4 \cdot 10^{+202}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
Alternative 2
Accuracy76.9%
Cost1492
\[\begin{array}{l} t_1 := z \cdot t - x\\ t_2 := \frac{x - \frac{x}{t_1}}{x + 1}\\ t_3 := \frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{if}\;x \leq -1.45 \cdot 10^{-119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-160}:\\ \;\;\;\;\frac{y}{t_1} \cdot \frac{z}{x + 1}\\ \mathbf{elif}\;x \leq -7.4 \cdot 10^{-184}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{-174}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 0.55:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{+54}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{z}{\frac{x \cdot x}{-y}}\\ \end{array} \]
Alternative 3
Accuracy87.8%
Cost1225
\[\begin{array}{l} t_1 := z \cdot t - x\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{-148} \lor \neg \left(z \leq 1.85 \cdot 10^{-166}\right):\\ \;\;\;\;\frac{x + \frac{y}{\frac{t_1}{z}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \frac{x}{t_1}}{x + 1}\\ \end{array} \]
Alternative 4
Accuracy75.3%
Cost1036
\[\begin{array}{l} t_1 := 1 + \frac{z}{\frac{x \cdot x}{-y}}\\ \mathbf{if}\;x \leq -15.2:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.96 \cdot 10^{-137}:\\ \;\;\;\;y \cdot z + \left(1 - y \cdot \frac{z}{x}\right)\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+55}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy81.7%
Cost1033
\[\begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-97} \lor \neg \left(t \leq 45000000000\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{y \cdot z}{-x}}{x + 1}\\ \end{array} \]
Alternative 6
Accuracy77.6%
Cost905
\[\begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{+18} \lor \neg \left(x \leq 8 \cdot 10^{+54}\right):\\ \;\;\;\;1 + \frac{z}{\frac{x \cdot x}{-y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
Alternative 7
Accuracy75.1%
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-118}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{+56}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Accuracy67.5%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -2.8 \cdot 10^{-118}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-170}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1}\\ \end{array} \]
Alternative 9
Accuracy67.3%
Cost460
\[\begin{array}{l} \mathbf{if}\;x \leq -3.7 \cdot 10^{-118}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-171}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-64}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 10
Accuracy57.6%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-200}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-64}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 11
Accuracy55.4%
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023130 
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))

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