Average Error: 45.7 → 13.5
Time: 11.3s
Precision: binary64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[-1 + \left(\frac{z}{-1} + \left(\mathsf{fma}\left(x, y, z\right) + \frac{x \cdot y}{-1}\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
-1 + \left(\frac{z}{-1} + \left(\mathsf{fma}\left(x, y, z\right) + \frac{x \cdot y}{-1}\right)\right)
(FPCore (x y z) :precision binary64 (- (fma x y z) (+ 1.0 (+ (* x y) z))))
(FPCore (x y z)
 :precision binary64
 (+ -1.0 (+ (/ z -1.0) (+ (fma x y z) (/ (* x y) -1.0)))))
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 -1.0 + ((z / -1.0) + (fma(x, y, z) + ((x * y) / -1.0)));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.7
Target0
Herbie13.5
\[-1\]

Derivation

  1. Initial program 45.7

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

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \left(1 + \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - z \cdot z}{x \cdot y - z}}\right)\]
  4. Using strategy rm
  5. Applied add-cube-cbrt_binary64_113646.8

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \left(1 + \frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - z \cdot z}{\color{blue}{\left(\sqrt[3]{x \cdot y - z} \cdot \sqrt[3]{x \cdot y - z}\right) \cdot \sqrt[3]{x \cdot y - z}}}\right)\]
  6. Applied difference-of-squares_binary64_107046.8

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \left(1 + \frac{\color{blue}{\left(x \cdot y + z\right) \cdot \left(x \cdot y - z\right)}}{\left(\sqrt[3]{x \cdot y - z} \cdot \sqrt[3]{x \cdot y - z}\right) \cdot \sqrt[3]{x \cdot y - z}}\right)\]
  7. Applied times-frac_binary64_110746.2

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \left(1 + \color{blue}{\frac{x \cdot y + z}{\sqrt[3]{x \cdot y - z} \cdot \sqrt[3]{x \cdot y - z}} \cdot \frac{x \cdot y - z}{\sqrt[3]{x \cdot y - z}}}\right)\]
  8. Taylor expanded around -inf 13.5

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

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

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

Reproduce

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

  :herbie-target
  -1.0

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