Average Error: 2.1 → 2.1
Time: 11.1s
Precision: binary64
Cost: 576
\[x + \left(y - x\right) \cdot \frac{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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(y - x\right) \cdot \frac{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

Original2.1
Target2.2
Herbie2.1
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} < -1013646692435.8867:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} < 0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array} \]

Derivation

  1. Initial program 2.1

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

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

Alternatives

Alternative 1
Error16.7
Cost1488
\[\begin{array}{l} t_1 := \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{if}\;\frac{z}{t} \leq -10000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{z}{t} \leq -2 \cdot 10^{-63}:\\ \;\;\;\;x\\ \mathbf{elif}\;\frac{z}{t} \leq -2 \cdot 10^{-122}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error4.8
Cost968
\[\begin{array}{l} t_1 := \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{if}\;\frac{z}{t} \leq -10000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{z}{t} \leq 0.1:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error25.5
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -5.02890998355651 \cdot 10^{-45}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.423967809968238 \cdot 10^{-78}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;x \leq -1.8072509494263347 \cdot 10^{-92}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.871973886937964 \cdot 10^{-118}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error24.1
Cost840
\[\begin{array}{l} \mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{-122}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot z}{t}\\ \end{array} \]
Alternative 5
Error4.3
Cost840
\[\begin{array}{l} t_1 := x + \frac{y}{\frac{t}{z}}\\ \mathbf{if}\;t \leq -1.755942967805514 \cdot 10^{+172}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 8.242198964747733 \cdot 10^{+162}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error25.6
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -5.02890998355651 \cdot 10^{-45}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.89711344065272 \cdot 10^{-91}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error25.0
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -5.02890998355651 \cdot 10^{-45}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.89711344065272 \cdot 10^{-91}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error2.0
Cost576
\[x + \frac{y - x}{\frac{t}{z}} \]
Alternative 9
Error31.9
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022318 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
  :precision binary64

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

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