Average Error: 45.2 → 45.4
Time: 6.0s
Precision: 64
\[\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 + \frac{x \cdot y}{\frac{x \cdot y - z}{x \cdot y}}\right)\right) + \frac{z}{\sqrt[3]{x \cdot y - z} \cdot \sqrt[3]{x \cdot y - z}} \cdot \frac{z}{\sqrt[3]{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 + \frac{x \cdot y}{\frac{x \cdot y - z}{x \cdot y}}\right)\right) + \frac{z}{\sqrt[3]{x \cdot y - z} \cdot \sqrt[3]{x \cdot y - z}} \cdot \frac{z}{\sqrt[3]{x \cdot y - z}}
double f(double x, double y, double z) {
        double r94092 = x;
        double r94093 = y;
        double r94094 = z;
        double r94095 = fma(r94092, r94093, r94094);
        double r94096 = 1.0;
        double r94097 = r94092 * r94093;
        double r94098 = r94097 + r94094;
        double r94099 = r94096 + r94098;
        double r94100 = r94095 - r94099;
        return r94100;
}

double f(double x, double y, double z) {
        double r94101 = x;
        double r94102 = y;
        double r94103 = z;
        double r94104 = fma(r94101, r94102, r94103);
        double r94105 = 1.0;
        double r94106 = r94101 * r94102;
        double r94107 = r94106 - r94103;
        double r94108 = r94107 / r94106;
        double r94109 = r94106 / r94108;
        double r94110 = r94105 + r94109;
        double r94111 = r94104 - r94110;
        double r94112 = cbrt(r94107);
        double r94113 = r94112 * r94112;
        double r94114 = r94103 / r94113;
        double r94115 = r94103 / r94112;
        double r94116 = r94114 * r94115;
        double r94117 = r94111 + r94116;
        return r94117;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.2
Target0
Herbie45.4
\[-1\]

Derivation

  1. Initial program 45.2

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

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

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

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

    \[\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 associate-/l*45.6

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

    \[\leadsto \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \frac{x \cdot y}{\frac{x \cdot y - z}{x \cdot y}}\right)\right) + \frac{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}}}\]
  12. Applied times-frac45.4

    \[\leadsto \left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \frac{x \cdot y}{\frac{x \cdot y - z}{x \cdot y}}\right)\right) + \color{blue}{\frac{z}{\sqrt[3]{x \cdot y - z} \cdot \sqrt[3]{x \cdot y - z}} \cdot \frac{z}{\sqrt[3]{x \cdot y - z}}}\]
  13. Final simplification45.4

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

Reproduce

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

  :herbie-target
  -1

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