Average Error: 44.4 → 8.0
Time: 21.3s
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 r2379029 = x;
        double r2379030 = y;
        double r2379031 = z;
        double r2379032 = fma(r2379029, r2379030, r2379031);
        double r2379033 = 1.0;
        double r2379034 = r2379029 * r2379030;
        double r2379035 = r2379034 + r2379031;
        double r2379036 = r2379033 + r2379035;
        double r2379037 = r2379032 - r2379036;
        return r2379037;
}

double f(double x, double y, double z) {
        double r2379038 = x;
        double r2379039 = y;
        double r2379040 = z;
        double r2379041 = fma(r2379038, r2379039, r2379040);
        double r2379042 = r2379038 * r2379039;
        double r2379043 = r2379040 + r2379042;
        double r2379044 = r2379041 - r2379043;
        double r2379045 = exp(r2379044);
        double r2379046 = exp(1.0);
        double r2379047 = r2379045 / r2379046;
        double r2379048 = log(r2379047);
        double r2379049 = /* ERROR: no posit support in C */;
        double r2379050 = /* ERROR: no posit support in C */;
        double r2379051 = /* ERROR: no posit support in C */;
        double r2379052 = /* ERROR: no posit support in C */;
        return r2379052;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.4
Target0
Herbie8.0
\[-1\]

Derivation

  1. Initial program 44.4

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

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

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

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

    \[\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) - \left(1 + \color{blue}{\log \left(e^{z}\right)}\right)\right)\right)\right)\right)\]
  11. Applied add-log-exp35.4

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

    \[\leadsto \left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - x \cdot y\right) - \color{blue}{\log \left(e^{1} \cdot e^{z}\right)}\right)\right)\right)\right)\]
  13. Applied add-log-exp46.7

    \[\leadsto \left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - \color{blue}{\log \left(e^{x \cdot y}\right)}\right) - \log \left(e^{1} \cdot e^{z}\right)\right)\right)\right)\right)\]
  14. Applied add-log-exp46.7

    \[\leadsto \left(\left(\left(\left(\left(\color{blue}{\log \left(e^{\mathsf{fma}\left(x, y, z\right)}\right)} - \log \left(e^{x \cdot y}\right)\right) - \log \left(e^{1} \cdot e^{z}\right)\right)\right)\right)\right)\]
  15. Applied diff-log46.7

    \[\leadsto \left(\left(\left(\left(\color{blue}{\log \left(\frac{e^{\mathsf{fma}\left(x, y, z\right)}}{e^{x \cdot y}}\right)} - \log \left(e^{1} \cdot e^{z}\right)\right)\right)\right)\right)\]
  16. Applied diff-log46.7

    \[\leadsto \left(\left(\left(\color{blue}{\left(\log \left(\frac{\frac{e^{\mathsf{fma}\left(x, y, z\right)}}{e^{x \cdot y}}}{e^{1} \cdot e^{z}}\right)\right)}\right)\right)\right)\]
  17. Simplified8.0

    \[\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)\]
  18. Final simplification8.0

    \[\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 2019146 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

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