Average Error: 45.5 → 31.0
Time: 7.8s
Precision: binary64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - 1\right) - x \cdot y\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - 1\right) - x \cdot y
(FPCore (x y z) :precision binary64 (- (fma x y z) (+ 1.0 (+ (* x y) z))))
(FPCore (x y z) :precision binary64 (- (- (- (fma x y z) z) 1.0) (* x y)))
double code(double x, double y, double z) {
	return fma(x, y, z) - (1.0 + ((x * y) + z));
}
double code(double x, double y, double z) {
	return ((fma(x, y, z) - z) - 1.0) - (x * y);
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.5
Target0
Herbie31.0
\[-1\]

Derivation

  1. Initial program 45.5

    \[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
  2. Using strategy rm
  3. Applied add-cbrt-cube_binary64_181945.5

    \[\leadsto \color{blue}{\sqrt[3]{\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\right) \cdot \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\right)\right) \cdot \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\right)}}\]
  4. Simplified45.5

    \[\leadsto \sqrt[3]{\color{blue}{{\left(\mathsf{fma}\left(x, y, z\right) - \left(\left(z + 1\right) + x \cdot y\right)\right)}^{3}}}\]
  5. Using strategy rm
  6. Applied associate--r+_binary64_171945.5

    \[\leadsto \sqrt[3]{{\color{blue}{\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(z + 1\right)\right) - x \cdot y\right)}}^{3}}\]
  7. Using strategy rm
  8. Applied associate--r+_binary64_171931.1

    \[\leadsto \sqrt[3]{{\left(\color{blue}{\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - 1\right)} - x \cdot y\right)}^{3}}\]
  9. Using strategy rm
  10. Applied rem-cbrt-cube_binary64_180731.0

    \[\leadsto \color{blue}{\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - 1\right) - x \cdot y}\]
  11. Final simplification31.0

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

Reproduce

herbie shell --seed 2021032 
(FPCore (x y z)
  :name "simple fma test"
  :precision binary64

  :herbie-target
  -1.0

  (- (fma x y z) (+ 1.0 (+ (* x y) z))))