Average Error: 0.3 → 0.3
Time: 9.4s
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 r4229946 = d1;
        double r4229947 = 10.0;
        double r4229948 = /* ERROR: no posit support in C */;
        double r4229949 = r4229946 * r4229948;
        double r4229950 = d2;
        double r4229951 = r4229946 * r4229950;
        double r4229952 = r4229949 + r4229951;
        double r4229953 = 20.0;
        double r4229954 = /* ERROR: no posit support in C */;
        double r4229955 = r4229946 * r4229954;
        double r4229956 = r4229952 + r4229955;
        return r4229956;
}

double f(double d1, double d2) {
        double r4229957 = d1;
        double r4229958 = 10.0;
        double r4229959 = d2;
        double r4229960 = r4229958 + r4229959;
        double r4229961 = r4229957 * r4229960;
        double r4229962 = 20.0;
        double r4229963 = r4229957 * r4229962;
        double r4229964 = r4229961 + r4229963;
        return r4229964;
}

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