Average Error: 0.2 → 0
Time: 4.3s
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 r6003412 = d;
        double r6003413 = 10.0;
        double r6003414 = /* ERROR: no posit support in C */;
        double r6003415 = r6003412 * r6003414;
        double r6003416 = 20.0;
        double r6003417 = /* ERROR: no posit support in C */;
        double r6003418 = r6003412 * r6003417;
        double r6003419 = r6003415 + r6003418;
        return r6003419;
}

double f(double d) {
        double r6003420 = d;
        double r6003421 = 20.0;
        double r6003422 = 10.0;
        double r6003423 = r6003421 + r6003422;
        double r6003424 = r6003420 * r6003423;
        return r6003424;
}

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