Average Error: 0.2 → 0
Time: 3.5s
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 r5251886 = d;
        double r5251887 = 10.0;
        double r5251888 = /* ERROR: no posit support in C */;
        double r5251889 = r5251886 * r5251888;
        double r5251890 = 20.0;
        double r5251891 = /* ERROR: no posit support in C */;
        double r5251892 = r5251886 * r5251891;
        double r5251893 = r5251889 + r5251892;
        return r5251893;
}

double f(double d) {
        double r5251894 = d;
        double r5251895 = 20.0;
        double r5251896 = 10.0;
        double r5251897 = r5251895 + r5251896;
        double r5251898 = r5251894 * r5251897;
        return r5251898;
}

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