Average Error: 0.3 → 0.3
Time: 10.2s
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 r5207728 = d1;
        double r5207729 = 10.0;
        double r5207730 = /* ERROR: no posit support in C */;
        double r5207731 = r5207728 * r5207730;
        double r5207732 = d2;
        double r5207733 = r5207728 * r5207732;
        double r5207734 = r5207731 + r5207733;
        double r5207735 = 20.0;
        double r5207736 = /* ERROR: no posit support in C */;
        double r5207737 = r5207728 * r5207736;
        double r5207738 = r5207734 + r5207737;
        return r5207738;
}

double f(double d1, double d2) {
        double r5207739 = d1;
        double r5207740 = 10.0;
        double r5207741 = d2;
        double r5207742 = r5207740 + r5207741;
        double r5207743 = r5207739 * r5207742;
        double r5207744 = 20.0;
        double r5207745 = r5207739 * r5207744;
        double r5207746 = r5207743 + r5207745;
        return r5207746;
}

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