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 r1226672 = d;
        double r1226673 = 10.0;
        double r1226674 = /* ERROR: no posit support in C */;
        double r1226675 = r1226672 * r1226674;
        double r1226676 = 20.0;
        double r1226677 = /* ERROR: no posit support in C */;
        double r1226678 = r1226672 * r1226677;
        double r1226679 = r1226675 + r1226678;
        return r1226679;
}

double f(double d) {
        double r1226680 = d;
        double r1226681 = 20.0;
        double r1226682 = 10.0;
        double r1226683 = r1226681 + r1226682;
        double r1226684 = r1226680 * r1226683;
        return r1226684;
}

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