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 r1181038 = d;
        double r1181039 = 10.0;
        double r1181040 = /* ERROR: no posit support in C */;
        double r1181041 = r1181038 * r1181040;
        double r1181042 = 20.0;
        double r1181043 = /* ERROR: no posit support in C */;
        double r1181044 = r1181038 * r1181043;
        double r1181045 = r1181041 + r1181044;
        return r1181045;
}

double f(double d) {
        double r1181046 = d;
        double r1181047 = 20.0;
        double r1181048 = 10.0;
        double r1181049 = r1181047 + r1181048;
        double r1181050 = r1181046 * r1181049;
        return r1181050;
}

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