Average Error: 0.3 → 0.3
Time: 8.6s
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 r2865548 = d1;
        double r2865549 = 10.0;
        double r2865550 = /* ERROR: no posit support in C */;
        double r2865551 = r2865548 * r2865550;
        double r2865552 = d2;
        double r2865553 = r2865548 * r2865552;
        double r2865554 = r2865551 + r2865553;
        double r2865555 = 20.0;
        double r2865556 = /* ERROR: no posit support in C */;
        double r2865557 = r2865548 * r2865556;
        double r2865558 = r2865554 + r2865557;
        return r2865558;
}

double f(double d1, double d2) {
        double r2865559 = d1;
        double r2865560 = 10.0;
        double r2865561 = d2;
        double r2865562 = r2865560 + r2865561;
        double r2865563 = r2865559 * r2865562;
        double r2865564 = 20.0;
        double r2865565 = r2865559 * r2865564;
        double r2865566 = r2865563 + r2865565;
        return r2865566;
}

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