Average Error: 0.2 → 0
Time: 3.8s
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 r2513167 = d;
        double r2513168 = 10.0;
        double r2513169 = /* ERROR: no posit support in C */;
        double r2513170 = r2513167 * r2513169;
        double r2513171 = 20.0;
        double r2513172 = /* ERROR: no posit support in C */;
        double r2513173 = r2513167 * r2513172;
        double r2513174 = r2513170 + r2513173;
        return r2513174;
}

double f(double d) {
        double r2513175 = d;
        double r2513176 = 20.0;
        double r2513177 = 10.0;
        double r2513178 = r2513176 + r2513177;
        double r2513179 = r2513175 * r2513178;
        return r2513179;
}

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