Average Error: 0.2 → 0
Time: 4.1s
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 r3677305 = d;
        double r3677306 = 10.0;
        double r3677307 = /* ERROR: no posit support in C */;
        double r3677308 = r3677305 * r3677307;
        double r3677309 = 20.0;
        double r3677310 = /* ERROR: no posit support in C */;
        double r3677311 = r3677305 * r3677310;
        double r3677312 = r3677308 + r3677311;
        return r3677312;
}

double f(double d) {
        double r3677313 = d;
        double r3677314 = 20.0;
        double r3677315 = 10.0;
        double r3677316 = r3677314 + r3677315;
        double r3677317 = r3677313 * r3677316;
        return r3677317;
}

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