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 r3749469 = d;
        double r3749470 = 10.0;
        double r3749471 = /* ERROR: no posit support in C */;
        double r3749472 = r3749469 * r3749471;
        double r3749473 = 20.0;
        double r3749474 = /* ERROR: no posit support in C */;
        double r3749475 = r3749469 * r3749474;
        double r3749476 = r3749472 + r3749475;
        return r3749476;
}

double f(double d) {
        double r3749477 = d;
        double r3749478 = 20.0;
        double r3749479 = 10.0;
        double r3749480 = r3749478 + r3749479;
        double r3749481 = r3749477 * r3749480;
        return r3749481;
}

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