Average Error: 44.7 → 8.2
Time: 23.3s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(\left(\left(-1 + \left(\mathsf{fma}\left(x, y, z\right) - \left(z + y \cdot x\right)\right)\right)\right)\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\left(\left(\left(-1 + \left(\mathsf{fma}\left(x, y, z\right) - \left(z + y \cdot x\right)\right)\right)\right)\right)\right)
double f(double x, double y, double z) {
        double r2388156 = x;
        double r2388157 = y;
        double r2388158 = z;
        double r2388159 = fma(r2388156, r2388157, r2388158);
        double r2388160 = 1.0;
        double r2388161 = r2388156 * r2388157;
        double r2388162 = r2388161 + r2388158;
        double r2388163 = r2388160 + r2388162;
        double r2388164 = r2388159 - r2388163;
        return r2388164;
}

double f(double x, double y, double z) {
        double r2388165 = -1.0;
        double r2388166 = x;
        double r2388167 = y;
        double r2388168 = z;
        double r2388169 = fma(r2388166, r2388167, r2388168);
        double r2388170 = r2388167 * r2388166;
        double r2388171 = r2388168 + r2388170;
        double r2388172 = r2388169 - r2388171;
        double r2388173 = r2388165 + r2388172;
        double r2388174 = /* ERROR: no posit support in C */;
        double r2388175 = /* ERROR: no posit support in C */;
        double r2388176 = /* ERROR: no posit support in C */;
        double r2388177 = /* ERROR: no posit support in C */;
        return r2388177;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.7
Target0
Herbie8.2
\[-1\]

Derivation

  1. Initial program 44.7

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

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

    \[\leadsto \left(\left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \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)\right)\right)\]
  6. Using strategy rm
  7. Applied insert-posit1643.9

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

    \[\leadsto \left(\left(\color{blue}{\left(\left(-1 + \left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - x \cdot y\right)\right)\right)}\right)\right)\]
  9. Taylor expanded around -inf 8.2

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

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

Reproduce

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

  :herbie-target
  -1

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