Average Error: 44.8 → 7.5
Time: 23.0s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(\left(\left(\log \left(\frac{e^{\mathsf{fma}\left(x, y, z\right) - \left(z + x \cdot y\right)}}{e}\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(\log \left(\frac{e^{\mathsf{fma}\left(x, y, z\right) - \left(z + x \cdot y\right)}}{e}\right)\right)\right)\right)\right)
double f(double x, double y, double z) {
        double r2146779 = x;
        double r2146780 = y;
        double r2146781 = z;
        double r2146782 = fma(r2146779, r2146780, r2146781);
        double r2146783 = 1.0;
        double r2146784 = r2146779 * r2146780;
        double r2146785 = r2146784 + r2146781;
        double r2146786 = r2146783 + r2146785;
        double r2146787 = r2146782 - r2146786;
        return r2146787;
}

double f(double x, double y, double z) {
        double r2146788 = x;
        double r2146789 = y;
        double r2146790 = z;
        double r2146791 = fma(r2146788, r2146789, r2146790);
        double r2146792 = r2146788 * r2146789;
        double r2146793 = r2146790 + r2146792;
        double r2146794 = r2146791 - r2146793;
        double r2146795 = exp(r2146794);
        double r2146796 = exp(1.0);
        double r2146797 = r2146795 / r2146796;
        double r2146798 = log(r2146797);
        double r2146799 = /* ERROR: no posit support in C */;
        double r2146800 = /* ERROR: no posit support in C */;
        double r2146801 = /* ERROR: no posit support in C */;
        double r2146802 = /* ERROR: no posit support in C */;
        return r2146802;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.8
Target0
Herbie7.5
\[-1\]

Derivation

  1. Initial program 44.8

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

    \[\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-cbrt44.1

    \[\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-posit1644.1

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

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

    \[\leadsto \left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - x \cdot y\right) - \color{blue}{\log \left(e^{1 + z}\right)}\right)\right)\right)\right)\]
  11. Applied add-log-exp35.4

    \[\leadsto \left(\left(\left(\left(\color{blue}{\log \left(e^{\mathsf{fma}\left(x, y, z\right) - x \cdot y}\right)} - \log \left(e^{1 + z}\right)\right)\right)\right)\right)\]
  12. Applied diff-log35.4

    \[\leadsto \left(\left(\left(\color{blue}{\left(\log \left(\frac{e^{\mathsf{fma}\left(x, y, z\right) - x \cdot y}}{e^{1 + z}}\right)\right)}\right)\right)\right)\]
  13. Simplified7.5

    \[\leadsto \left(\left(\left(\left(\log \color{blue}{\left(\frac{e^{\mathsf{fma}\left(x, y, z\right) - \left(x \cdot y + z\right)}}{e}\right)}\right)\right)\right)\right)\]
  14. Final simplification7.5

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

Reproduce

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

  :herbie-target
  -1

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