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 r3899735 = d;
        double r3899736 = 10.0;
        double r3899737 = /* ERROR: no posit support in C */;
        double r3899738 = r3899735 * r3899737;
        double r3899739 = 20.0;
        double r3899740 = /* ERROR: no posit support in C */;
        double r3899741 = r3899735 * r3899740;
        double r3899742 = r3899738 + r3899741;
        return r3899742;
}

double f(double d) {
        double r3899743 = d;
        double r3899744 = 20.0;
        double r3899745 = 10.0;
        double r3899746 = r3899744 + r3899745;
        double r3899747 = r3899743 * r3899746;
        return r3899747;
}

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