Average Error: 0.2 → 0
Time: 5.2s
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 r872539 = d;
        double r872540 = 10.0;
        double r872541 = /* ERROR: no posit support in C */;
        double r872542 = r872539 * r872541;
        double r872543 = 20.0;
        double r872544 = /* ERROR: no posit support in C */;
        double r872545 = r872539 * r872544;
        double r872546 = r872542 + r872545;
        return r872546;
}

double f(double d) {
        double r872547 = d;
        double r872548 = 20.0;
        double r872549 = 10.0;
        double r872550 = r872548 + r872549;
        double r872551 = r872547 * r872550;
        return r872551;
}

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