Average Error: 45.4 → 8.6
Time: 3.7s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\sqrt[3]{{\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(z + x \cdot y\right)\right) - 1\right)}^{3}}\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\sqrt[3]{{\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(z + x \cdot y\right)\right) - 1\right)}^{3}}
double f(double x, double y, double z) {
        double r97565 = x;
        double r97566 = y;
        double r97567 = z;
        double r97568 = fma(r97565, r97566, r97567);
        double r97569 = 1.0;
        double r97570 = r97565 * r97566;
        double r97571 = r97570 + r97567;
        double r97572 = r97569 + r97571;
        double r97573 = r97568 - r97572;
        return r97573;
}

double f(double x, double y, double z) {
        double r97574 = x;
        double r97575 = y;
        double r97576 = z;
        double r97577 = fma(r97574, r97575, r97576);
        double r97578 = r97574 * r97575;
        double r97579 = r97576 + r97578;
        double r97580 = r97577 - r97579;
        double r97581 = 1.0;
        double r97582 = r97580 - r97581;
        double r97583 = 3.0;
        double r97584 = pow(r97582, r97583);
        double r97585 = cbrt(r97584);
        return r97585;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.4
Target0
Herbie8.6
\[-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-cube45.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(z + \left(x \cdot y + 1\right)\right)\right)}^{3}}}\]
  5. Using strategy rm
  6. Applied associate--r+31.5

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

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

    \[\leadsto \sqrt[3]{{\left(\color{blue}{\left(\mathsf{fma}\left(x, y, z\right) - \left(z + x \cdot y\right)\right)} - 1\right)}^{3}}\]
  11. Final simplification8.6

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

Reproduce

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

  :herbie-target
  -1

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