Average Error: 0.1 → 0.1
Time: 5.3s
Precision: binary64
\[\frac{\left(x + y\right) - z}{t \cdot 2} \]
\[\mathsf{fma}\left(0.5, \frac{x}{t} + \frac{y}{t}, \frac{z}{t} \cdot -0.5\right) \]
\frac{\left(x + y\right) - z}{t \cdot 2}
\mathsf{fma}\left(0.5, \frac{x}{t} + \frac{y}{t}, \frac{z}{t} \cdot -0.5\right)
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
(FPCore (x y z t)
 :precision binary64
 (fma 0.5 (+ (/ x t) (/ y t)) (* (/ z t) -0.5)))
double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
double code(double x, double y, double z, double t) {
	return fma(0.5, ((x / t) + (y / t)), ((z / t) * -0.5));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 0.1

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

    \[\leadsto \color{blue}{\left(0.5 \cdot \frac{x}{t} + 0.5 \cdot \frac{y}{t}\right) - 0.5 \cdot \frac{z}{t}} \]
  3. Applied distribute-lft-out_binary640.1

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{x}{t} + \frac{y}{t}, -0.5 \cdot \frac{z}{t}\right)} \]
  5. Simplified0.1

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

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

Reproduce

herbie shell --seed 2021275 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B"
  :precision binary64
  (/ (- (+ x y) z) (* t 2.0)))