Average Error: 0.2 → 0
Time: 3.9s
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 r2102489 = d;
        double r2102490 = 10.0;
        double r2102491 = /* ERROR: no posit support in C */;
        double r2102492 = r2102489 * r2102491;
        double r2102493 = 20.0;
        double r2102494 = /* ERROR: no posit support in C */;
        double r2102495 = r2102489 * r2102494;
        double r2102496 = r2102492 + r2102495;
        return r2102496;
}

double f(double d) {
        double r2102497 = d;
        double r2102498 = 20.0;
        double r2102499 = 10.0;
        double r2102500 = r2102498 + r2102499;
        double r2102501 = r2102497 * r2102500;
        return r2102501;
}

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