Average Error: 45.0 → 44.9
Time: 7.1s
Precision: binary64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y\right) \cdot \frac{x \cdot y}{x \cdot y - z}\right)\right) + z \cdot \frac{z}{x \cdot y - z}\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y\right) \cdot \frac{x \cdot y}{x \cdot y - z}\right)\right) + z \cdot \frac{z}{x \cdot y - z}
double code(double x, double y, double z) {
	return ((double) (((double) fma(x, y, z)) - ((double) (1.0 + ((double) (((double) (x * y)) + z))))));
}
double code(double x, double y, double z) {
	return ((double) (((double) (((double) fma(x, y, z)) - ((double) (1.0 + ((double) (((double) (x * y)) * ((double) (((double) (x * y)) / ((double) (((double) (x * y)) - z)))))))))) + ((double) (z * ((double) (z / ((double) (((double) (x * y)) - z))))))));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original45.0
Target0
Herbie44.9
\[-1\]

Derivation

  1. Initial program 45.0

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

    \[\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 div-sub45.7

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \left(1 + \color{blue}{\left(\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z} - \frac{z \cdot z}{x \cdot y - z}\right)}\right)\]
  6. Applied associate-+r-45.7

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \color{blue}{\left(\left(1 + \frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z}\right) - \frac{z \cdot z}{x \cdot y - z}\right)}\]
  7. Applied associate--r-45.7

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z}\right)\right) + \frac{z \cdot z}{x \cdot y - z}}\]
  8. Using strategy rm
  9. Applied *-un-lft-identity45.7

    \[\leadsto \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{\color{blue}{1 \cdot \left(x \cdot y - z\right)}}\right)\right) + \frac{z \cdot z}{x \cdot y - z}\]
  10. Applied times-frac45.4

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

    \[\leadsto \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \color{blue}{\left(x \cdot y\right)} \cdot \frac{x \cdot y}{x \cdot y - z}\right)\right) + \frac{z \cdot z}{x \cdot y - z}\]
  12. Using strategy rm
  13. Applied *-un-lft-identity45.4

    \[\leadsto \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y\right) \cdot \frac{x \cdot y}{x \cdot y - z}\right)\right) + \frac{z \cdot z}{\color{blue}{1 \cdot \left(x \cdot y - z\right)}}\]
  14. Applied times-frac44.9

    \[\leadsto \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y\right) \cdot \frac{x \cdot y}{x \cdot y - z}\right)\right) + \color{blue}{\frac{z}{1} \cdot \frac{z}{x \cdot y - z}}\]
  15. Simplified44.9

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

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

Reproduce

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

  :herbie-target
  -1.0

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