Average Error: 0.3 → 0.3
Time: 9.3s
Precision: 64
\[\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}\]
\[d1 \cdot \left(10 + d2\right) + d1 \cdot 20\]
\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}
d1 \cdot \left(10 + d2\right) + d1 \cdot 20
double f(double d1, double d2) {
        double r1935753 = d1;
        double r1935754 = 10.0;
        double r1935755 = /* ERROR: no posit support in C */;
        double r1935756 = r1935753 * r1935755;
        double r1935757 = d2;
        double r1935758 = r1935753 * r1935757;
        double r1935759 = r1935756 + r1935758;
        double r1935760 = 20.0;
        double r1935761 = /* ERROR: no posit support in C */;
        double r1935762 = r1935753 * r1935761;
        double r1935763 = r1935759 + r1935762;
        return r1935763;
}

double f(double d1, double d2) {
        double r1935764 = d1;
        double r1935765 = 10.0;
        double r1935766 = d2;
        double r1935767 = r1935765 + r1935766;
        double r1935768 = r1935764 * r1935767;
        double r1935769 = 20.0;
        double r1935770 = r1935764 * r1935769;
        double r1935771 = r1935768 + r1935770;
        return r1935771;
}

Error

Bits error versus d1

Bits error versus d2

Derivation

  1. Initial program 0.3

    \[\frac{\left(\frac{\left(d1 \cdot \left(10\right)\right)}{\left(d1 \cdot d2\right)}\right)}{\left(d1 \cdot \left(20\right)\right)}\]
  2. Using strategy rm
  3. Applied distribute-lft-out0.3

    \[\leadsto \frac{\color{blue}{\left(d1 \cdot \left(\frac{\left(10\right)}{d2}\right)\right)}}{\left(d1 \cdot \left(20\right)\right)}\]
  4. Final simplification0.3

    \[\leadsto d1 \cdot \left(10 + d2\right) + d1 \cdot 20\]

Reproduce

herbie shell --seed 2019128 +o rules:numerics
(FPCore (d1 d2)
  :name "FastMath test2"
  (+.p16 (+.p16 (*.p16 d1 (real->posit16 10)) (*.p16 d1 d2)) (*.p16 d1 (real->posit16 20))))