?

Average Accuracy: 89.9% → 98.5%
Time: 11.1s
Precision: binary64
Cost: 1864

?

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

\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+271}:\\
\;\;\;\;t_1\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

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

    1. Initial program 0.0%

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

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

      [Start]0.0

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

      associate-/l* [=>]99.7

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

    if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 5.0000000000000003e271

    1. Initial program 98.8%

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

    if 5.0000000000000003e271 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t))

    1. Initial program 43.1%

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

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

      [Start]43.1

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

      associate-*l/ [<=]95.1

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

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

Alternatives

Alternative 1
Accuracy85.8%
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\ t_2 := x + z \cdot \frac{y}{t}\\ \mathbf{if}\;z \leq -2.05 \cdot 10^{-29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-185}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-228}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-237}:\\ \;\;\;\;\frac{y}{\frac{t}{-x}}\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Accuracy86.3%
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\ t_2 := x + z \cdot \frac{y}{t}\\ \mathbf{if}\;z \leq -2.25 \cdot 10^{-29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-185}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-225}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-237}:\\ \;\;\;\;x - \frac{y}{\frac{t}{x}}\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Accuracy85.8%
Cost1108
\[\begin{array}{l} t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\ t_2 := x + z \cdot \frac{y}{t}\\ \mathbf{if}\;z \leq -1.9 \cdot 10^{-29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -8.8 \cdot 10^{-185}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-228}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{-237}:\\ \;\;\;\;\frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Accuracy74.4%
Cost978
\[\begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-58} \lor \neg \left(x \leq 1.65 \cdot 10^{-135}\right) \land \left(x \leq 1.85 \cdot 10^{-122} \lor \neg \left(x \leq 5.5 \cdot 10^{-8}\right)\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\ \end{array} \]
Alternative 5
Accuracy59.1%
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.3 \cdot 10^{-155} \lor \neg \left(x \leq 1.3 \cdot 10^{-114}\right) \land x \leq 2.85 \cdot 10^{-8}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Accuracy58.3%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-62}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-129}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \frac{-y}{t}\\ \mathbf{elif}\;x \leq 0.00175:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Accuracy66.2%
Cost848
\[\begin{array}{l} \mathbf{if}\;z \leq -0.0025:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-10}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+34}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+62}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \]
Alternative 8
Accuracy59.3%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-5}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy96.6%
Cost576
\[x + \left(z - x\right) \cdot \frac{y}{t} \]
Alternative 10
Accuracy96.8%
Cost576
\[x + \frac{z - x}{\frac{t}{y}} \]
Alternative 11
Accuracy51.0%
Cost64
\[x \]

Error

Reproduce?

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