Average Error: 0.2 → 0
Time: 3.9s
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 r1412890 = d;
        double r1412891 = 10.0;
        double r1412892 = /* ERROR: no posit support in C */;
        double r1412893 = r1412890 * r1412892;
        double r1412894 = 20.0;
        double r1412895 = /* ERROR: no posit support in C */;
        double r1412896 = r1412890 * r1412895;
        double r1412897 = r1412893 + r1412896;
        return r1412897;
}

double f(double d) {
        double r1412898 = d;
        double r1412899 = 20.0;
        double r1412900 = 10.0;
        double r1412901 = r1412899 + r1412900;
        double r1412902 = r1412898 * r1412901;
        return r1412902;
}

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