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

double f(double d) {
        double r2443581 = d;
        double r2443582 = 20.0;
        double r2443583 = 10.0;
        double r2443584 = r2443582 + r2443583;
        double r2443585 = r2443581 * r2443584;
        return r2443585;
}

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