Average Error: 0.2 → 0
Time: 3.9s
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 r4838095 = d;
        double r4838096 = 10.0;
        double r4838097 = /* ERROR: no posit support in C */;
        double r4838098 = r4838095 * r4838097;
        double r4838099 = 20.0;
        double r4838100 = /* ERROR: no posit support in C */;
        double r4838101 = r4838095 * r4838100;
        double r4838102 = r4838098 + r4838101;
        return r4838102;
}

double f(double d) {
        double r4838103 = d;
        double r4838104 = 20.0;
        double r4838105 = 10.0;
        double r4838106 = r4838104 + r4838105;
        double r4838107 = r4838103 * r4838106;
        return r4838107;
}

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