Average Error: 0.2 → 0
Time: 3.6s
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 r2997085 = d;
        double r2997086 = 10.0;
        double r2997087 = /* ERROR: no posit support in C */;
        double r2997088 = r2997085 * r2997087;
        double r2997089 = 20.0;
        double r2997090 = /* ERROR: no posit support in C */;
        double r2997091 = r2997085 * r2997090;
        double r2997092 = r2997088 + r2997091;
        return r2997092;
}

double f(double d) {
        double r2997093 = d;
        double r2997094 = 20.0;
        double r2997095 = 10.0;
        double r2997096 = r2997094 + r2997095;
        double r2997097 = r2997093 * r2997096;
        return r2997097;
}

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