Average Error: 2.0 → 2.0
Time: 15.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.3
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} \]

Alternatives

Alternative 1
Error23.4
Cost1164
\[\begin{array}{l} t_1 := \frac{z}{t} \cdot y\\ \mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-124}:\\ \;\;\;\;x\\ \mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{+175}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-\frac{z \cdot x}{t}\\ \end{array} \]
Alternative 2
Error20.7
Cost976
\[\begin{array}{l} t_1 := \frac{z}{t} \cdot y\\ t_2 := \left(1 - \frac{z}{t}\right) \cdot x\\ \mathbf{if}\;y \leq -1.15 \cdot 10^{+48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-7}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -9.6 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error29.5
Cost848
\[\begin{array}{l} t_1 := \frac{y}{t} \cdot z\\ \mathbf{if}\;z \leq -4.9 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-165}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-115}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-26}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error11.2
Cost844
\[\begin{array}{l} t_1 := x + \frac{y}{t} \cdot z\\ \mathbf{if}\;y \leq -2.5 \cdot 10^{+222}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-56}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-114}:\\ \;\;\;\;\left(1 - \frac{z}{t}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error23.6
Cost840
\[\begin{array}{l} t_1 := \frac{z}{t} \cdot y\\ \mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-124}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error8.0
Cost712
\[\begin{array}{l} t_1 := x + \frac{z}{t} \cdot y\\ \mathbf{if}\;y \leq -6.1 \cdot 10^{-58}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-96}:\\ \;\;\;\;\left(1 - \frac{z}{t}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error31.4
Cost64
\[x \]

Error

Reproduce

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