?

Average Error: 9.3 → 0.1
Time: 14.5s
Precision: binary64
Cost: 1088

?

\[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
\[\left(\frac{2}{t \cdot z} + \left(\frac{x}{y} + 2 \cdot \frac{1}{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 (* t z)) (+ (/ x y) (* 2.0 (/ 1.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 / (t * z)) + ((x / y) + (2.0 * (1.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 / (t * z)) + ((x / y) + (2.0d0 * (1.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 / (t * z)) + ((x / y) + (2.0 * (1.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 / (t * z)) + ((x / y) + (2.0 * (1.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(t * z)) + Float64(Float64(x / y) + Float64(2.0 * Float64(1.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 / (t * z)) + ((x / y) + (2.0 * (1.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[(t * z), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] + N[(2.0 * N[(1.0 / t), $MachinePrecision]), $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}{t \cdot z} + \left(\frac{x}{y} + 2 \cdot \frac{1}{t}\right)\right) - 2

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Initial program 9.3

    \[\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. Final simplification0.1

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

Alternatives

Alternative 1
Error17.1
Cost1636
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := \frac{2}{z \cdot t} - 2\\ t_3 := \frac{x}{y} + \frac{2}{t \cdot z}\\ t_4 := \frac{x}{y} + 2 \cdot \frac{1}{t}\\ \mathbf{if}\;t \leq -1.4 \cdot 10^{+175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -7.2 \cdot 10^{+111}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -8 \cdot 10^{+61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -440000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-155}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{-63}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 9.8 \cdot 10^{-14}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{+21}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{+168}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error13.4
Cost1372
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ t_2 := \frac{2}{z \cdot t} - 2\\ \mathbf{if}\;t \leq -1.3 \cdot 10^{+175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -7.2 \cdot 10^{+111}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\ \mathbf{elif}\;t \leq -1 \cdot 10^{+62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -440000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -2.3 \cdot 10^{-18}:\\ \;\;\;\;\frac{x}{y} + 2 \cdot \frac{1}{t}\\ \mathbf{elif}\;t \leq 1:\\ \;\;\;\;\frac{2 + 2 \cdot \frac{1}{z}}{t}\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{+167}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error0.8
Cost1352
\[\begin{array}{l} t_1 := \frac{x}{y} + \frac{2 \cdot z + 2}{t \cdot z}\\ \mathbf{if}\;\frac{x}{y} \leq -2.2:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 2:\\ \;\;\;\;\left(\frac{2}{t \cdot z} + \frac{2}{t}\right) - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error0.1
Cost1352
\[\begin{array}{l} t_1 := \frac{x}{y} + 2 \cdot \frac{1 - t}{t}\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 720000000000:\\ \;\;\;\;\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error30.6
Cost1232
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -45000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -3.8 \cdot 10^{-64}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{elif}\;\frac{x}{y} \leq 9.5 \cdot 10^{-19}:\\ \;\;\;\;-2\\ \mathbf{elif}\;\frac{x}{y} \leq 1.5 \cdot 10^{+31}:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 6
Error6.5
Cost1232
\[\begin{array}{l} t_1 := \frac{2}{z \cdot t} - 2\\ t_2 := \frac{x}{y} + 2 \cdot \frac{1 - t}{t}\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{-26}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.04 \cdot 10^{-131}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-113}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 0.000116:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error6.5
Cost1232
\[\begin{array}{l} t_1 := \frac{x}{y} + 2 \cdot \frac{1 - t}{t}\\ t_2 := \frac{2}{t \cdot z}\\ \mathbf{if}\;z \leq -2.8 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-132}:\\ \;\;\;\;\frac{2}{z \cdot t} - 2\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{-113}:\\ \;\;\;\;\frac{x}{y} + t_2\\ \mathbf{elif}\;z \leq 16000000000:\\ \;\;\;\;\left(t_2 + \frac{2}{t}\right) - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error6.4
Cost1232
\[\begin{array}{l} t_1 := \frac{x}{y} + 2 \cdot \frac{1 - t}{t}\\ \mathbf{if}\;z \leq -4 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-132}:\\ \;\;\;\;\frac{2}{z \cdot t} - 2\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-113}:\\ \;\;\;\;\frac{x}{y} + \frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 6100:\\ \;\;\;\;\frac{2 + 2 \cdot \frac{1}{z}}{t} - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error18.8
Cost972
\[\begin{array}{l} t_1 := \frac{2}{t} - 2\\ \mathbf{if}\;z \leq -1:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 30.5:\\ \;\;\;\;\frac{2}{z \cdot t} - 2\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+128}:\\ \;\;\;\;\frac{x}{y} + 2 \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error20.1
Cost840
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -45000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2.95 \cdot 10^{+38}:\\ \;\;\;\;\frac{2}{t} - 2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 11
Error23.5
Cost716
\[\begin{array}{l} t_1 := \frac{2}{t} - 2\\ \mathbf{if}\;z \leq -0.0305:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{-69}:\\ \;\;\;\;\frac{2}{t \cdot z}\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+84}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error18.9
Cost716
\[\begin{array}{l} t_1 := \frac{2}{t} - 2\\ \mathbf{if}\;z \leq -1:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2450:\\ \;\;\;\;\frac{2}{z \cdot t} - 2\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+86}:\\ \;\;\;\;\frac{x}{y} - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error19.9
Cost584
\[\begin{array}{l} t_1 := \frac{x}{y} - 2\\ \mathbf{if}\;t \leq -29:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 70000:\\ \;\;\;\;\frac{2}{t} - 2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error33.7
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -150:\\ \;\;\;\;-2\\ \mathbf{elif}\;t \leq 80000000000000:\\ \;\;\;\;\frac{2}{t}\\ \mathbf{else}:\\ \;\;\;\;-2\\ \end{array} \]
Alternative 15
Error47.0
Cost64
\[-2 \]

Error

Reproduce?

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