Average Error: 0.2 → 0
Time: 3.0s
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 r862285 = d;
        double r862286 = 10.0;
        double r862287 = /* ERROR: no posit support in C */;
        double r862288 = r862285 * r862287;
        double r862289 = 20.0;
        double r862290 = /* ERROR: no posit support in C */;
        double r862291 = r862285 * r862290;
        double r862292 = r862288 + r862291;
        return r862292;
}

double f(double d) {
        double r862293 = d;
        double r862294 = 20.0;
        double r862295 = 10.0;
        double r862296 = r862294 + r862295;
        double r862297 = r862293 * r862296;
        return r862297;
}

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