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

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[\frac{x \cdot y}{2} - \frac{z}{8} \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, -0.125, \frac{x \cdot y}{2}\right)} \]
  3. Applied egg-rr0.6

    \[\leadsto \mathsf{fma}\left(z, -0.125, \color{blue}{{\left(\sqrt[3]{x \cdot y}\right)}^{2} \cdot \left(\sqrt[3]{x \cdot y} \cdot 0.5\right)}\right) \]
  4. Taylor expanded in z around 0 0.0

    \[\leadsto \color{blue}{0.5 \cdot \left(y \cdot x\right) - 0.125 \cdot z} \]
  5. Simplified0.0

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

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

Reproduce

herbie shell --seed 2022130 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, D"
  :precision binary64
  (- (/ (* x y) 2.0) (/ z 8.0)))