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 r1784313 = d;
        double r1784314 = 10.0;
        double r1784315 = /* ERROR: no posit support in C */;
        double r1784316 = r1784313 * r1784315;
        double r1784317 = 20.0;
        double r1784318 = /* ERROR: no posit support in C */;
        double r1784319 = r1784313 * r1784318;
        double r1784320 = r1784316 + r1784319;
        return r1784320;
}

double f(double d) {
        double r1784321 = d;
        double r1784322 = 20.0;
        double r1784323 = 10.0;
        double r1784324 = r1784322 + r1784323;
        double r1784325 = r1784321 * r1784324;
        return r1784325;
}

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