Average Error: 0.3 → 0.3
Time: 8.1s
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 r2229100 = d1;
        double r2229101 = 10.0;
        double r2229102 = /* ERROR: no posit support in C */;
        double r2229103 = r2229100 * r2229102;
        double r2229104 = d2;
        double r2229105 = r2229100 * r2229104;
        double r2229106 = r2229103 + r2229105;
        double r2229107 = 20.0;
        double r2229108 = /* ERROR: no posit support in C */;
        double r2229109 = r2229100 * r2229108;
        double r2229110 = r2229106 + r2229109;
        return r2229110;
}

double f(double d1, double d2) {
        double r2229111 = d1;
        double r2229112 = 10.0;
        double r2229113 = d2;
        double r2229114 = r2229112 + r2229113;
        double r2229115 = r2229111 * r2229114;
        double r2229116 = 20.0;
        double r2229117 = r2229111 * r2229116;
        double r2229118 = r2229115 + r2229117;
        return r2229118;
}

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 2019128 
(FPCore (d1 d2)
  :name "FastMath test2"
  (+.p16 (+.p16 (*.p16 d1 (real->posit16 10)) (*.p16 d1 d2)) (*.p16 d1 (real->posit16 20))))