Average Error: 44.3 → 7.5
Time: 21.3s
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 r3322185 = x;
        double r3322186 = y;
        double r3322187 = z;
        double r3322188 = fma(r3322185, r3322186, r3322187);
        double r3322189 = 1.0;
        double r3322190 = r3322185 * r3322186;
        double r3322191 = r3322190 + r3322187;
        double r3322192 = r3322189 + r3322191;
        double r3322193 = r3322188 - r3322192;
        return r3322193;
}

double f(double x, double y, double z) {
        double r3322194 = x;
        double r3322195 = y;
        double r3322196 = z;
        double r3322197 = fma(r3322194, r3322195, r3322196);
        double r3322198 = r3322194 * r3322195;
        double r3322199 = r3322196 + r3322198;
        double r3322200 = r3322197 - r3322199;
        double r3322201 = exp(r3322200);
        double r3322202 = exp(1.0);
        double r3322203 = r3322201 / r3322202;
        double r3322204 = log(r3322203);
        double r3322205 = /* ERROR: no posit support in C */;
        double r3322206 = /* ERROR: no posit support in C */;
        return r3322206;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 44.3

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

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

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

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

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

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

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

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

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

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

  :herbie-target
  -1

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