Average Error: 0.2 → 0
Time: 4.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 r781226 = d;
        double r781227 = 10.0;
        double r781228 = /* ERROR: no posit support in C */;
        double r781229 = r781226 * r781228;
        double r781230 = 20.0;
        double r781231 = /* ERROR: no posit support in C */;
        double r781232 = r781226 * r781231;
        double r781233 = r781229 + r781232;
        return r781233;
}

double f(double d) {
        double r781234 = d;
        double r781235 = 20.0;
        double r781236 = 10.0;
        double r781237 = r781235 + r781236;
        double r781238 = r781234 * r781237;
        return r781238;
}

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