?

Average Accuracy: 89.6% → 98.8%
Time: 11.0s
Precision: binary64
Cost: 1865

?

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

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original89.6%
Target96.6%
Herbie98.8%
\[\begin{array}{l} \mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array} \]

Derivation?

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

    1. Initial program 12.8%

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

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

      [Start]12.8

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

      associate-/l* [=>]98.7

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

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

    1. Initial program 98.8%

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

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

Alternatives

Alternative 1
Accuracy56.8%
Cost1901
\[\begin{array}{l} t_1 := y \cdot \frac{z}{t}\\ t_2 := z \cdot \frac{y - x}{t}\\ \mathbf{if}\;t \leq -1.45 \cdot 10^{+171}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.9 \cdot 10^{-204}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -6.5 \cdot 10^{-268}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.05 \cdot 10^{-286}:\\ \;\;\;\;\frac{-x}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{-200}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 1.45 \cdot 10^{-111}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-99}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.7 \cdot 10^{-70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{+26} \lor \neg \left(t \leq 1.05 \cdot 10^{+75}\right) \land t \leq 1.46 \cdot 10^{+161}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy98.9%
Cost1865
\[\begin{array}{l} t_1 := x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+307}\right):\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy80.6%
Cost1240
\[\begin{array}{l} t_1 := x - x \cdot \frac{z}{t}\\ t_2 := x + y \cdot \frac{z}{t}\\ t_3 := x + z \cdot \frac{y}{t}\\ \mathbf{if}\;t \leq -5.8 \cdot 10^{+17}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -1.85 \cdot 10^{-47}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -3.25 \cdot 10^{-74}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 7.8 \cdot 10^{-132}:\\ \;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{-22}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 4
Accuracy57.5%
Cost1112
\[\begin{array}{l} t_1 := y \cdot \frac{z}{t}\\ \mathbf{if}\;x \leq -2.9 \cdot 10^{+19}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-306}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 10^{-237}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-91}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Accuracy57.6%
Cost1112
\[\begin{array}{l} t_1 := \frac{y}{\frac{t}{z}}\\ \mathbf{if}\;x \leq -8 \cdot 10^{+19}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-57}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.95 \cdot 10^{-108}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-306}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 10^{-237}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-90}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Accuracy48.0%
Cost980
\[\begin{array}{l} t_1 := \frac{y}{\frac{t}{z}}\\ \mathbf{if}\;y \leq -1.06 \cdot 10^{+48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-170}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-301}:\\ \;\;\;\;\frac{-x}{\frac{t}{z}}\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+132}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.9 \cdot 10^{+167}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Accuracy47.9%
Cost980
\[\begin{array}{l} t_1 := \frac{y}{\frac{t}{z}}\\ \mathbf{if}\;y \leq -2 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-170}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.72 \cdot 10^{-301}:\\ \;\;\;\;x \cdot \frac{-z}{t}\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+132}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.9 \cdot 10^{+167}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy57.3%
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{+20}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-58} \lor \neg \left(x \leq -1.15 \cdot 10^{-114}\right) \land x \leq 1.02 \cdot 10^{-88}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy57.5%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+19}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-58}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-91}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy92.4%
Cost841
\[\begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{-212} \lor \neg \left(t \leq 1.55 \cdot 10^{-111}\right):\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\ \end{array} \]
Alternative 11
Accuracy75.9%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-170} \lor \neg \left(y \leq -3.55 \cdot 10^{-302}\right):\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y - x}{t}\\ \end{array} \]
Alternative 12
Accuracy85.9%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -5.6 \cdot 10^{-140} \lor \neg \left(y \leq 1.4 \cdot 10^{-67}\right):\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{z}{t}\\ \end{array} \]
Alternative 13
Accuracy49.8%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023141 
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

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