Average Error: 9.6 → 0.1
Time: 12.0s
Precision: binary64
Cost: 832
\[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
\[\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right) \]
(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
 (+ (/ x y) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
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 (x / y) + (-2.0 + ((2.0 + (2.0 / 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) + ((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 = (x / y) + ((-2.0d0) + ((2.0d0 + (2.0d0 / z)) / t))
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 (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t));
}
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 (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t))
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(x / y) + Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t)))
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 = (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t));
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[(x / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)

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. Simplified0.1

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

    [Start]9.6

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

    +-rgt-identity [<=]9.6

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

    mul0-lft [<=]9.6

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

    associate-+r+ [<=]9.6

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

    mul0-lft [=>]9.6

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

    +-lft-identity [=>]9.6

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

    sub-neg [=>]9.6

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

    distribute-rgt-in [=>]9.6

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

    associate-+r+ [=>]9.6

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

    cancel-sign-sub-inv [<=]9.6

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

    div-sub [=>]9.6

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

    associate-*r* [=>]9.6

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

    associate-*l/ [<=]9.6

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

    *-inverses [=>]0.2

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

    metadata-eval [=>]0.2

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

    sub-neg [=>]0.2

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

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

Alternatives

Alternative 1
Error5.3
Cost1096
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+34}:\\ \;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\ \end{array} \]
Alternative 2
Error19.2
Cost976
\[\begin{array}{l} t_1 := -2 + \frac{2}{z \cdot t}\\ t_2 := \frac{x}{y} + -2\\ \mathbf{if}\;t \leq -1.7 \cdot 10^{+123}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -0.7:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-72}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq 2 \cdot 10^{+77}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error6.7
Cost972
\[\begin{array}{l} t_1 := \frac{2}{z \cdot t}\\ t_2 := \frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{if}\;z \leq -1.08 \cdot 10^{-32}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-258}:\\ \;\;\;\;\frac{x}{y} + t_1\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-7}:\\ \;\;\;\;-2 + t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error0.7
Cost969
\[\begin{array}{l} \mathbf{if}\;z \leq -21.5 \lor \neg \left(z \leq 4.4 \cdot 10^{-7}\right):\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{z \cdot t}\right)\\ \end{array} \]
Alternative 5
Error13.0
Cost844
\[\begin{array}{l} t_1 := \frac{x}{y} + -2\\ \mathbf{if}\;t \leq -4.9 \cdot 10^{+125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -120000000:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \mathbf{elif}\;t \leq 2.1 \cdot 10^{+65}:\\ \;\;\;\;\frac{2 + \frac{2}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error20.1
Cost841
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -20000000000 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+34}\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \end{array} \]
Alternative 7
Error8.7
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{-153} \lor \neg \left(z \leq 1.6 \cdot 10^{-7}\right):\\ \;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;-2 + \frac{2}{z \cdot t}\\ \end{array} \]
Alternative 8
Error20.1
Cost840
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -20000000000:\\ \;\;\;\;\frac{x}{y} + -2\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+34}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 9
Error20.5
Cost716
\[\begin{array}{l} t_1 := \frac{x}{y} + -2\\ \mathbf{if}\;t \leq -0.38:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-77}:\\ \;\;\;\;-2 + \frac{2}{t}\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+65}:\\ \;\;\;\;\frac{2}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error35.2
Cost712
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -20000000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+34}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 11
Error48.4
Cost192
\[\frac{2}{t} \]

Error

Reproduce

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