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 r2595299 = d;
        double r2595300 = 10.0;
        double r2595301 = /* ERROR: no posit support in C */;
        double r2595302 = r2595299 * r2595301;
        double r2595303 = 20.0;
        double r2595304 = /* ERROR: no posit support in C */;
        double r2595305 = r2595299 * r2595304;
        double r2595306 = r2595302 + r2595305;
        return r2595306;
}

double f(double d) {
        double r2595307 = d;
        double r2595308 = 20.0;
        double r2595309 = 10.0;
        double r2595310 = r2595308 + r2595309;
        double r2595311 = r2595307 * r2595310;
        return r2595311;
}

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