Average Error: 44.7 → 8.1
Time: 24.4s
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 r2966250 = x;
        double r2966251 = y;
        double r2966252 = z;
        double r2966253 = fma(r2966250, r2966251, r2966252);
        double r2966254 = 1.0;
        double r2966255 = r2966250 * r2966251;
        double r2966256 = r2966255 + r2966252;
        double r2966257 = r2966254 + r2966256;
        double r2966258 = r2966253 - r2966257;
        return r2966258;
}

double f(double x, double y, double z) {
        double r2966259 = x;
        double r2966260 = y;
        double r2966261 = z;
        double r2966262 = fma(r2966259, r2966260, r2966261);
        double r2966263 = r2966259 * r2966260;
        double r2966264 = r2966261 + r2966263;
        double r2966265 = r2966262 - r2966264;
        double r2966266 = exp(r2966265);
        double r2966267 = exp(1.0);
        double r2966268 = r2966266 / r2966267;
        double r2966269 = log(r2966268);
        double r2966270 = /* ERROR: no posit support in C */;
        double r2966271 = /* ERROR: no posit support in C */;
        double r2966272 = /* ERROR: no posit support in C */;
        double r2966273 = /* ERROR: no posit support in C */;
        return r2966273;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.7
Target0
Herbie8.1
\[-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-cbrt44.0

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

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

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

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

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

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

    \[\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} \cdot e^{z}\right)\right)\right)\right)\right)\]
  14. Applied diff-log35.1

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

    \[\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)\]
  16. Final simplification8.1

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

  :herbie-target
  -1

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