?

Average Error: 2.0 → 2.0
Time: 8.9s
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.0
Target2.2
Herbie2.0
\[\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.0

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

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

Alternatives

Alternative 1
Error28.3
Cost1112
\[\begin{array}{l} \mathbf{if}\;x \leq -96000000:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -3.1 \cdot 10^{-106}:\\ \;\;\;\;-\frac{z \cdot x}{t}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-129}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.65 \cdot 10^{-190}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-218}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-61}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error29.1
Cost1112
\[\begin{array}{l} \mathbf{if}\;x \leq -9.6 \cdot 10^{+58}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-106}:\\ \;\;\;\;\left(-\frac{x}{t}\right) \cdot z\\ \mathbf{elif}\;x \leq -1.38 \cdot 10^{-129}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.36 \cdot 10^{-190}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-217}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{-62}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error18.7
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -7.5 \cdot 10^{-130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-190}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.8 \cdot 10^{-62}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error18.3
Cost976
\[\begin{array}{l} t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.7 \cdot 10^{-191}:\\ \;\;\;\;\frac{y - x}{t} \cdot z\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 10^{-61}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error6.5
Cost968
\[\begin{array}{l} t_1 := \frac{y - x}{t} \cdot z\\ \mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{+18}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{z}{t} \leq 100:\\ \;\;\;\;x + \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error27.2
Cost848
\[\begin{array}{l} t_1 := \frac{y}{t} \cdot z\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{-129}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.9 \cdot 10^{-191}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.9 \cdot 10^{-236}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error26.8
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-129}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-191}:\\ \;\;\;\;\frac{y}{t} \cdot z\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-217}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.3 \cdot 10^{-62}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error31.9
Cost64
\[x \]

Error

Reproduce?

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