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 r2662889 = d;
        double r2662890 = 10.0;
        double r2662891 = /* ERROR: no posit support in C */;
        double r2662892 = r2662889 * r2662891;
        double r2662893 = 20.0;
        double r2662894 = /* ERROR: no posit support in C */;
        double r2662895 = r2662889 * r2662894;
        double r2662896 = r2662892 + r2662895;
        return r2662896;
}

double f(double d) {
        double r2662897 = d;
        double r2662898 = 20.0;
        double r2662899 = 10.0;
        double r2662900 = r2662898 + r2662899;
        double r2662901 = r2662897 * r2662900;
        return r2662901;
}

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