Average Error: 6.1 → 0.9
Time: 10.8s
Precision: binary64
Cost: 7684
\[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 + {\left(\frac{\frac{t}{z - x}}{y}\right)}^{-1}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+299}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\left(z - x\right) \cdot \frac{1}{t}\right)\\ \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 (pow (/ (/ t (- z x)) y) -1.0))
     (if (<= t_1 5e+299) t_1 (+ x (* y (* (- z x) (/ 1.0 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 + pow(((t / (z - x)) / y), -1.0);
	} else if (t_1 <= 5e+299) {
		tmp = t_1;
	} else {
		tmp = x + (y * ((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);
}
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 + Math.pow(((t / (z - x)) / y), -1.0);
	} else if (t_1 <= 5e+299) {
		tmp = t_1;
	} else {
		tmp = x + (y * ((z - x) * (1.0 / 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 + math.pow(((t / (z - x)) / y), -1.0)
	elif t_1 <= 5e+299:
		tmp = t_1
	else:
		tmp = x + (y * ((z - x) * (1.0 / 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(Float64(t / Float64(z - x)) / y) ^ -1.0));
	elseif (t_1 <= 5e+299)
		tmp = t_1;
	else
		tmp = Float64(x + Float64(y * Float64(Float64(z - x) * Float64(1.0 / 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 + (((t / (z - x)) / y) ^ -1.0);
	elseif (t_1 <= 5e+299)
		tmp = t_1;
	else
		tmp = x + (y * ((z - x) * (1.0 / 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[Power[N[(N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+299], t$95$1, N[(x + N[(y * N[(N[(z - x), $MachinePrecision] * N[(1.0 / t), $MachinePrecision]), $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 + {\left(\frac{\frac{t}{z - x}}{y}\right)}^{-1}\\

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

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.1
Target2.1
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. Applied egg-rr0.2

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

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

    1. Initial program 0.7

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

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

    1. Initial program 53.5

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Applied egg-rr5.0

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

Alternatives

Alternative 1
Error0.9
Cost7492
\[\begin{array}{l} t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+299}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\left(z - x\right) \cdot \frac{1}{t}\right)\\ \end{array} \]
Alternative 2
Error0.9
Cost1992
\[\begin{array}{l} t_1 := x + y \cdot \left(\left(z - x\right) \cdot \frac{1}{t}\right)\\ t_2 := x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+299}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error2.7
Cost1864
\[\begin{array}{l} t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x - y \cdot \frac{x}{t}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+299}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \end{array} \]
Alternative 4
Error29.1
Cost1112
\[\begin{array}{l} t_1 := \frac{y \cdot z}{t}\\ \mathbf{if}\;t \leq -105000000:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -7.2 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.5 \cdot 10^{-84}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{-154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.0025990035995804 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error27.3
Cost912
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7918359023787763 \cdot 10^{-148}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.2133642157993399 \cdot 10^{-169}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;x \leq 1.2969499525725425 \cdot 10^{-31}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.936300961394629 \cdot 10^{+44}:\\ \;\;\;\;y \cdot \frac{-x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error27.2
Cost912
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7918359023787763 \cdot 10^{-148}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.2133642157993399 \cdot 10^{-169}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;x \leq 1.2969499525725425 \cdot 10^{-31}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.936300961394629 \cdot 10^{+44}:\\ \;\;\;\;x \cdot \frac{-y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error19.8
Cost844
\[\begin{array}{l} t_1 := x - y \cdot \frac{x}{t}\\ \mathbf{if}\;x \leq -1.7918359023787763 \cdot 10^{-148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.2133642157993399 \cdot 10^{-169}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+145}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error8.4
Cost712
\[\begin{array}{l} t_1 := x + z \cdot \frac{y}{t}\\ \mathbf{if}\;z \leq -1.8565421213848662 \cdot 10^{-141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.765675670462812 \cdot 10^{-145}:\\ \;\;\;\;x - y \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error9.6
Cost712
\[\begin{array}{l} t_1 := x - x \cdot \frac{y}{t}\\ \mathbf{if}\;x \leq -5.186533873894259 \cdot 10^{+23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.104911111012746 \cdot 10^{-65}:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error26.2
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7918359023787763 \cdot 10^{-148}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.2133642157993399 \cdot 10^{-169}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error31.6
Cost64
\[x \]

Error

Reproduce

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