?

Average Error: 6.8 → 1.9
Time: 10.1s
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.8
Target1.9
Herbie1.9
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \]

Derivation?

  1. Initial program 6.8

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

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

    [Start]6.8

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

    associate-*l/ [<=]1.9

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

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

Alternatives

Alternative 1
Error23.4
Cost1504
\[\begin{array}{l} t_1 := \frac{y}{t} \cdot \left(z - x\right)\\ t_2 := y \cdot \frac{z - x}{t}\\ \mathbf{if}\;y \leq -2.2 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-251}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-220}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-65}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+17}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error22.4
Cost1240
\[\begin{array}{l} t_1 := y \cdot \frac{z - x}{t}\\ \mathbf{if}\;y \leq -7.8 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.1 \cdot 10^{-30}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{-21}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+19}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error26.9
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-106}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-148} \lor \neg \left(x \leq 2.5 \cdot 10^{-49}\right) \land x \leq 8.5 \cdot 10^{-12}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error26.2
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-103}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{-146} \lor \neg \left(x \leq 7.5 \cdot 10^{-65}\right) \land x \leq 2.02 \cdot 10^{-10}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error10.8
Cost844
\[\begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+133}:\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-88}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+166}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \end{array} \]
Alternative 6
Error11.4
Cost713
\[\begin{array}{l} \mathbf{if}\;t \leq -1.55 \cdot 10^{-46} \lor \neg \left(t \leq 1.02 \cdot 10^{-140}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \end{array} \]
Alternative 7
Error31.7
Cost64
\[x \]

Error

Reproduce?

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