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 r4987443 = d;
        double r4987444 = 10.0;
        double r4987445 = /* ERROR: no posit support in C */;
        double r4987446 = r4987443 * r4987445;
        double r4987447 = 20.0;
        double r4987448 = /* ERROR: no posit support in C */;
        double r4987449 = r4987443 * r4987448;
        double r4987450 = r4987446 + r4987449;
        return r4987450;
}

double f(double d) {
        double r4987451 = d;
        double r4987452 = 20.0;
        double r4987453 = 10.0;
        double r4987454 = r4987452 + r4987453;
        double r4987455 = r4987451 * r4987454;
        return r4987455;
}

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