Average Error: 0.3 → 0.3
Time: 9.5s
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 r2808512 = d1;
        double r2808513 = 10.0;
        double r2808514 = /* ERROR: no posit support in C */;
        double r2808515 = r2808512 * r2808514;
        double r2808516 = d2;
        double r2808517 = r2808512 * r2808516;
        double r2808518 = r2808515 + r2808517;
        double r2808519 = 20.0;
        double r2808520 = /* ERROR: no posit support in C */;
        double r2808521 = r2808512 * r2808520;
        double r2808522 = r2808518 + r2808521;
        return r2808522;
}

double f(double d1, double d2) {
        double r2808523 = d1;
        double r2808524 = 10.0;
        double r2808525 = d2;
        double r2808526 = r2808524 + r2808525;
        double r2808527 = r2808523 * r2808526;
        double r2808528 = 20.0;
        double r2808529 = r2808523 * r2808528;
        double r2808530 = r2808527 + r2808529;
        return r2808530;
}

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