Average Error: 9.5 → 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}\]
\[\mathsf{fma}\left(\left(\frac{1}{z} + 1\right) - t, \frac{2}{t}, \frac{x}{y}\right)\]
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\mathsf{fma}\left(\left(\frac{1}{z} + 1\right) - t, \frac{2}{t}, \frac{x}{y}\right)
double code(double x, double y, double z, double t) {
	return ((double) (((double) (x / y)) + ((double) (((double) (2.0 + ((double) (((double) (z * 2.0)) * ((double) (1.0 - t)))))) / ((double) (t * z))))));
}
double code(double x, double y, double z, double t) {
	return ((double) fma(((double) (((double) (((double) (1.0 / z)) + 1.0)) - t)), ((double) (2.0 / t)), ((double) (x / y))));
}

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.5
Target0.1
Herbie0.1
\[\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)\]

Derivation

  1. Initial program 9.5

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

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

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

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

Reproduce

herbie shell --seed 2020123 +o rules:numerics
(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))))