Average Error: 0.2 → 0
Time: 3.7s
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 r4622993 = d;
        double r4622994 = 10.0;
        double r4622995 = /* ERROR: no posit support in C */;
        double r4622996 = r4622993 * r4622995;
        double r4622997 = 20.0;
        double r4622998 = /* ERROR: no posit support in C */;
        double r4622999 = r4622993 * r4622998;
        double r4623000 = r4622996 + r4622999;
        return r4623000;
}

double f(double d) {
        double r4623001 = d;
        double r4623002 = 20.0;
        double r4623003 = 10.0;
        double r4623004 = r4623002 + r4623003;
        double r4623005 = r4623001 * r4623004;
        return r4623005;
}

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