?

Average Error: 6.0 → 2.1
Time: 9.4s
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.0
Target2.1
Herbie2.1
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \]

Derivation?

  1. Initial program 6.0

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

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

    [Start]6.0

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

    associate-*l/ [<=]2.1

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

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

Alternatives

Alternative 1
Error27.0
Cost1636
\[\begin{array}{l} t_1 := y \cdot \frac{z - x}{t}\\ t_2 := \frac{z}{\frac{t}{y}}\\ \mathbf{if}\;t \leq -1.05 \cdot 10^{+178}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.25 \cdot 10^{+131}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -8 \cdot 10^{+112}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.3 \cdot 10^{-54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -5.2 \cdot 10^{-100}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.85 \cdot 10^{-125}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -4.9 \cdot 10^{-220}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-187}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error24.0
Cost1240
\[\begin{array}{l} t_1 := y \cdot \frac{z - x}{t}\\ \mathbf{if}\;t \leq -1.05 \cdot 10^{+178}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -8.5 \cdot 10^{+130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -5.5 \cdot 10^{+112}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -8.8 \cdot 10^{-54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.66 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 6.4 \cdot 10^{+37}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error27.3
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-76}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-244} \lor \neg \left(x \leq 9.5 \cdot 10^{-152}\right) \land x \leq 1.45 \cdot 10^{-71}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error26.7
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -6.6 \cdot 10^{-72}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-223} \lor \neg \left(x \leq 9.5 \cdot 10^{-152}\right) \land x \leq 1.6 \cdot 10^{-72}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error26.9
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -6.6 \cdot 10^{-68}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-222}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-148}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-74}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error10.5
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -11500000000000 \lor \neg \left(x \leq 1.25 \cdot 10^{+89}\right):\\ \;\;\;\;x - \frac{x}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \end{array} \]
Alternative 7
Error11.3
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+169}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+57}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - x}{t}\\ \end{array} \]
Alternative 8
Error31.7
Cost64
\[x \]

Error

Reproduce?

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