?

Average Error: 6.7 → 2.0
Time: 10.6s
Precision: binary64
Cost: 576

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.7
Target2.0
Herbie2.0
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \]

Derivation?

  1. Initial program 6.7

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

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

    [Start]6.7

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

    associate-*l/ [<=]2.0

    \[ x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
  3. Final simplification2.0

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

Alternatives

Alternative 1
Error19.3
Cost978
\[\begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{-26} \lor \neg \left(x \leq -1.5 \cdot 10^{-124}\right) \land \left(x \leq -1.8 \cdot 10^{-172} \lor \neg \left(x \leq 6 \cdot 10^{-89}\right)\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \end{array} \]
Alternative 2
Error17.4
Cost978
\[\begin{array}{l} \mathbf{if}\;x \leq -2.85 \cdot 10^{-26} \lor \neg \left(x \leq -8 \cdot 10^{-125}\right) \land \left(x \leq -1.46 \cdot 10^{-171} \lor \neg \left(x \leq 8 \cdot 10^{-55}\right)\right):\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \end{array} \]
Alternative 3
Error27.6
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-25}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{-137} \lor \neg \left(x \leq -2.05 \cdot 10^{-171}\right) \land x \leq 1.48 \cdot 10^{-33}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error29.0
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-25}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-137} \lor \neg \left(x \leq -5.8 \cdot 10^{-172}\right) \land x \leq 2.6 \cdot 10^{+82}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error29.0
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -7.5 \cdot 10^{-26}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-137}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-171}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+82}:\\ \;\;\;\;\frac{z}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error7.8
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{-110} \lor \neg \left(z \leq 2.3 \cdot 10^{-96}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \end{array} \]
Alternative 7
Error7.8
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{-110}:\\ \;\;\;\;x + \frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-97}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \end{array} \]
Alternative 8
Error7.8
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;x + \frac{z}{\frac{t}{y}}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-97}:\\ \;\;\;\;x - x \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \end{array} \]
Alternative 9
Error31.1
Cost64
\[x \]

Error

Reproduce?

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