?

Average Accuracy: 90.1% → 97.6%
Time: 11.1s
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 -5 \cdot 10^{-306} \lor \neg \left(t_1 \leq 2 \cdot 10^{+289}\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 -5e-306) (not (<= t_1 2e+289)))
     (+ 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 <= -5e-306) || !(t_1 <= 2e+289)) {
		tmp = x + ((y - x) / (t / z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + (((y - x) * z) / t)
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + (((y - x) * z) / t)
    if ((t_1 <= (-5d-306)) .or. (.not. (t_1 <= 2d+289))) then
        tmp = x + ((y - x) / (t / z))
    else
        tmp = t_1
    end if
    code = tmp
end function
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 <= -5e-306) || !(t_1 <= 2e+289)) {
		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 <= -5e-306) or not (t_1 <= 2e+289):
		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 <= -5e-306) || !(t_1 <= 2e+289))
		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 <= -5e-306) || ~((t_1 <= 2e+289)))
		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, -5e-306], N[Not[LessEqual[t$95$1, 2e+289]], $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 -5 \cdot 10^{-306} \lor \neg \left(t_1 \leq 2 \cdot 10^{+289}\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

Original90.1%
Target97.1%
Herbie97.6%
\[\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)) < -4.99999999999999998e-306 or 2.0000000000000001e289 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t))

    1. Initial program 83.2%

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

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

      [Start]83.2

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

      associate-/l* [=>]96.8

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

    if -4.99999999999999998e-306 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2.0000000000000001e289

    1. Initial program 98.7%

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

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

Alternatives

Alternative 1
Accuracy98.6%
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 2 \cdot 10^{+303}\right):\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy51.4%
Cost1376
\[\begin{array}{l} t_1 := z \cdot \frac{y}{t}\\ \mathbf{if}\;t \leq -1.2 \cdot 10^{+66}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -8.2 \cdot 10^{-14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -8.8 \cdot 10^{-123}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -2.6 \cdot 10^{-271}:\\ \;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\ \mathbf{elif}\;t \leq -2.65 \cdot 10^{-303}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-185}:\\ \;\;\;\;\frac{x}{\frac{-t}{z}}\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{+76}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.36 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy80.4%
Cost1372
\[\begin{array}{l} t_1 := \left(y - x\right) \cdot \frac{z}{t}\\ t_2 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -4.2 \cdot 10^{+60}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -6.9 \cdot 10^{-10}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.65 \cdot 10^{-78}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.86 \cdot 10^{-122}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -8.6 \cdot 10^{-149}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{-169}:\\ \;\;\;\;z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+42}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Accuracy79.9%
Cost1372
\[\begin{array}{l} t_1 := \left(y - x\right) \cdot \frac{z}{t}\\ t_2 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -4.2 \cdot 10^{+60}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -8 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-79}:\\ \;\;\;\;x - \frac{z}{\frac{t}{x}}\\ \mathbf{elif}\;x \leq -2.95 \cdot 10^{-123}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.1 \cdot 10^{-148}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-208}:\\ \;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+42}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Accuracy73.4%
Cost1241
\[\begin{array}{l} t_1 := \left(y - x\right) \cdot \frac{z}{t}\\ t_2 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -4.2 \cdot 10^{+60}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-78}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-122}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-148} \lor \neg \left(x \leq 2.9 \cdot 10^{-190}\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y - x}{t}\\ \end{array} \]
Alternative 6
Accuracy74.1%
Cost978
\[\begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+32} \lor \neg \left(x \leq -3.7 \cdot 10^{-7}\right) \land \left(x \leq -6.8 \cdot 10^{-147} \lor \neg \left(x \leq 3.2 \cdot 10^{-190}\right)\right):\\ \;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y - x}{t}\\ \end{array} \]
Alternative 7
Accuracy58.2%
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+32}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -3.9 \cdot 10^{-7} \lor \neg \left(x \leq -1.35 \cdot 10^{-147}\right) \land x \leq 3.1 \cdot 10^{-190}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy58.3%
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+45}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-8} \lor \neg \left(x \leq -1.02 \cdot 10^{-83}\right) \land x \leq 4.9 \cdot 10^{-190}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy93.9%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{-165} \lor \neg \left(z \leq 6.5 \cdot 10^{-114}\right):\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \end{array} \]
Alternative 10
Accuracy73.6%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{-159} \lor \neg \left(x \leq 4.4 \cdot 10^{-190}\right):\\ \;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \end{array} \]
Alternative 11
Accuracy51.1%
Cost64
\[x \]

Error

Reproduce?

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