Average Error: 6.3 → 0.9
Time: 9.6s
Precision: binary64
Cost: 1864
\[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:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+285}:\\ \;\;\;\;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 (/ (* y (- z x)) t))))
   (if (<= t_1 (- INFINITY))
     (+ x (/ y (/ t (- z x))))
     (if (<= t_1 5e+285) 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 + ((y * (z - x)) / t);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x + (y / (t / (z - x)));
	} else if (t_1 <= 5e+285) {
		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 + ((y * (z - x)) / t);
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = x + (y / (t / (z - x)));
	} else if (t_1 <= 5e+285) {
		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 + ((y * (z - x)) / t)
	tmp = 0
	if t_1 <= -math.inf:
		tmp = x + (y / (t / (z - x)))
	elif t_1 <= 5e+285:
		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(y * Float64(z - x)) / t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(x + Float64(y / Float64(t / Float64(z - x))));
	elseif (t_1 <= 5e+285)
		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 + ((y * (z - x)) / t);
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = x + (y / (t / (z - x)));
	elseif (t_1 <= 5e+285)
		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[(y * N[(z - x), $MachinePrecision]), $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+285], 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{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+285}:\\
\;\;\;\;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

Original6.3
Target2.0
Herbie0.9
\[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 64.0

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

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

      [Start]64.0

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

      associate-/l* [=>]0.2

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

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

    1. Initial program 0.8

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

    if 5.00000000000000016e285 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t))

    1. Initial program 42.0

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

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

      [Start]42.0

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

      associate-*l/ [<=]2.6

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

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

Alternatives

Alternative 1
Error29.9
Cost848
\[\begin{array}{l} \mathbf{if}\;z \leq -3.5 \cdot 10^{+56}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-269}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-197}:\\ \;\;\;\;y \cdot \frac{-x}{t}\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+55}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \]
Alternative 2
Error29.9
Cost848
\[\begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+49}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-269}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-197}:\\ \;\;\;\;x \cdot \left(-\frac{y}{t}\right)\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+56}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \]
Alternative 3
Error15.6
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{-269} \lor \neg \left(z \leq 1.9 \cdot 10^{-197}\right):\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-\frac{y}{t}\right)\\ \end{array} \]
Alternative 4
Error13.5
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{-269} \lor \neg \left(z \leq 1.9 \cdot 10^{-197}\right):\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-\frac{y}{t}\right)\\ \end{array} \]
Alternative 5
Error13.5
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{-269} \lor \neg \left(z \leq 1.9 \cdot 10^{-197}\right):\\ \;\;\;\;x + \frac{z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-\frac{y}{t}\right)\\ \end{array} \]
Alternative 6
Error7.9
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{-109} \lor \neg \left(z \leq 1.25 \cdot 10^{-142}\right):\\ \;\;\;\;x + \frac{z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \end{array} \]
Alternative 7
Error2.8
Cost708
\[\begin{array}{l} \mathbf{if}\;t \leq -1.85 \cdot 10^{-191}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \end{array} \]
Alternative 8
Error28.8
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+52} \lor \neg \left(z \leq 9.2 \cdot 10^{+55}\right):\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error26.2
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{-84}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.35 \cdot 10^{-178}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error28.8
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -5.1 \cdot 10^{+58}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;z \leq 3.65 \cdot 10^{+56}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \]
Alternative 11
Error2.0
Cost576
\[x + \left(z - x\right) \cdot \frac{y}{t} \]
Alternative 12
Error31.5
Cost64
\[x \]

Error

Reproduce

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