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 r2535215 = d;
        double r2535216 = 10.0;
        double r2535217 = /* ERROR: no posit support in C */;
        double r2535218 = r2535215 * r2535217;
        double r2535219 = 20.0;
        double r2535220 = /* ERROR: no posit support in C */;
        double r2535221 = r2535215 * r2535220;
        double r2535222 = r2535218 + r2535221;
        return r2535222;
}

double f(double d) {
        double r2535223 = d;
        double r2535224 = 20.0;
        double r2535225 = 10.0;
        double r2535226 = r2535224 + r2535225;
        double r2535227 = r2535223 * r2535226;
        return r2535227;
}

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