Average Error: 0.2 → 0
Time: 3.4s
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 r309481 = d;
        double r309482 = 10.0;
        double r309483 = /* ERROR: no posit support in C */;
        double r309484 = r309481 * r309483;
        double r309485 = 20.0;
        double r309486 = /* ERROR: no posit support in C */;
        double r309487 = r309481 * r309486;
        double r309488 = r309484 + r309487;
        return r309488;
}

double f(double d) {
        double r309489 = d;
        double r309490 = 20.0;
        double r309491 = 10.0;
        double r309492 = r309490 + r309491;
        double r309493 = r309489 * r309492;
        return r309493;
}

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