Average Error: 0.2 → 0
Time: 4.3s
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 r972870 = d;
        double r972871 = 10.0;
        double r972872 = /* ERROR: no posit support in C */;
        double r972873 = r972870 * r972872;
        double r972874 = 20.0;
        double r972875 = /* ERROR: no posit support in C */;
        double r972876 = r972870 * r972875;
        double r972877 = r972873 + r972876;
        return r972877;
}

double f(double d) {
        double r972878 = d;
        double r972879 = 20.0;
        double r972880 = 10.0;
        double r972881 = r972879 + r972880;
        double r972882 = r972878 * r972881;
        return r972882;
}

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