Average Error: 0.2 → 0
Time: 3.7s
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 r2443576 = d;
        double r2443577 = 10.0;
        double r2443578 = /* ERROR: no posit support in C */;
        double r2443579 = r2443576 * r2443578;
        double r2443580 = 20.0;
        double r2443581 = /* ERROR: no posit support in C */;
        double r2443582 = r2443576 * r2443581;
        double r2443583 = r2443579 + r2443582;
        return r2443583;
}

double f(double d) {
        double r2443584 = d;
        double r2443585 = 20.0;
        double r2443586 = 10.0;
        double r2443587 = r2443585 + r2443586;
        double r2443588 = r2443584 * r2443587;
        return r2443588;
}

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