?

Average Accuracy: 89.8% → 97.8%
Time: 12.3s
Precision: binary64
Cost: 1865

?

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original89.8%
Target96.6%
Herbie97.8%
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \]

Derivation?

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

    1. Initial program 83.3%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Simplified96.8%

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

      [Start]83.3

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

      associate-*l/ [<=]96.8

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

    if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -4.99999999999999972e-158

    1. Initial program 99.4%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq -5 \cdot 10^{-158}\right):\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy61.8%
Cost1373
\[\begin{array}{l} t_1 := y \cdot \frac{z - x}{t}\\ \mathbf{if}\;x \leq -6.8 \cdot 10^{-68}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-96}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-127}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-179}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-166} \lor \neg \left(x \leq 1.15 \cdot 10^{-128}\right) \land x \leq 3.8 \cdot 10^{-71}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy59.2%
Cost1112
\[\begin{array}{l} t_1 := z \cdot \frac{y}{t}\\ \mathbf{if}\;x \leq -1.75 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-96}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-128}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{-167}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-128}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{-70}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy59.1%
Cost1112
\[\begin{array}{l} t_1 := z \cdot \frac{y}{t}\\ \mathbf{if}\;x \leq -5.8 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-136}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{-167}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-129}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-71}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy78.0%
Cost713
\[\begin{array}{l} \mathbf{if}\;t \leq -7.2 \cdot 10^{-200} \lor \neg \left(t \leq 8.2 \cdot 10^{-222}\right):\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \end{array} \]
Alternative 5
Accuracy86.8%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -1.42 \cdot 10^{-159} \lor \neg \left(z \leq 3 \cdot 10^{-161}\right):\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \end{array} \]
Alternative 6
Accuracy86.9%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{-159} \lor \neg \left(z \leq 1.1 \cdot 10^{-160}\right):\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x}{\frac{t}{y}}\\ \end{array} \]
Alternative 7
Accuracy96.6%
Cost708
\[\begin{array}{l} \mathbf{if}\;y \leq 3.1 \cdot 10^{-120}:\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array} \]
Alternative 8
Accuracy59.4%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{-63}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.7 \cdot 10^{-167}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy80.5%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 350000000000:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \end{array} \]
Alternative 10
Accuracy96.6%
Cost576
\[x + \left(z - x\right) \cdot \frac{y}{t} \]
Alternative 11
Accuracy50.6%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023135 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

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

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