Average Error: 44.4 → 7.7
Time: 21.1s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(\log \left(\frac{e^{\mathsf{fma}\left(x, y, z\right) - \left(z + x \cdot y\right)}}{e}\right)\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\left(\log \left(\frac{e^{\mathsf{fma}\left(x, y, z\right) - \left(z + x \cdot y\right)}}{e}\right)\right)\right)
double f(double x, double y, double z) {
        double r2762209 = x;
        double r2762210 = y;
        double r2762211 = z;
        double r2762212 = fma(r2762209, r2762210, r2762211);
        double r2762213 = 1.0;
        double r2762214 = r2762209 * r2762210;
        double r2762215 = r2762214 + r2762211;
        double r2762216 = r2762213 + r2762215;
        double r2762217 = r2762212 - r2762216;
        return r2762217;
}

double f(double x, double y, double z) {
        double r2762218 = x;
        double r2762219 = y;
        double r2762220 = z;
        double r2762221 = fma(r2762218, r2762219, r2762220);
        double r2762222 = r2762218 * r2762219;
        double r2762223 = r2762220 + r2762222;
        double r2762224 = r2762221 - r2762223;
        double r2762225 = exp(r2762224);
        double r2762226 = exp(1.0);
        double r2762227 = r2762225 / r2762226;
        double r2762228 = log(r2762227);
        double r2762229 = /* ERROR: no posit support in C */;
        double r2762230 = /* ERROR: no posit support in C */;
        return r2762230;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.4
Target0
Herbie7.7
\[-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 add-log-exp46.6

    \[\leadsto \left(\left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \color{blue}{\log \left(e^{\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)\]
  8. Applied add-log-exp46.6

    \[\leadsto \left(\left(\mathsf{fma}\left(x, y, z\right) - \left(\color{blue}{\log \left(e^{1}\right)} + \log \left(e^{\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)\]
  9. Applied sum-log46.6

    \[\leadsto \left(\left(\mathsf{fma}\left(x, y, z\right) - \color{blue}{\log \left(e^{1} \cdot e^{\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)\]
  10. Applied add-log-exp46.6

    \[\leadsto \left(\left(\color{blue}{\log \left(e^{\mathsf{fma}\left(x, y, z\right)}\right)} - \log \left(e^{1} \cdot e^{\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)\]
  11. Applied diff-log46.6

    \[\leadsto \left(\color{blue}{\left(\log \left(\frac{e^{\mathsf{fma}\left(x, y, z\right)}}{e^{1} \cdot e^{\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)\]
  12. Simplified7.7

    \[\leadsto \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)\]
  13. Final simplification7.7

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

Reproduce

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

  :herbie-target
  -1

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