Average Error: 0.2 → 0
Time: 4.5s
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 r3125401 = d;
        double r3125402 = 10.0;
        double r3125403 = /* ERROR: no posit support in C */;
        double r3125404 = r3125401 * r3125403;
        double r3125405 = 20.0;
        double r3125406 = /* ERROR: no posit support in C */;
        double r3125407 = r3125401 * r3125406;
        double r3125408 = r3125404 + r3125407;
        return r3125408;
}

double f(double d) {
        double r3125409 = d;
        double r3125410 = 20.0;
        double r3125411 = 10.0;
        double r3125412 = r3125410 + r3125411;
        double r3125413 = r3125409 * r3125412;
        return r3125413;
}

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