Average Error: 0.2 → 0
Time: 3.6s
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 r2550287 = d;
        double r2550288 = 10.0;
        double r2550289 = /* ERROR: no posit support in C */;
        double r2550290 = r2550287 * r2550289;
        double r2550291 = 20.0;
        double r2550292 = /* ERROR: no posit support in C */;
        double r2550293 = r2550287 * r2550292;
        double r2550294 = r2550290 + r2550293;
        return r2550294;
}

double f(double d) {
        double r2550295 = d;
        double r2550296 = 20.0;
        double r2550297 = 10.0;
        double r2550298 = r2550296 + r2550297;
        double r2550299 = r2550295 * r2550298;
        return r2550299;
}

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