Average Error: 0.2 → 0
Time: 4.3s
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 r4757181 = d;
        double r4757182 = 10.0;
        double r4757183 = /* ERROR: no posit support in C */;
        double r4757184 = r4757181 * r4757183;
        double r4757185 = 20.0;
        double r4757186 = /* ERROR: no posit support in C */;
        double r4757187 = r4757181 * r4757186;
        double r4757188 = r4757184 + r4757187;
        return r4757188;
}

double f(double d) {
        double r4757189 = d;
        double r4757190 = 20.0;
        double r4757191 = 10.0;
        double r4757192 = r4757190 + r4757191;
        double r4757193 = r4757189 * r4757192;
        return r4757193;
}

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