Average Error: 0.2 → 0
Time: 4.0s
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 r1391074 = d;
        double r1391075 = 10.0;
        double r1391076 = /* ERROR: no posit support in C */;
        double r1391077 = r1391074 * r1391076;
        double r1391078 = 20.0;
        double r1391079 = /* ERROR: no posit support in C */;
        double r1391080 = r1391074 * r1391079;
        double r1391081 = r1391077 + r1391080;
        return r1391081;
}

double f(double d) {
        double r1391082 = d;
        double r1391083 = 20.0;
        double r1391084 = 10.0;
        double r1391085 = r1391083 + r1391084;
        double r1391086 = r1391082 * r1391085;
        return r1391086;
}

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