?

Average Accuracy: 89.7% → 97.7%
Time: 9.9s
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 -5.5 \cdot 10^{+307}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;t_1 \leq -1 \cdot 10^{-241}:\\ \;\;\;\;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 -5.5e+307)
     (+ x (/ y (/ t (- z x))))
     (if (<= t_1 -1e-241) 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 <= -5.5e+307) {
		tmp = x + (y / (t / (z - x)));
	} else if (t_1 <= -1e-241) {
		tmp = t_1;
	} else {
		tmp = x + ((z - x) * (y / t));
	}
	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 * (z - x)) / 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 * (z - x)) / t)
    if (t_1 <= (-5.5d+307)) then
        tmp = x + (y / (t / (z - x)))
    else if (t_1 <= (-1d-241)) then
        tmp = t_1
    else
        tmp = x + ((z - x) * (y / t))
    end if
    code = tmp
end function
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 <= -5.5e+307) {
		tmp = x + (y / (t / (z - x)));
	} else if (t_1 <= -1e-241) {
		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 <= -5.5e+307:
		tmp = x + (y / (t / (z - x)))
	elif t_1 <= -1e-241:
		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 <= -5.5e+307)
		tmp = Float64(x + Float64(y / Float64(t / Float64(z - x))));
	elseif (t_1 <= -1e-241)
		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 <= -5.5e+307)
		tmp = x + (y / (t / (z - x)));
	elseif (t_1 <= -1e-241)
		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, -5.5e+307], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-241], 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 -5.5 \cdot 10^{+307}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

\mathbf{elif}\;t_1 \leq -1 \cdot 10^{-241}:\\
\;\;\;\;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.7%
Target96.6%
Herbie97.7%
\[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)) < -5.49999999999999986e307

    1. Initial program 1.9%

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

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

      [Start]1.9

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

      associate-/l* [=>]98.9

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

    if -5.49999999999999986e307 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -9.9999999999999997e-242

    1. Initial program 99.2%

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

    if -9.9999999999999997e-242 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t))

    1. Initial program 89.5%

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

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

      [Start]89.5

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

      associate-*l/ [<=]96.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -5.5 \cdot 10^{+307}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -1 \cdot 10^{-241}:\\ \;\;\;\;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
Accuracy62.0%
Cost1176
\[\begin{array}{l} t_1 := y \cdot \frac{z - x}{t}\\ \mathbf{if}\;x \leq -13500000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{-211}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.22 \cdot 10^{-281}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+69}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{+85}:\\ \;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy56.4%
Cost912
\[\begin{array}{l} \mathbf{if}\;x \leq -48000000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+45}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{+70}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{+85}:\\ \;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy85.6%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -8.8 \cdot 10^{-86} \lor \neg \left(z \leq 3.7 \cdot 10^{-236}\right):\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \end{array} \]
Alternative 4
Accuracy85.7%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{-86} \lor \neg \left(z \leq 3.7 \cdot 10^{-236}\right):\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x}{\frac{t}{y}}\\ \end{array} \]
Alternative 5
Accuracy57.4%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+16}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{-148}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Accuracy56.8%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -11500000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+45}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Accuracy82.2%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+88}:\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \end{array} \]
Alternative 8
Accuracy96.6%
Cost576
\[x + \left(z - x\right) \cdot \frac{y}{t} \]
Alternative 9
Accuracy50.2%
Cost64
\[x \]

Error

Reproduce?

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