Average Error: 45.4 → 31.2
Time: 8.0s
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.4
Target0
Herbie31.2
\[-1\]

Derivation

  1. Initial program 45.4

    \[\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_147845.4

    \[\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.4

    \[\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_137845.4

    \[\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_137831.3

    \[\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_146631.2

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

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

Reproduce

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

  :herbie-target
  -1.0

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