Average Error: 0.3 → 0.3
Time: 10.9s
Precision: 64
\[\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}\]
\[d1 \cdot \left(10 + d2\right) + d1 \cdot 20\]
\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}
d1 \cdot \left(10 + d2\right) + d1 \cdot 20
double f(double d1, double d2) {
        double r5456708 = d1;
        double r5456709 = 10.0;
        double r5456710 = /* ERROR: no posit support in C */;
        double r5456711 = r5456708 * r5456710;
        double r5456712 = d2;
        double r5456713 = r5456708 * r5456712;
        double r5456714 = r5456711 + r5456713;
        double r5456715 = 20.0;
        double r5456716 = /* ERROR: no posit support in C */;
        double r5456717 = r5456708 * r5456716;
        double r5456718 = r5456714 + r5456717;
        return r5456718;
}

double f(double d1, double d2) {
        double r5456719 = d1;
        double r5456720 = 10.0;
        double r5456721 = d2;
        double r5456722 = r5456720 + r5456721;
        double r5456723 = r5456719 * r5456722;
        double r5456724 = 20.0;
        double r5456725 = r5456719 * r5456724;
        double r5456726 = r5456723 + r5456725;
        return r5456726;
}

Error

Bits error versus d1

Bits error versus d2

Derivation

  1. Initial program 0.3

    \[\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}\]
  2. Using strategy rm
  3. Applied p16-distribute-lft-out0.3

    \[\leadsto \frac{\color{blue}{\left(d1 \cdot \left(\frac{\left(10\right)}{d2}\right)\right)}}{\left(d1 \cdot \left(20\right)\right)}\]
  4. Final simplification0.3

    \[\leadsto d1 \cdot \left(10 + d2\right) + d1 \cdot 20\]

Reproduce

herbie shell --seed 2019134 
(FPCore (d1 d2)
  :name "FastMath test2"
  (+.p16 (+.p16 (*.p16 d1 (real->posit16 10)) (*.p16 d1 d2)) (*.p16 d1 (real->posit16 20))))