Average Error: 0.2 → 0
Time: 4.5s
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 r1621228 = d;
        double r1621229 = 10.0;
        double r1621230 = /* ERROR: no posit support in C */;
        double r1621231 = r1621228 * r1621230;
        double r1621232 = 20.0;
        double r1621233 = /* ERROR: no posit support in C */;
        double r1621234 = r1621228 * r1621233;
        double r1621235 = r1621231 + r1621234;
        return r1621235;
}

double f(double d) {
        double r1621236 = d;
        double r1621237 = 20.0;
        double r1621238 = 10.0;
        double r1621239 = r1621237 + r1621238;
        double r1621240 = r1621236 * r1621239;
        return r1621240;
}

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 
(FPCore (d)
  :name "FastMath test1"
  (+.p16 (*.p16 d (real->posit16 10)) (*.p16 d (real->posit16 20))))