Average Error: 45.0 → 26.1
Time: 3.0s
Precision: binary64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z} \cdot \sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}\right) \cdot \left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}} \cdot \left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}} \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}}\right)\right) - 1\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z} \cdot \sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}\right) \cdot \left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}} \cdot \left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}} \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}}\right)\right) - 1
(FPCore (x y z) :precision binary64 (- (fma x y z) (+ 1.0 (+ (* x y) z))))
(FPCore (x y z)
 :precision binary64
 (-
  (*
   (* (cbrt (- (fma x y z) z)) (cbrt (- (fma x y z) z)))
   (*
    (cbrt (cbrt (- (fma x y z) z)))
    (* (cbrt (cbrt (- (fma x y z) z))) (cbrt (cbrt (- (fma x y z) z))))))
  1.0))
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) (((double) cbrt(((double) (((double) fma(x, y, z)) - z)))) * ((double) cbrt(((double) (((double) fma(x, y, z)) - z)))))) * ((double) (((double) cbrt(((double) cbrt(((double) (((double) fma(x, y, z)) - z)))))) * ((double) (((double) cbrt(((double) cbrt(((double) (((double) fma(x, y, z)) - z)))))) * ((double) cbrt(((double) cbrt(((double) (((double) fma(x, y, z)) - z)))))))))))) - 1.0));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.0
Target0
Herbie26.1
\[-1\]

Derivation

  1. Initial program 45.0

    \[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
  2. Taylor expanded around 0 46.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, z\right) - \left(z + 1\right)}\]
  3. Using strategy rm
  4. Applied associate--r+_binary6426.1

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z\right) - z\right) - 1}\]
  5. Using strategy rm
  6. Applied add-cube-cbrt_binary6426.1

    \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z} \cdot \sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}} - 1\]
  7. Using strategy rm
  8. Applied add-cube-cbrt_binary6426.1

    \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z} \cdot \sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}\right) \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}} \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}}\right) \cdot \sqrt[3]{\sqrt[3]{\mathsf{fma}\left(x, y, z\right) - z}}\right)} - 1\]
  9. Final simplification26.1

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

Reproduce

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

  :herbie-target
  -1.0

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