Average Error: 9.6 → 0.1
Time: 30.1s
Precision: binary64
Cost: 960
\[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
\[\left(\frac{2}{z \cdot t} + \left(\frac{x}{y} + \frac{2}{t}\right)\right) - 2 \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
(FPCore (x y z t)
 :precision binary64
 (- (+ (/ 2.0 (* z t)) (+ (/ x y) (/ 2.0 t))) 2.0))
double code(double x, double y, double z, double t) {
	return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
double code(double x, double y, double z, double t) {
	return ((2.0 / (z * t)) + ((x / y) + (2.0 / t))) - 2.0;
}
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) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
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 = ((2.0d0 / (z * t)) + ((x / y) + (2.0d0 / t))) - 2.0d0
end function
public static double code(double x, double y, double z, double t) {
	return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
public static double code(double x, double y, double z, double t) {
	return ((2.0 / (z * t)) + ((x / y) + (2.0 / t))) - 2.0;
}
def code(x, y, z, t):
	return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
def code(x, y, z, t):
	return ((2.0 / (z * t)) + ((x / y) + (2.0 / t))) - 2.0
function code(x, y, z, t)
	return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z)))
end
function code(x, y, z, t)
	return Float64(Float64(Float64(2.0 / Float64(z * t)) + Float64(Float64(x / y) + Float64(2.0 / t))) - 2.0)
end
function tmp = code(x, y, z, t)
	tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
end
function tmp = code(x, y, z, t)
	tmp = ((2.0 / (z * t)) + ((x / y) + (2.0 / t))) - 2.0;
end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\left(\frac{2}{z \cdot t} + \left(\frac{x}{y} + \frac{2}{t}\right)\right) - 2

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.6
Target0.1
Herbie0.1
\[\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right) \]

Derivation

  1. Initial program 9.6

    \[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
  2. Taylor expanded in t around 0 0.1

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

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

Alternatives

Alternative 1
Error6.0
Cost1224
\[\begin{array}{l} t_1 := \frac{2}{z \cdot t}\\ \mathbf{if}\;\frac{x}{y} \leq -0.00072:\\ \;\;\;\;\left(\frac{x}{y} + \frac{2}{t}\right) - 2\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+80}:\\ \;\;\;\;\left(t_1 + \frac{2}{t}\right) - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + t_1\\ \end{array} \]
Alternative 2
Error12.3
Cost976
\[\begin{array}{l} t_1 := \frac{2}{t \cdot z}\\ t_2 := \left(\frac{x}{y} + \frac{2}{t}\right) - 2\\ \mathbf{if}\;t \leq -1.85 \cdot 10^{-19}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 10^{-14}:\\ \;\;\;\;t_1 + \frac{2}{t}\\ \mathbf{elif}\;t \leq 8.2 \cdot 10^{+17}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.35 \cdot 10^{+161}:\\ \;\;\;\;t_1 - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - 2\\ \end{array} \]
Alternative 3
Error0.8
Cost968
\[\begin{array}{l} t_1 := \left(\frac{x}{y} + \frac{2}{t}\right) - 2\\ \mathbf{if}\;z \leq -34000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\left(\frac{\frac{2}{t}}{z} + \frac{x}{y}\right) - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error20.3
Cost844
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -4.2 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.82 \cdot 10^{-140}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{+161}:\\ \;\;\;\;\frac{2}{t \cdot z} - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error12.6
Cost844
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -2.5 \cdot 10^{-17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{+161}:\\ \;\;\;\;\frac{2}{t \cdot z} - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error12.6
Cost844
\[\begin{array}{l} t_1 := \frac{2}{t \cdot z}\\ t_2 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -2.7 \cdot 10^{-17}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1:\\ \;\;\;\;t_1 + \frac{2}{t}\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{+161}:\\ \;\;\;\;t_1 - 2\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error21.0
Cost840
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -6 \cdot 10^{+39}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+80}:\\ \;\;\;\;\frac{2}{t} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 8
Error19.6
Cost716
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -3.3 \cdot 10^{-23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{-139}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{-13}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error19.7
Cost716
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -2.5 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.1 \cdot 10^{-140}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 2.65 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{2}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error19.7
Cost716
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -3.1 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-140}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error19.3
Cost584
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -9.4 \cdot 10^{-27}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 51000000:\\ \;\;\;\;\frac{2}{t} - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error34.5
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -1.8 \cdot 10^{-23}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t \leq 9 \cdot 10^{-32}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 13
Error48.3
Cost192
\[\frac{2}{t} \]

Error

Reproduce

herbie shell --seed 2023010 
(FPCore (x y z t)
  :name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
  :precision binary64

  :herbie-target
  (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))

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