Average Error: 0.2 → 0
Time: 4.4s
Precision: 64
\[\frac{\left(d \cdot \left(10\right)\right)}{\left(d \cdot \left(20\right)\right)}\]
\[d \cdot \left(20 + 10\right)\]
\frac{\left(d \cdot \left(10\right)\right)}{\left(d \cdot \left(20\right)\right)}
d \cdot \left(20 + 10\right)
double f(double d) {
        double r1618505 = d;
        double r1618506 = 10.0;
        double r1618507 = /* ERROR: no posit support in C */;
        double r1618508 = r1618505 * r1618507;
        double r1618509 = 20.0;
        double r1618510 = /* ERROR: no posit support in C */;
        double r1618511 = r1618505 * r1618510;
        double r1618512 = r1618508 + r1618511;
        return r1618512;
}

double f(double d) {
        double r1618513 = d;
        double r1618514 = 20.0;
        double r1618515 = 10.0;
        double r1618516 = r1618514 + r1618515;
        double r1618517 = r1618513 * r1618516;
        return r1618517;
}

Error

Bits error versus d

Derivation

  1. Initial program 0.2

    \[\frac{\left(d \cdot \left(10\right)\right)}{\left(d \cdot \left(20\right)\right)}\]
  2. Simplified0

    \[\leadsto \color{blue}{d \cdot \left(\frac{\left(20\right)}{\left(10\right)}\right)}\]
  3. Final simplification0

    \[\leadsto d \cdot \left(20 + 10\right)\]

Reproduce

herbie shell --seed 2019107 +o rules:numerics
(FPCore (d)
  :name "FastMath test1"
  (+.p16 (*.p16 d (real->posit16 10)) (*.p16 d (real->posit16 20))))