?

Average Error: 11.14% → 1.99%
Time: 16.1s
Precision: binary64
Cost: 3656

?

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

\mathbf{elif}\;t_3 \leq 5 \cdot 10^{+279}:\\
\;\;\;\;t_3\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.14%
Target0.5%
Herbie1.99%
\[\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 100

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

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

      [Start]100

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

      *-commutative [=>]100

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

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

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

      [Start]100

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

      associate--l+ [=>]100

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

      times-frac [=>]0.47

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

      +-commutative [=>]0.47

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

      associate-/r* [=>]0.47

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

      div-sub [<=]0.47

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

      +-commutative [=>]0.47

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

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

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

    1. Initial program 0.94

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

    if 5.0000000000000002e279 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 95.79

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Simplified95.79

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

      [Start]95.79

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

      *-commutative [=>]95.79

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

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

    \[\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} + \frac{x}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 5 \cdot 10^{+279}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{x + 1} - \frac{x}{z \cdot \left(x + 1\right)}}{t}\\ \end{array} \]

Alternatives

Alternative 1
Error3.18%
Cost3401
\[\begin{array}{l} t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+279}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error2.07%
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} + \frac{x}{x + 1}\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+279}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
Alternative 3
Error19.16%
Cost1425
\[\begin{array}{l} t_1 := \frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{if}\;t \leq -2.6 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1 \cdot 10^{-91}:\\ \;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;t \leq -5 \cdot 10^{-137} \lor \neg \left(t \leq 1.15 \cdot 10^{-88}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{-x}}{x + 1}\\ \end{array} \]
Alternative 4
Error19.21%
Cost1361
\[\begin{array}{l} t_1 := \frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{if}\;t \leq -5 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -4 \cdot 10^{-91}:\\ \;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;t \leq -1.25 \cdot 10^{-137} \lor \neg \left(t \leq 1.56 \cdot 10^{-86}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(x - \frac{y \cdot z}{x}\right)}{x + 1}\\ \end{array} \]
Alternative 5
Error19.06%
Cost1297
\[\begin{array}{l} t_1 := \frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{if}\;t \leq -5.2 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -3.9 \cdot 10^{-91}:\\ \;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;t \leq -2.6 \cdot 10^{-131} \lor \neg \left(t \leq 3.6 \cdot 10^{-87}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{z \cdot \frac{y}{-x}}{x + 1}\\ \end{array} \]
Alternative 6
Error19.26%
Cost1033
\[\begin{array}{l} \mathbf{if}\;t \leq -6 \cdot 10^{-41} \lor \neg \left(t \leq 5.9 \cdot 10^{-86}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{z \cdot \frac{y}{-x}}{x + 1}\\ \end{array} \]
Alternative 7
Error33.53%
Cost972
\[\begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{-130}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 1.52 \cdot 10^{-152}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-69}:\\ \;\;\;\;x \cdot \left(1 - \frac{1}{z \cdot t}\right)\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Error24.35%
Cost841
\[\begin{array}{l} \mathbf{if}\;t \leq -8.8 \cdot 10^{-63} \lor \neg \left(t \leq 3.3 \cdot 10^{-86}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 9
Error33.78%
Cost780
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-130}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-152}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-111}:\\ \;\;\;\;y \cdot \frac{-z}{x}\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-55}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 10
Error33.09%
Cost588
\[\begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-45}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-129}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-55}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 11
Error33.11%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-130}:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{elif}\;x \leq 10^{-51}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 12
Error43.12%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{-46}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.11 \cdot 10^{-97}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 13
Error45.32%
Cost64
\[1 \]

Error

Reproduce?

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