Average Error: 0.2 → 0
Time: 3.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 r2675509 = d;
        double r2675510 = 10.0;
        double r2675511 = /* ERROR: no posit support in C */;
        double r2675512 = r2675509 * r2675511;
        double r2675513 = 20.0;
        double r2675514 = /* ERROR: no posit support in C */;
        double r2675515 = r2675509 * r2675514;
        double r2675516 = r2675512 + r2675515;
        return r2675516;
}

double f(double d) {
        double r2675517 = d;
        double r2675518 = 20.0;
        double r2675519 = 10.0;
        double r2675520 = r2675518 + r2675519;
        double r2675521 = r2675517 * r2675520;
        return r2675521;
}

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))))