Average Error: 0.2 → 0
Time: 4.7s
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 r1497237 = d;
        double r1497238 = 10.0;
        double r1497239 = /* ERROR: no posit support in C */;
        double r1497240 = r1497237 * r1497239;
        double r1497241 = 20.0;
        double r1497242 = /* ERROR: no posit support in C */;
        double r1497243 = r1497237 * r1497242;
        double r1497244 = r1497240 + r1497243;
        return r1497244;
}

double f(double d) {
        double r1497245 = d;
        double r1497246 = 20.0;
        double r1497247 = 10.0;
        double r1497248 = r1497246 + r1497247;
        double r1497249 = r1497245 * r1497248;
        return r1497249;
}

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