?

Average Accuracy: 89.5% → 98.9%
Time: 11.6s
Precision: binary64
Cost: 1993

?

\[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 \cdot 10^{+307} \lor \neg \left(t_1 \leq 2 \cdot 10^{+306}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot z - x \cdot 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 (or (<= t_1 -5e+307) (not (<= t_1 2e+306)))
     (+ x (/ y (/ t (- z x))))
     (+ x (/ (- (* y 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 <= -5e+307) || !(t_1 <= 2e+306)) {
		tmp = x + (y / (t / (z - x)));
	} else {
		tmp = x + (((y * 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 <= (-5d+307)) .or. (.not. (t_1 <= 2d+306))) then
        tmp = x + (y / (t / (z - x)))
    else
        tmp = x + (((y * 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 <= -5e+307) || !(t_1 <= 2e+306)) {
		tmp = x + (y / (t / (z - x)));
	} else {
		tmp = x + (((y * 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 <= -5e+307) or not (t_1 <= 2e+306):
		tmp = x + (y / (t / (z - x)))
	else:
		tmp = x + (((y * 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 <= -5e+307) || !(t_1 <= 2e+306))
		tmp = Float64(x + Float64(y / Float64(t / Float64(z - x))));
	else
		tmp = Float64(x + Float64(Float64(Float64(y * z) - Float64(x * 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 <= -5e+307) || ~((t_1 <= 2e+306)))
		tmp = x + (y / (t / (z - x)));
	else
		tmp = x + (((y * 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[Or[LessEqual[t$95$1, -5e+307], N[Not[LessEqual[t$95$1, 2e+306]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y * z), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision] / t), $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 \cdot 10^{+307} \lor \neg \left(t_1 \leq 2 \cdot 10^{+306}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z - x \cdot y}{t}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -5e307 or 2.00000000000000003e306 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t))

    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 -5e307 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.00000000000000003e306

    1. Initial program 98.9%

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

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

      [Start]98.9

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

      sub-neg [=>]98.9

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

      distribute-rgt-in [=>]98.9

      \[ x + \frac{\color{blue}{z \cdot y + \left(-x\right) \cdot y}}{t} \]
    3. Applied egg-rr98.9%

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

      [Start]98.9

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

      distribute-lft-neg-out [=>]98.9

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

      unsub-neg [=>]98.9

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

      *-commutative [=>]98.9

      \[ x + \frac{z \cdot y - \color{blue}{y \cdot x}}{t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.9%

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

Alternatives

Alternative 1
Accuracy98.9%
Cost1865
\[\begin{array}{l} t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+307} \lor \neg \left(t_1 \leq 2 \cdot 10^{+306}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy96.3%
Cost1105
\[\begin{array}{l} t_1 := x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{if}\;t \leq -3.6 \cdot 10^{-201}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{-195} \lor \neg \left(t \leq 4 \cdot 10^{-180}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \end{array} \]
Alternative 3
Accuracy65.9%
Cost978
\[\begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-37} \lor \neg \left(y \leq 4.4 \cdot 10^{-13} \lor \neg \left(y \leq 8 \cdot 10^{+24}\right) \land y \leq 1.7 \cdot 10^{+62}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy81.9%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{-37} \lor \neg \left(y \leq 10^{+172}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \end{array} \]
Alternative 5
Accuracy81.3%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{-37} \lor \neg \left(y \leq 2.1 \cdot 10^{+170}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \end{array} \]
Alternative 6
Accuracy97.1%
Cost708
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-112}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \end{array} \]
Alternative 7
Accuracy59.1%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -8.3 \cdot 10^{-122}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.26 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Accuracy60.2%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-153}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.1 \cdot 10^{-93}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy60.1%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{-154}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-99}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy59.2%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-122}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-99}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Accuracy51.0%
Cost64
\[x \]

Error

Reproduce?

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