Average Error: 9.3 → 0.1
Time: 6.0s
Precision: binary64
\[\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z} \]
\[\left(\left(\frac{2}{t \cdot z} + \frac{x}{y}\right) + \frac{2}{t}\right) - 2 \]
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\left(\left(\frac{2}{t \cdot z} + \frac{x}{y}\right) + \frac{2}{t}\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 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 / t)) - 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.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. Simplified0.1

    \[\leadsto \color{blue}{\frac{x}{y} + \left(-2 - \frac{-2 + \frac{-2}{z}}{t}\right)} \]
  3. Applied div-inv_binary640.2

    \[\leadsto \color{blue}{x \cdot \frac{1}{y}} + \left(-2 - \frac{-2 + \frac{-2}{z}}{t}\right) \]
  4. Applied fma-def_binary640.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{1}{y}, -2 - \frac{-2 + \frac{-2}{z}}{t}\right)} \]
  5. Taylor expanded in x around 0 0.1

    \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{t} + \left(\frac{x}{y} + 2 \cdot \frac{1}{t \cdot z}\right)\right) - 2} \]
  6. Applied associate-/r*_binary640.1

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

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

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

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

Reproduce

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