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 r3092744 = d;
        double r3092745 = 10.0;
        double r3092746 = /* ERROR: no posit support in C */;
        double r3092747 = r3092744 * r3092746;
        double r3092748 = 20.0;
        double r3092749 = /* ERROR: no posit support in C */;
        double r3092750 = r3092744 * r3092749;
        double r3092751 = r3092747 + r3092750;
        return r3092751;
}

double f(double d) {
        double r3092752 = d;
        double r3092753 = 20.0;
        double r3092754 = 10.0;
        double r3092755 = r3092753 + r3092754;
        double r3092756 = r3092752 * r3092755;
        return r3092756;
}

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