Average Error: 0.3 → 0.3
Time: 7.8s
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 r1505065 = d1;
        double r1505066 = 10.0;
        double r1505067 = /* ERROR: no posit support in C */;
        double r1505068 = r1505065 * r1505067;
        double r1505069 = d2;
        double r1505070 = r1505065 * r1505069;
        double r1505071 = r1505068 + r1505070;
        double r1505072 = 20.0;
        double r1505073 = /* ERROR: no posit support in C */;
        double r1505074 = r1505065 * r1505073;
        double r1505075 = r1505071 + r1505074;
        return r1505075;
}

double f(double d1, double d2) {
        double r1505076 = d1;
        double r1505077 = 10.0;
        double r1505078 = d2;
        double r1505079 = r1505077 + r1505078;
        double r1505080 = r1505076 * r1505079;
        double r1505081 = 20.0;
        double r1505082 = r1505076 * r1505081;
        double r1505083 = r1505080 + r1505082;
        return r1505083;
}

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