?

Average Error: 6.5 → 2.0
Time: 14.6s
Precision: binary64
Cost: 576

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.5
Target2.0
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array} \]

Derivation?

  1. Initial program 6.5

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

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

    [Start]6.5

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

    rational.json-simplify-2 [=>]6.5

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

    rational.json-simplify-49 [=>]2.0

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

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

Alternatives

Alternative 1
Error18.7
Cost1240
\[\begin{array}{l} t_1 := y \cdot \frac{z}{t}\\ t_2 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -4 \cdot 10^{-114}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-191}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-240}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-286}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-148}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error18.1
Cost1240
\[\begin{array}{l} t_1 := \frac{z}{t} \cdot \left(y - x\right)\\ t_2 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -8.8 \cdot 10^{-63}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-191}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-240}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-286}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-146}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error27.9
Cost1112
\[\begin{array}{l} t_1 := y \cdot \frac{z}{t}\\ \mathbf{if}\;x \leq -1.45 \cdot 10^{-62}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.85 \cdot 10^{-158}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{-192}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-240}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-286}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-154}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error27.8
Cost1112
\[\begin{array}{l} t_1 := y \cdot \frac{z}{t}\\ \mathbf{if}\;x \leq -6.6 \cdot 10^{-63}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -8.2 \cdot 10^{-192}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-240}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-286}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-145}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error29.9
Cost848
\[\begin{array}{l} t_1 := y \cdot \frac{z}{t}\\ \mathbf{if}\;z \leq -6 \cdot 10^{+139}:\\ \;\;\;\;x \cdot \left(-\frac{z}{t}\right)\\ \mathbf{elif}\;z \leq -2.05 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -1.85 \cdot 10^{+45}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-38}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error5.0
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -8.8 \cdot 10^{+139}:\\ \;\;\;\;x - x \cdot \frac{z}{t}\\ \mathbf{elif}\;x \leq 23000000:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\ \end{array} \]
Alternative 7
Error7.9
Cost712
\[\begin{array}{l} t_1 := x + y \cdot \frac{z}{t}\\ \mathbf{if}\;y \leq -1.75 \cdot 10^{-74}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-133}:\\ \;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error31.9
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023074 
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

  (+ x (/ (* (- y x) z) t)))