?

Average Error: 10.14% → 3.01%
Time: 8.9s
Precision: binary64
Cost: 576

?

\[x + \frac{y \cdot \left(z - x\right)}{t} \]
\[x + \frac{z - x}{\frac{t}{y}} \]
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t) :precision binary64 (+ x (/ (- z x) (/ t y))))
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) {
	return x + ((z - x) / (t / y));
}
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
    code = x + ((z - x) / (t / y))
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) {
	return x + ((z - x) / (t / y));
}
def code(x, y, z, t):
	return x + ((y * (z - x)) / t)
def code(x, y, z, t):
	return x + ((z - x) / (t / y))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y * Float64(z - x)) / t))
end
function code(x, y, z, t)
	return Float64(x + Float64(Float64(z - x) / Float64(t / y)))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y * (z - x)) / t);
end
function tmp = code(x, y, z, t)
	tmp = x + ((z - x) / (t / y));
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(z - x\right)}{t}
x + \frac{z - x}{\frac{t}{y}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.14%
Target3.12%
Herbie3.01%
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \]

Derivation?

  1. Initial program 10.14

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

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

    [Start]10.14

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

    associate-*l/ [<=]3.13

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

    \[\leadsto x + \color{blue}{\frac{z - x}{\frac{t}{y}}} \]
  4. Final simplification3.01

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

Alternatives

Alternative 1
Error38.52%
Cost1242
\[\begin{array}{l} \mathbf{if}\;x \leq -0.04:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.75 \cdot 10^{-247} \lor \neg \left(x \leq 1.8 \cdot 10^{-186}\right) \land \left(x \leq 5.5 \cdot 10^{-100} \lor \neg \left(x \leq 1.04 \cdot 10^{-63}\right) \land x \leq 4.4 \cdot 10^{-39}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error36.52%
Cost977
\[\begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{-70}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-96} \lor \neg \left(x \leq 2.9 \cdot 10^{-80}\right) \land x \leq 4.6 \cdot 10^{-40}:\\ \;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error41.57%
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{-70}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.6 \cdot 10^{-272} \lor \neg \left(x \leq 6.5 \cdot 10^{-239}\right) \land x \leq 4.1 \cdot 10^{-97}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error41.39%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -7.6 \cdot 10^{-71}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.6 \cdot 10^{-272}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{-241}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-97}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error17.77%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+166} \lor \neg \left(y \leq 8.8 \cdot 10^{+175}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z \cdot y}{t}\\ \end{array} \]
Alternative 6
Error16.98%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-16} \lor \neg \left(x \leq 1.4 \cdot 10^{-75}\right):\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z \cdot y}{t}\\ \end{array} \]
Alternative 7
Error3.13%
Cost576
\[x + \left(z - x\right) \cdot \frac{y}{t} \]
Alternative 8
Error49.06%
Cost64
\[x \]

Error

Reproduce?

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