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 r5431349 = d;
        double r5431350 = 10.0;
        double r5431351 = /* ERROR: no posit support in C */;
        double r5431352 = r5431349 * r5431351;
        double r5431353 = 20.0;
        double r5431354 = /* ERROR: no posit support in C */;
        double r5431355 = r5431349 * r5431354;
        double r5431356 = r5431352 + r5431355;
        return r5431356;
}

double f(double d) {
        double r5431357 = d;
        double r5431358 = 20.0;
        double r5431359 = 10.0;
        double r5431360 = r5431358 + r5431359;
        double r5431361 = r5431357 * r5431360;
        return r5431361;
}

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