Average Error: 9.4 → 0.1
Time: 2.8s
Precision: 64
\[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}\]
\[\left(\frac{\frac{2}{z} + 2}{t} + \frac{x}{y}\right) - 2\]
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\left(\frac{\frac{2}{z} + 2}{t} + \frac{x}{y}\right) - 2
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) + 2.0) / t) + (x / y)) - 2.0);
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 9.4

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

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

    \[\leadsto \frac{x}{y} + \color{blue}{\left(\frac{1}{t} \cdot \left(\frac{2}{z} + 2\right) - 2\right)}\]
  4. Using strategy rm
  5. Applied associate-+r-0.1

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

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

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

Reproduce

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

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

  (+ (/ x y) (/ (+ 2 (* (* z 2) (- 1 t))) (* t z))))